Categories &

Functions List

Class Definition: LineData

chartjs: obj = LineData (data)

Create a LineData object.

obj = LineData (data) returns a LineData object, in which data must be a nonempty numerical vector containing the data points of a single dataset to be plotted on a line. Constructing a LineData object always assigns the default property values, which can later be modified using dot notation syntax.

A LineData object, obj, contains the following properties:

FieldDescription
backgroundColorA Color object defining the fill color of the lines between data points. Default is empty, in which case a color is assigned automatically by the Chart.js library.
borderCapStyleA character vector, which can be either 'butt' (default), 'round', or 'square'. When 'butt', the ends of lines are squared off at the endpoints. When 'round', the ends of lines are rounded. When 'square' is set, the ends of lines are squared off by adding a box with an equal width and half the height of the line’s thickness.
borderColorA Color object defining the color of the lines between data points. Default is empty, in which case a color is assigned automatically by the Chart.js library.
borderDashA numeric vector defining the length and spacing of dashes drawn instead of a line.
borderDashOffsetA numeric scalar defining the offset of dashes and spacing drawn instead of a line. Default is 0.
borderJoinStyleA character vector defining the line border join style. It can be either 'round', 'bevel', or 'miter'.
borderWidthA numeric scalar value defining the width of the line in pixels. Default is 3.
clipA 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.
cubicInterpolationModeA character vector defining the cubic interpolation mode. It can be either 'default' or 'monotonic'.
dataA numeric vector assigned at construction of the LineData object. It cannot be empty.
drawActiveElementsOnTopA boolean scalar defining whether to draw the active points of a dataset over the other points of the dataset. It is true by default.
fillA Fill object defining how to fill the area under the line. Type help Fill for more details on the available filling modes. By default, no filling is applied.
hoverBackgroundColorA Color object defining the fill color of the lines between data points, when the mouse hovers over it. Default is empty, in which case the color is the same as in backgroundColor.
hoverBorderCapStyleA character vector, which can be either 'butt', 'round', or 'square', defining the cap style of the line when the mouse hovers over it. Default is empty, in which case the cap style is the same as in borderCapStyle.
hoverBorderColorA Color object defining the color of the lines between data points, when the mouse hovers over it. Default is empty, in which case the color is the same as in borderColor.
hoverBorderDashA numeric vector defining the length and spacing of dashes drawn instead of a line, when the mouse hovers over them. Default is empty, in which case the length and spacing of the dashes are the same as in borderDash.
hoverborderDashOffsetA numeric scalar defining the offset of dashes drawn instead of a line, when the mouse hovers over them. Default is empty, in which case the offset is the same as in borderDashOffset
hoverBorderJoinStyleA character vector defining the line border join style, when the mouse hovers over it. Default is empty, in which case the line border join style is the same as in borderJoinStyle
hoverBorderWidthA numeric scalar value defining the width of the line in pixels, when the mouse hovers over it. Default is empty, in which case the width is the same as in borderWidth.
indexAxisA character scalar defining the base axis of the dataset. It can be either 'x' for horizontal lines or 'y' for horizontal lines. Default is 'x'.
labelsA character vector defining the label for the dataset which appears in the legend and tooltips. Default is empty.
orderA numeric scalar defining the drawing order of the dataset. It also affects order for stacking, tooltip and legend. Default is 0.
pointBackgroundColorA Color object defining the fill color for the data points. Default is empty, in which case a color is assigned automatically by the Chart.js library.
pointBorderColorA Color object defining the border color for the data points. Default is empty, in which case a color is assigned automatically by the Chart.js library.
pointBorderWidthA numeric scalar value defining the width of the data point border in pixels. Default is 1.
pointHitRadiusA numeric scalar value defining the pixel size of the non-displayed point that reacts to mouse events. Default is 1.
pointHoverBackgroundColorA Color object defining the fill color for the data points, when the mouse hovers over them. Default is empty, in which case the fill color is the same as in pointBackgroundColor.
pointHoverBorderColorA Color object defining the border color for the data point, when the mouse hovers over it. Default is empty, in which case the border color is the same as in pointBorderColor.
pointHoverBorderWidthA numeric scalar value defining the width of the data point border in pixels, when the mouse hovers over it. Default is 1.
pointHoverRadiusA numeric scalar value defining the radius of the data point border in pixels, when the mouse hovers over it. Default is 4.
pointRadiusA numeric scalar value defining the radius of the data point border in pixels. Default is 3.
pointRotationA numeric scalar value defining the rotation of the data point border in degrees. Default is 0.
pointStyleA character vector or a boolean value defining the shape of the points 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'.
showLineA boolean scalar defining whether to draw the line for this dataset. It is true by default.
spanGapsA boolean scalar or a numeric scalar defining whether to create a break in the line for null data. When true, lines will be drawn between points with no or null data. When false, points with null data will create a break in the line. It can also be a number specifying the maximum gap length to span. The unit of the value depends on the scale used.
stackA character vector defining the ID of the group to which the dataset belongs to.
steppedA character vector or a boolean value defining the interpolation mode between data points. As a character vector, it can be any of the following values: 'before' for step-before interpolation, 'after' for step-after interpolation, and 'middle' for step-middle interpolation. As a boolean value, true equals to 'before' and false, which is the default value, corresponds to no step interpolation. If stepped value is set to anything other than false, tension will be ignored.
tensionA numeric scalar value defining the Bezier curve tension of the line. By default it is 0, which corresponds to drawing straight lines between data points. This option is ignored if monotone cubic interpolation is used.

See also: LineChart, Color, Fill

Source Code: LineData