ChartsLine Chart

LineChart

A line chart or line plot or line graph is a type of chart which displays information as a series of data points connected by straight line segments.

GitHub LogoSource Code

Usage

This example shows a simple line chart with one data series.
Each dot represents a data point, and a tooltip appears on hover.

Set horizontalRangeSlider.show to true to display a range slider below the chart for zooming into specific data ranges.

Area

To fill the area below the line, set the area prop to true.

Mixed line and area

Set the area prop to true to fill the area below the line.
You can also enable it for a specific measure to combine area and line views in the same chart.

Stacked area chart

The following example shows how to use the stacked prop to stack multiple lines on top of each other.

Mixed line and stacked area

You can mix a stacked area chart with a line chart by setting the stack and area props on the specific measures you want to stack.

Multiple lines

You can display multiple lines on the same chart by providing an array of measures to the measures prop.

Multiple lines with splitBy

The following example uses splitBy to divide the data by Country and Medal, generating a line for each combination. Try removing or changing the splitBy criteria in the live editor to see how it affects the chart.

Multiple Y axes

Custom ECharts options

You can customize the chart using ECharts options.

In this example:

  • The line is rendered as a smooth curve
  • A markLine is added to show the average
  • Line and dot colors change based on data point values