Categories &

Functions List

Class Definition: Fill

chartjs: obj = Fill (value)
chartjs: obj = Fill (value, toaxis)
chartjs: obj = Fill (value, toaxis, above)
chartjs: obj = Fill (value, toaxis, above, below)

A class for creating Chart.js compatible Fill objects.

Both LineChart and RadarChart objects support a fill option on their respective dataset object which can be used to create space between two datasets or a dataset and a boundary. The created space can be filled with a Color object, essentially transforming line and radar charts into an area chart.

obj = Fill (value) returns a Fill object defined by value, which can either be a character vector or a numeric scalar. The following filling modes are supported.

ModeValues
Absolute dataset indexA numeric scalar indexing another dataset as a boundary to constrain the created area.
Relative dataset indexA character vector of the form '-1', '-2', '+1', … indexing another dataset as a boundary to constrain the created area relative to the position of the referencing dataset.
BoundaryA character vector with acceptable values 'start', 'end', and 'origin' which sets the boundary of the created area to the start, the end, or the origin of the data axis, respectively.
DisabledA boolean scalar value. When true, it is equivalent to 'origin'. When true, the area is not created.
ShapeA character vector 'shape' which creates an area inside the line by connecting its end points.
Axis valueA numeric scalar, which references a value on the data axis to be used as a boundary. To use this option, the second input argument toaxis must be set to true.

obj = Fill (value, toaxis) returns a Fill object using the previously described syntaxes, while toaxis defines whether the numeric value assigned to value references an absolute dataset index (default: toaxis = false) or a value along the data axis (toaxis = true which sets a line to be used as a boundary. When toaxis is set to true, value must be a numeric scalar. Passing an empty matrix to toaxis, results to the default value (toaxis = false).

obj = Fill (value, toaxis, above) returns a Fill object with an area created according to any of the previous syntaxes, which is filled with the color defined in above. above can be a Color object defining a single color. Alternatively, the input value to the Color object can be passed directly to the above input argument.

obj = Fill (value, toaxis, above, below) returns a Fill object with an area created according to any of the previous syntaxes, and the area below the target value (as defined by the value and toaxis arguments) is filled with the color defined in below. Similarly to above, below can be a Color object defining a single color. Alternatively, the input value to the Color object can be passed directly to the below input argument.

See also: LineChart, LineData, RadarChart, RadarData

Source Code: Fill

Method: jsonstring

Fill: json = jsonstring (obj)

Generate the JSON string of a Fill object.

jsonstring (obj) returns a character vector, json, describing the context of the Color object in json format.

See also: Color, Fill