AG Studio Launch Week 🚀🚀🚀 28 Sep - 2 Oct 2026 🚀🚀🚀 Join now

JavaScript ChartsLine Series

Version 14.2.0

A Line Series visualises continuous data, and is typically used to see trends or fluctuations over time.

Simple Line Copy Link

To create a Line Series, use the line series type. If no type is provided, a Line Series will be created by default.

{
    series: [
        { type: 'line', xKey: 'quarter', yKey: 'petrol', yName: 'Petrol' },
        { type: 'line', xKey: 'quarter', yKey: 'diesel', yName: 'Diesel' },
    ],
}

In this configuration:

Customisation Copy Link

It is possible to customise the appearance of the line, labels and markers for each series.

Note that the Legend automatically reflects the customisation of the series and markers.

Labels Copy Link

Labels can be displayed above each data point. Use the label option to enable and style the labels.

{
    series: [
        {
            // ...
            label: {
                enabled: true,
                fontWeight: 'bold',
            },
        },
    ],
}

Please see the API Reference for a list of all available label options.

Markers Copy Link

Markers are displayed by default in the Line Series. Use the marker option to style or disable the markers.

{
    series: [
        {
            // ...
            marker: {
                fill: 'orange',
                size: 10,
                stroke: 'black',
                strokeWidth: 3,
                shape: 'diamond',
            },
        },
    ],
}

Please see the Series Markers page for more information or the API Reference for a list of all available marker options.

Interpolation Copy Link

A straight line is used to connect points by default in the Line Series. Use the interpolation option to change the line style.

{
    series: [
        {
            // ...
            interpolation: {
                type: 'smooth',
            },
        },
    ],
}

Please see the API Reference for a list of all available interpolation options.

Data Copy Link

Missing Data Copy Link

  • Data points with a yKey value of positive or negative Infinity, null, undefined or NaN will be rendered as a gap in the line. Set connectMissingData: true to draw a connecting line between points either side of a missing point.
  • Data points with invalid xKey values will be ignored.

Continuous Data Copy Link

By default, the Line series uses a Category Axis to plot the xKey values, but this can be changed if you have continuous data, such as trends over time.

  • Time can be provided as a Date object, a number which is interpreted as timestamps derived from Unix time or an ISO 8601 string.
  • See Time Axes for more information about the different time axes available.
  • All time axes automatically select an appropriate label format depending on the time span of the data, making a best-effort attempt to prevent the labels from overlapping.

See Axes Types for more information on using a Time Axis or a Number Axis.

Line Chart Examples Copy Link

See more Line Chart examples in the AG Charts Gallery.

API Reference Copy Link

Properties available on the AgLineSeriesOptions interface.

type required 'line'
Configuration for the Line Series.
xKey required DatumKey
The key to use to retrieve x-values from the data.
yKey required DatumKey
The key to use to retrieve y-values from the data.
errorBar AgErrorBarOptions
Configuration for the Error Bars.
normalizedTo number
The number to normalise the line stacks to. For example, if `normalizedTo` is set to `100`, the stacks will all be scaled proportionally so that their total height is always 100.
stacked boolean
An option indicating if the lines should be stacked.
stackGroup string
An ID to be used to group stacked items.
id string default: auto-generated value
Primary identifier for the series. This is provided as `seriesId` in user callbacks to differentiate multiple series. Auto-generated ids are subject to future change without warning, if your callbacks need to vary behaviour by series please supply your own unique `id` value.
context ContextDefault
Context object to use in callbacks.
data DatumDefault[]
The data to use when rendering the series. If this is not supplied, data must be set on the chart instead.
visible boolean
Whether to display the series.
cursor string
The cursor to use for hovered markers. This config is identical to the CSS `cursor` property.
selection AgSelectionOptions
Configuration for data selection.
nodeClickRange InteractionRange
Range from a node that a click triggers the listener.
showInLegend boolean
Whether to include the series in the legend.
listeners AgSeriesListeners
A map of event names to event listeners.
xKeyAxis string default: 'x'
The key of the x-axis to which this series is bound.
yKeyAxis string default: 'y'
The key of the y-axis to which this series is bound.
xName string
A human-readable description of the x-values. If supplied, this will be shown in the default tooltip and passed to the tooltip renderer as one of the parameters.
yName string
A human-readable description of the y-values. If supplied, this will be shown in the default tooltip and passed to the tooltip renderer as one of the parameters.
legendItemName string
Human-readable description of the y-values. If supplied, matching items with the same value will be toggled together.
styler Styler
Function used to return formatting for entire series, based on the given parameters.
marker AgSeriesMarkerOptions
Configuration for the markers used in the series.
interpolation AgInterpolationType
Configuration for the line used in the series.
title string
The title to use for the series. Defaults to `yName` if it exists, or `yKey` if not.
label AgLineSeriesLabelOptions
Configuration for the labels shown on top of data points.
tooltip AgSeriesTooltip
Series-specific tooltip configuration.
connectMissingData boolean
Set to `true` to connect across missing data points.
highlight AgMultiSeriesHighlightOptions
Configuration for highlighting when a series or legend item is hovered over.
segmentation AgSeriesSegmentation
Configuration for styling series as separate segments.
stroke AgCssColorOrRef
The colour for the stroke.
strokeWidth PixelSize
The width of the stroke in pixels.
strokeOpacity Opacity
The opacity of the stroke colour.
lineDash PixelSize[]
An array specifying the length in pixels of alternating dashes and gaps.
lineDashOffset PixelSize
The initial offset of the dashed line in pixels.
showInMiniChart boolean
Whether to include the series in the Mini Chart.