Skip to main content
Version: 4.2

Datasets

The datasets options are managing the set options which will affect the datasets management.

The datasets configuration is passed using the Datasets object in the chart options and mapped to TypedDataset.

To get, change and apply own properties, you can invoke the set and get methods, as following:

// sets and gets showLine option to line datasets 
chart.getOptions().getDatasets().get(ChartType.LINE).setShowLine(true);

boolean showLine = chart.getOptions().getDatasets().get(ChartType.LINE).isShowLine();

The following are the attributes that you can set:

NameTypeDescription
animationAnimationSee animation configuration section for more details.
animationsAnimationsSee animation configuration section for more details.
barPercentagedoublePercent (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.
categoryPercentagedoublePercent (0-1) of the available width each category should be within the sample width.
barThicknessintManually set width of each bar in pixels.
If set to DefaultDatasets.FLEX_BAR_THICKNESS, it computes "optimal" sample widths that globally arrange bars side by side.
If not set (default), bars are equally sized based on the smallest interval.
groupedbooleanShould 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.
maxBarThicknessintSet this to ensure that bars are not sized thicker than this.
minBarLengthintSet this to ensure that bars have a minimum length in pixels.
showLinebooleanIf true, the line is drawn for dataset.
transitionsTransitionsSee animation configuration section for more details.