Line Chart
A line chart is a way of plotting data points on a line. Often, it is used to show trend data, or the comparison of two data sets.
Common Dataset Options¶
These options are common to all datasets.
BackgroundColor¶
The line fill color.
BorderColor¶
The line color.
BorderWidth¶
The line width (in pixels).
Clip¶
How to clip relative to chartArea. Positive value allows overflow, negative value clips that many pixels inside chartArea. 0 = clip at chartArea.
Is clip enabled? Clipping can also be configured per side: clip: {left: 5, top: false, right: -2, bottom: 0}Hidden¶
Configure the visibility of the dataset. Using hidden: true will hide the dataset from being rendered in the Chart.
HoverBackgroundColor¶
Background color when hovered.
HoverBorderColor¶
Border color when hovered.
HoverBorderWidth¶
The line width (in pixels) when hovered.
Label¶
The label for the dataset which appears in the legend and tooltips.
Parsing¶
How to parse the dataset. The parsing can be disabled by specifying parsing: false at chart options or dataset. If parsing is disabled, data must be sorted and in the formats the associated chart type and scales use internally.
Parsing with key. Parsing with x and y axis keys.Point Dataset Options¶
BorderCapStyle¶
Cap style of the line. Default 'butt'
BorderDash¶
BorderDashOffset¶
Offset for line dashes. Default 0.0
BorderJoinStyle¶
Line joint style. Default 'miter'
HoverBorderCapStyle¶
Border cap style when hovered.
HoverBorderDash¶
Length and spacing of dashes when hovered.
HoverBorderDashOffset¶
Offset for line dashes when hovered.
HoverBorderJoinStyle¶
Line joint style when hovered.
Fill¶
Is enabled? Default false
Order¶
The drawing order of dataset. Also affects order for stacking, tooltip and legend.
PointBackgroundColor¶
The fill color for points.
PointBorderColor¶
The border color for points.
PointBorderWidth¶
The width of the point border in pixels. Default 1
PointHitRadius¶
The pixel size of the non-displayed point that reacts to mouse events. Default 1
PointHoverBackgroundColor¶
Point background color when hovered.
PointHoverBorderColor¶
Point border color when hovered.
PointHoverBorderWidth¶
Border width of point when hovered. Default 1
PointHoverRadius¶
The radius of the point when hovered. Default 4
PointRadius¶
The radius of the point shape. If set to 0, the point is not rendered. Default 3
PointRotation¶
The rotation of the point in degrees. Default 0
PointStyle¶
Is style of the point enabled?
Style of the point. Default'circle'
SpanGaps¶
If true
, lines will be drawn between points with no or null data. If false
, points with null data will create a break in the line.
Can also be a number specifying the maximum gap length to span. The unit of the value depends on the scale used.
Tension¶
Bezier curve tension of the line. Set to 0
to draw straightlines. This option is ignored if monotone cubic interpolation is used.
Line Dataset Options¶
CubicInterpolationMode¶
The following interpolation modes are supported, 'default'
and 'monotone'
.
Data¶
Sets the data for the Dataset.
DrawActiveElementsOnTop¶
Draw the active points of a dataset over the other points of the dataset. Default true
IndexAxis¶
The base axis of the dataset. 'x'
for horizontal lines and 'y'
for vertical lines. Default 'x'
Segment¶
Line segment styles can be overridden by scriptable options in the segment object. To get the segment object from a function, set a funtion name.
function segmentStyleFunction(ctx) {
return {
borderColor: ctx => skipped(ctx, 'rgb(0,0,0,0.2)') || down(ctx, 'rgb(192,75,75)'),
borderDash: ctx => skipped(ctx, [6, 6]),
};
}
ShowLine¶
If false
, the line is not drawn for this dataset. Default true
Stack¶
The ID of the group to which this dataset belongs to (when stacked, each group will be a separate stack). Default 'line'
Stepped¶
If the stepped value is set to anything other than false
, 'tension'
will be ignored.
XAxisID¶
The ID of the x-axis to plot this dataset on.
YAxisID¶
The ID of the y-axis to plot this dataset on.