BarData
Create a BarData
object.
obj = BarData (data)
returns a BarData
object, in
which data must be a nonempty numerical vector containing the bar
heights of a single dataset. Constructing a BarData
object always
assigns the default property values, which can later be modified using dot
notation syntax.
A BarData
object, obj, contains the following properties:
Field | Description | |
---|---|---|
backgroundColor | A Color object defining the
color of the face of the bars. Default is empty, in which case and a color
is assigned automatically by the Chart.js library. | |
base | A numeric scalar value. It defines the base
value for the bar in data units along the value axis (the y-axis by
default). | |
barPercentage | A numeric scalar value. It defines the
percent, in the range , of the available width each bar should be
within the category width. barPercentage = 1.0 will take the whole
category width and put the bars right next to each other. | |
barThickness | Either a numeric scalar or a character
vector. When numeric, it defines the width of each bar in pixels, in which
case barPercentage and categoryPercentage properties 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 the
barPercentage and categoryPercentage properties. There is no
gap when the percentage options are 1. This mode generates bars with
different widths when data are not evenly spaced. By default it is empty, in
which case the base sample widths are calculated using the smallest interval
that prevents bar overlapping, and bars are sized using barPercentage
and categoryPercentage properties. This mode always generates bars
equally sized. | |
borderColor | A Color object defining the color
of the border line of the bars. Default is empty, in which case a color is
assigned automatically by the Chart.js library. | |
borderSkipped | A boolean scalar or a character vector.
This setting is used to avoid drawing any given border of each bar. As a
boolean value, false does not skip any borders and true skips
drawing all borders. As a character vector, it can take any of the following
values: 'start' , 'end' , 'middle' , 'bottom' ,
'left' , 'top' , and 'right' . 'middle' is only
valid on stacked bars, in which case the borders between stacked bars are
skipped. | |
borderRadius | A numeric scalar value defining the
corner radius of the each bar in pixels. Omitted borders as defined by the
borderSkipped property are unaffected. | |
borderWidth | A numeric scalar value defining the width
of the each bar’s borders in pixels. Omitted borders as defined by the
borderSkipped property are unaffected. | |
categoryPercentage | A numeric scalar value, which defines the percent, in the range , of the available width each category should be within the sample width. | |
clip | A numeric scalar value defining the pixels to clip relative to the chart’s area. Positive value allows overflow, negative value clips that many pixels inside chartArea. Defaults to zero pixels. | |
data | A numeric vector assigned at construction of the
BarData object. It cannot be empty. | |
grouped | A boolean scalar defining how the bars are
grouped on the index axis (the x-axis by default). 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. | |
hoverBackgroundColor | A Color object defining
the color of the face of each bar, when the mouse hovers over it. Default is
empty, in which case the color is the same as in backgroundColor . | |
hoverBorderColor | A Color object defining
the color of the borders of each bar, when the mouse hovers over it. Default
is empty, in which case the color is the same as in borderColor . | |
hoverBorderWidth | A numeric scalar value defining the
width of the each bar’s borders in pixels, when the mouse hovers over it.
Omitted borders as defined by the borderSkipped property are
unaffected. | |
hoverBorderRadius | A numeric scalar value defining the
corner radius of the each bar in pixels, when the mouse hovers over it.
Omitted borders as defined by the borderSkipped property are
unaffected. | |
indexAxis | A character vector defining the base axis
of the dataset. 'x' defines a vertical bar chart (default) and
'y' defines a horizontal bar chart | |
inflateAmount | Either a numeric scalar or a character
vector. When numeric, it defines the amount to inflate the rectangulars used
to draw the bars. This is useful for hiding artifacts between bars when
. The default
value is 'auto' , which should work in most cases. | |
label | A character vector defining the label of the dataset which appears in the legend and tooltips. | |
maxBarThickness | A numeric scalar value defining the maximum thickness of the bars in pixels. | |
minBarLength | A numeric scalar value defining the minimum height of the bars in pixels. | |
order | A numeric scalar defining the order of the dataset, which affects order for stacking, tooltip and legend. | |
skipNull | A boolean scalar. If true or empty
(default), the null or undefined values in data will not be used for
spacing calculations when determining bar size. | |
stack | A character vector defining the ID of the group which this dataset belongs to (when stacked, each group will be a separate stack). |
See also: BarChart, Color, Fill
Source Code: BarData