UI Elements
Horizontal Chart A bar chart component for comparing numeric values horizontally
Horizontal Chart renders a set of labeled data points as horizontal 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.
Name Type Description dataPointsList<DataPoint>List of entries containing label and numeric value
DataPoint
Field Type Description labelstringDisplay name for the bar valuefloatHeight or length of the bar
Name Type Description paddingRectOffsetInner padding around chart content gridToBarsOffsetfloatDistance between grid and bars barSpacingfloatVertical spacing between bars barCornerRadiusfloatRadius used for rounded bar corners barSpriteSpriteCustom sprite used for bars (optional) labelWidthfloatWidth of left side label area valueWidthfloatWidth of right side value area
Name Type Description showGridbool显示 vertical grid lines verticalGridLinesintNumber of divisions in the grid gridLineThicknessfloatThickness of grid lines
Name Type Description showAxisboolShows X and Y axes axisThicknessfloatThickness of axis lines
Name Type Description showValuesboolShows value text next to each bar valueFontSizefloatFont size for value text
Name Type Description stylingSourceStylingSourceSource used for styler color lookup stylerPresetStylerPresetPreset used when stylingSource is StylerPreset gridColorColorMappingGrid coloring axisColorColorMappingAxis coloring barColorColorMappingBar fill coloring labelColorColorMappingLabel coloring valueFontFontMappingFont for value text labelFontFontMappingFont for label text labelFontSizefloatSize of label text
Name Parameters Description DrawChart()None Clears and rebuilds the entire chart UpdateData(newData)List<DataPoint>Replaces all data points and redraws AddDataPoint(label, value)string, floatAdds a new entry RemoveDataPoint(index)intRemoves an entry ClearData()None Clears all points SetDataPoint(index, label, value)int, string, floatUpdates a single entry SetDataPoint(point, label, value)DataPoint, string, floatUpdates an existing item reference ShowValuesproperty Enables or disables value labels
HorizontalChartExample.cs using UnityEngine ;
using Evo . UI ;
public class HorizontalChartExample : MonoBehaviour
{
public HorizontalChart chart ;
void Start ()
{
// Add some data
chart. AddDataPoint ( "Apples" , 50 );
chart. AddDataPoint ( "Oranges" , 75 );
chart. AddDataPoint ( "Bananas" , 30 );
// Modify data
chart. SetDataPoint ( 1 , "Oranges" , 90 );
// Hide value labels
chart.ShowValues = false ;
// Replace all data
chart. UpdateData ( new ()
{
new HorizontalChart . DataPoint ( "Product A" , 120 ),
new HorizontalChart . DataPoint ( "Product B" , 80 )
});
// Redraw chart
chart. DrawChart ();
}
}