Bar Chart
A bar chart provides a way of showing data values represented as vertical bars. It is sometimes used to show trend data, and the comparison of multiple data sets side by side.
Common Dataset Options¶
These options are common to all datasets.
BackgroundColor¶
The line fill color.
BorderColor¶
The line color.
BorderWidth¶
The line width (in pixels).
Clip¶
How to clip relative to chartArea. Positive value allows overflow, negative value clips that many pixels inside chartArea. 0 = clip at chartArea.
Is clip enabled? Clipping can also be configured per side: clip: {left: 5, top: false, right: -2, bottom: 0}Hidden¶
Configure the visibility of the dataset. Using hidden: true will hide the dataset from being rendered in the Chart.
HoverBackgroundColor¶
Background color when hovered.
HoverBorderColor¶
Border color when hovered.
HoverBorderWidth¶
The line width (in pixels) when hovered.
Label¶
The label for the dataset which appears in the legend and tooltips.
Parsing¶
How to parse the dataset. The parsing can be disabled by specifying parsing: false at chart options or dataset. If parsing is disabled, data must be sorted and in the formats the associated chart type and scales use internally.
Parsing with key. Parsing with x and y axis keys.Bar Dataset Options¶
Bar chart specific dataset options.
BackgroundColors¶
Set backgrounds colors.
BorderColors¶
Set border colors.
Base¶
Base value for the bar in data units along the value axis. If not set, defaults to the value axis base value.
BarPercentage¶
Percent (0-1) of the available width each bar should be within the category width.
1.0
will take the whole category width and put the bars right next to each other.
Default 0.9
BarThickness¶
If this value is a number, it is applied to the width of each bar, in pixels. When this is enforced, barPercentage and categoryPercentage are ignored.
If set to 'flex', the base sample widths are calculated automatically based on the previous and following samples so that they take the full available widths without overlap. Then, bars are sized using barPercentage and categoryPercentage. There is no gap when the percentage options are1
.
This mode generates bars with different widths when data are not evenly spaced.
BorderSkipped¶
This setting is used to avoid drawing the bar stroke at the base of the fill, or disable the border radius. In general, this does not need to be changed except when creating chart types that derive from a bar chart.
Skip all borders (true
), or don't skip any borders (false
).
BorderWidth¶
If this value is a number, it is applied to all sides of the rectangle (left
, top
, right
, bottom
), except borderSkipped
.
Default 0
borderSkipped
are skipped.
BorderRadius¶
If this value is a number, it is applied to all corners of the rectangle (topLeft
, topRight
, bottomLeft
, bottomRight
),
except corners touching the borderSkipped
. Default 0
topRight
, bottomLeft
, and bottomRight
.
CategoryPercentage¶
Percent (0-1) of the available width each category should be within the sample width.
Data¶
Sets the data for the Dataset.
Grouped¶
Should the bars be grouped on index axis. When true, all the datasets at same index value will be placed next to each other centering on that index value.
When false, each bar is placed on its actual index-axis value. Default true
HoverBorderRadius¶
The bar border radius when hovered (in pixels). Default 0
IndexAxis¶
The base axis of the dataset. 'x'
for vertical bars and 'y'
for horizontal bars.
Order¶
The drawing order of dataset. Also affects order for stacking, tooltip and legend.
Default 0
PointStyle¶
Is style of the point enabled? Default 'circle'
SkipNull¶
If true, null or undefined values will not be used for spacing calculations when determining bar size.
Stack¶
The ID of the group to which this dataset belongs to (when stacked, each group will be a separate stack). Default 'bar'
XAxisID¶
The ID of the x-axis to plot this dataset on.
YAxisID¶
The ID of the y-axis to plot this dataset on.