Categories &

Functions List

Class Definition: BubbleData

chartjs: BubbleData

One dataset of a bubble chart.

A BubbleChart holds a BubbleData object for each of its datasets, whose properties set how Chart.js draws it.

Each property is documented on its own, as in help BubbleData.data.

See also: BubbleChart, Color, Fill

Source Code: BubbleData

The BubbleData class contains the following properties:

A Color object defining the color of the face of the bubbles. Default is empty, in which case and a color is assigned automatically by the Chart.js library.

A Color object defining the color of the border circle of the bubbles. Default is empty, in which case a color is assigned automatically by the Chart.js library.

A numeric scalar value defining the width of the bubble’s borders in pixels. Default is 3.

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.

A numeric matrix assigned at construction of the BubbleData object. It cannot be empty.

A boolean scalar defining whether to draw the active bubbles of a dataset over the other bubbles of the dataset. It is true by default.

A Color object defining the color of the bubble face, when the mouse hovers over it. Default is empty, in which case the color is the same as in backgroundColor.

A Color object defining the color of the borders of each bubble, when the mouse hovers over it. Empty by default, in which case the color is the same as in borderColor.

A numeric scalar value defining the width of the each bubble’s borders in pixels, when the mouse hovers over it. Default is 1.

A numeric scalar value defining the radius of the each bubble in pixels, when the mouse hovers over it. Default is 4.

A numeric scalar value defining the additional radius for hit detection in pixels. Default is 1.

A character vector defining the label of the dataset which appears in the legend and tooltips. A chart shows no legend when none of its datasets has a label, and names a dataset without one by its position, such as "Dataset 2", when another has one.

A numeric scalar defining the order of the dataset, which affects order for stacking, tooltip and legend.

A character vector or a boolean value defining the shape of the bubbles of the dataset. As a character vector, it can be any of the following values: 'circle', 'cross', 'crossRot', 'dash', 'line', 'rect', 'rectRounded', 'rectRot', 'star', 'triangle', and 'none'. By default it is 'circle. As a boolean value, true defaults to 'circle' and false defaults to 'none'.

A numeric scalar defining the bubble rotation in degrees.

A numeric scalar defining the bubble radius for the entire dataset.

The BubbleData class offers the following public methods:

BubbleData: obj = BubbleData (data)

obj = BubbleData (data) returns a BubbleData object, in which data must be an Nx3 numeric matrix with each column defining the x-axis, the y-axis, and the radius of each element of a single dataset, respectively. Constructing a BubbleData object always assigns the default property values, which can later be modified using dot notation syntax.

BubbleData: json = jsonstring (obj)

BubbleData: json = jsonstring (obj, mixed)

jsonstring (obj) returns a character vector, json, holding the dataset in JSON, as Chart.js reads it in the datasets of a chart.

jsonstring (obj, mixed) also writes the dataset’s chart type when mixed is true, as a chart mixing types needs.