Logo
UI Elements

Vertical Chart

A bar chart component for comparing numeric values vertically

Overview

Vertical Chart displays a list of labeled values using vertical bars. It supports custom styling through the Styler system.

At runtime or in the editor, the chart rebuilds itself whenever data changes or when the RectTransform size updates. All visible elements are generated dynamically.


Properties

Data

NameTypeDescription
dataPointsList<DataPoint>List containing label and value

DataPoint

FieldTypeDescription
labelstringCategory label
valuefloatBar value
tableKey (optional)stringLocalization key for label

Settings

NameTypeDescription
paddingRectOffsetPadding inside the chart area
gridToBarsOffsetfloatGap between bars and grid
barSpacingfloatSpacing between bars
barCornerRadiusfloatCorner radius for rounded bars
barSpriteSpriteCustom bar sprite (optional)

Grid Settings

NameTypeDescription
showGridboolShows horizontal grid lines
horizontalGridLinesintNumber of grid lines
gridLineThicknessfloatGrid line thickness

Axis Settings

NameTypeDescription
showAxisboolShows X and Y axis lines
axisThicknessfloatAxis line thickness

Value Settings

NameTypeDescription
showValuesboolPlaces numeric labels above bars
valueHeightfloatHeight for numeric label area
valueFontSizefloatFont size for value labels

Label Settings

NameTypeDescription
labelHeightfloatHeight for label area below bars
labelFontSizefloatFont size for category labels

Styling

NameTypeDescription
stylingSourceStylingSourceCustom or Styler preset
stylerPresetStylerPresetStyle preset
gridColorColorMappingColor mapping for grid lines
axisColorColorMappingColor mapping for axes
barColorColorMappingColor mapping for bars
labelColorColorMappingColor mapping for labels
valueFontFontMappingFont used for value labels
labelFontFontMappingFont used for category labels

Public Methods

NameParametersDescription
UpdateData(newData)List<DataPoint>Replaces all data points
DrawChart()NoneForces a full redraw
AddDataPoint(label, value)string, floatAdds a new bar
RemoveDataPoint(index)intRemoves bar at index
ClearData()NoneClears all points
SetDataPoint(index, label, value)int, string, floatUpdates a point
SetDataPoint(item, label, value)DataPoint, string, floatUpdates specific item
ShowValuesboolEnables or disables bar value labels

Code Example

VerticalChartExample.cs
using UnityEngine;
using Evo.UI;

public class VerticalChartExample : MonoBehaviour
{
    public VerticalChart chart;

    void Start()
    {
        // Add or update data
        chart.AddDataPoint("Jan", 60f);
        chart.AddDataPoint("Feb", 90f);
        chart.SetDataPoint(0, "January", 75f);

        // Toggle labels
        chart.ShowValues = true;

        // Redraw
        chart.DrawChart();
    }
}

On this page