Fill
chartjs: Fill
The filled area of a line or radar dataset.
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.
See also: LineChart, LineData, RadarChart, RadarData
Source Code: Fill
The Fill class contains the following properties:
The boundary the area is filled to, as given to the constructor: a
dataset index, a character vector such as 'origin' or
'-1', or a logical scalar. When toaxis is true, a
structure holding the value along the data axis in its field
value.
The color filling the area above the target, as Chart.js reads it, such
as 'red' or 'rgb(0, 0, 255)'. Empty when not set.
The color filling the area below the target, as Chart.js reads it, such
as 'red' or 'rgb(0, 0, 255)'. Empty when not set.
The Fill class offers the following public methods:
Fill: obj = Fill (value)
Fill: obj = Fill (value, toaxis)
Fill: obj = Fill (value, toaxis, above)
Fill: obj = Fill (value, toaxis, above, below)
| Mode | Values | |
|---|---|---|
| Absolute dataset index | A numeric scalar indexing another dataset as a boundary to constrain the created area. | |
| Relative dataset index | A 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. | |
| Boundary | A 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. | |
| Disabled | A boolean scalar value. When true, it
is equivalent to 'origin'. When true, the area is not
created. | |
| Shape | A character vector 'shape' which creates an
area inside the line by connecting its end points. | |
| Axis value | A 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.