Line Chart
<LineChart
data={query_name}
x=column_x
y=column_y
/>
Examples
Line
<LineChart
data={daily_complaints}
x=date
y=number_of_complaints
yAxisTitle="calls to Austin 311 per day"
/>
Multi-Series Line
<LineChart
data={daily_volume_yoy}
x=day_of_year
y=cum_vol
series=year
yAxisTitle="cumulative calls"
xAxisTitle="day of year"
/>
Multi-Series Line with Steps
<LineChart
data={simpler_bar}
x=year
y=value
series=country
step=true
/>
Multiple y Columns
<LineChart
data={fda_recalls}
x=year
y={["voluntary_recalls", "fda_recalls"]}
/>
Because x is the first column in the dataset and we want to plot all the remaining numerical columns in the table, we can simplify our code down to:
<LineChart data={fda_recalls}/>
Evidence will automatically pick the first column as x
and use all other numerical columns for y
.
Secondary y Axis
<LineChart
data={orders_by_month}
x=month
y=sales_usd0k
y2=num_orders_num0
/>
Secondary Axis with Bar
<LineChart
data={orders_by_month}
x=month
y=sales_usd0k
y2=num_orders_num0
y2SeriesType=bar
/>
Value Labels
<LineChart
data={orders_by_month}
x=month
y=sales
yAxisTitle="Sales per Month"
yFmt=eur0k
labels=true
/>
Custom Color Palette
<LineChart
data={simpler_bar}
x=year
y=value
series=country
colorPalette={
[
'#cf0d06',
'#eb5752',
'#e88a87',
'#fcdad9',
]
}
/>
Options
Data
Query name, wrapped in curly braces
- Options:
- query name
Column to use for the x-axis of the chart
- Options:
- column name
Column(s) to use for the y-axis of the chart
- Options:
- column name | array of column names
Column(s) to include on a secondary y-axis
- Options:
- column name | array of column names
Column to use as the series (groups) in a multi-series chart
- Options:
- column name
Sets behaviour for empty datasets. Can throw an error, a warning, or allow empty. When set to 'error', empty datasets will block builds in build:strict
. Note this only applies to initial page load - empty datasets caused by input component changes (dropdowns, etc.) are allowed.
- Default:
- error
Text to display when an empty dataset is received - only applies when emptySet
is 'warn' or 'pass', or when the empty dataset is a result of an input component change (dropdowns, etc.).
- Options:
- string
Formatting & Styling
Format to use for x column
- Options:
- Excel-style format | built-in format name | custom format name
Format to use for y column(s)
- Options:
- Excel-style format | built-in format name | custom format name
Format to use for y2 column(s)
- Options:
- Excel-style format | built-in format name | custom format name
Color to override default series color. Only accepts a single color
- Options:
- CSS name | hexademical | RGB | HSL
% of the full color that should be rendered, with remainder being transparent
- Options:
- number (0 to 1)
- Default:
- 1
Thickness of line (in pixels)
- Options:
- number
- Default:
- 2
Size of each shape (in pixels)
- Options:
- number
- Default:
- 8
Array of custom colours to use for the chart. E.g., {['#cf0d06','#eb5752','#e88a87']}
- Options:
- array of color strings (CSS name | hexademical | RGB | HSL)
Apply a specific color to each series in your chart. Unspecified series will receive colors from the built-in palette as normal. Note the double curly braces required in the syntax seriesColors={{"Canada": "red", "US": "blue"}}
- Options:
- object with series names and assigned colors
Font size of value labels
- Options:
- number
- Default:
- 11
Font color of value labels
- Options:
- CSS name | hexademical | RGB | HSL
Format to use for value labels
- Options:
- Excel-style format | built-in format name | custom format name
Format to use for value labels for series on the y axis. Overrides any other formats
- Options:
- Excel-style format | built-in format name | custom format name
Format to use for value labels for series on the y2 axis. Overrides any other formats
- Options:
- Excel-style format | built-in format name | custom format name
Axes
Base to use when log scale is enabled
- Options:
- number
- Default:
- 10
Starting value for the y-axis
- Options:
- number
Maximum value for the y-axis
- Options:
- number
Starting value for the y2-axis
- Options:
- number
Maximum value for the y2-axis
- Options:
- number
Chart
Chart title. Appears at top left of chart.
- Options:
- string
Chart subtitle. Appears just under title.
- Options:
- string
Minimum height of the chart area (excl. header and footer) in pixels. Adjusting the height affects all viewport sizes and may impact the mobile UX.
- Options:
- number
- Default:
- 180
Which chart renderer type (canvas or SVG) to use. See ECharts' documentation on renderers.
- Default:
- canvas
Custom Echarts Options
Custom Echarts options to override the default options. See reference page for available options.
- Options:
- {{exampleOption:'exampleValue'}}
Custom Echarts options to override the default options for all series in the chart. This loops through the series to apply the settings rather than having to specify every series manually using echartsOptions
. See reference page for available options.
- Options:
- {{exampleSeriesOption:'exampleValue'}}
Interactivity
Group name to connect this chart to other charts for synchronized tooltip hovering. Charts with the same connectGroup
name will become connected
Annotations
Line charts can include annotations using the ReferenceLine
and ReferenceArea
components. These components are used within a chart component like so:
<LineChart data="{sales_data}" x="date" y="sales">
<ReferenceLine data="{target_data}" y="target" label="name" />
<ReferenceArea xMin="2020-03-14" xMax="2020-05-01" />
</LineChart>