This component requires a premimum subscription to be used. For more details, see Plans and pricing.
The Chart.HorizontalBar
component is part of the premium set of chart components, with
greater control over their layout and design. The bar chart allows visualising
data on horizontal bars, with either a categorical or numerical Y-axis.
Below is an example of the schema required to define a Chart.Bar
component:
{
"type": "Chart.HorizontalBar",
"options": {
"width": "2/4",
"data": [{"x": 0, "y": 5}, ...],
"color_scheme": "Tableau10",
"font_size": 12,
"aspect_ratio": 1.2,
"x_label": "X axis label",
"y_label": "Y axis label",
"chart_title": "Chart title",
"caption": "Lorem ipsum dolor, sit amet consectetur adipisicing elit. Repudiandae provident ipsa culpa officiis illum commodi voluptas, sequi repellat veniam adipisci laboriosam amet nesciunt nam explicabo voluptate minima inventore, minus sint"
}
}
Key | Description |
---|---|
data |
The data to plot in the chart. See below for more details. |
font_size |
Optional. The font size in pixels. Defaults to 16. |
aspect_ratio |
Optional. The aspect ratio of the chart (width / height). Defaults to 1.6. |
color_scheme |
Optional. A Brewer color scheme to color each bar using. |
x_label |
The X-axis label. |
y_label |
The Y-axis label. |
chart_title |
Optional. The chart title. |
caption |
Optional. Caption below the chart. |
width |
Optional. The width of the component, when inside a Section or Row component with their columns option set to null . |
The data key must be an array of objects, with each object containing the keys
x
and y
. To set the colour for each bar, provide a color
key with a hex value. Values for y
may be categorical or numerical. A maximum of 1,000 points can be plotted on a chart.
The colour of the bars can be set in one of three ways:
color
key for each object in the data
key.color_scheme
key to an option from color brewer scales. Allowed values include:The width
key supports defining the width using a fraction specified as a
string e.g. 1/3
. The values for the denominator supported are 2, 3, 4, 5, 6
and 12, whilst the numerator can be any value up to the value of the denominator.
If the width
key is set to null
, then the component will attempt to fill
all the available horizontal space.
Hybiscus is continuously improving and adding new features. If you think we are missing a critical feature, please do not hesitate to contact us and offer your feedback at info@hybiscus.dev