Trend / average / statistic lines
native
Auto mean, median or regression lines
Matrix status native. Verification types · strong. ChartKit option: ChartKitChartSpecV1.annotations.
Mean, median, or linear, each with a label.
Source: chartkit:packages/core/src/annotations.ts:19
ChartKit spec
Passed validate() during npm run matrix:refresh. The SVG is the server render.
{
"version": "1",
"type": "line",
"data": [
{
"quarter": "Q1",
"units": 40
},
{
"quarter": "Q2",
"units": 55
}
],
"encoding": {
"x": "quarter",
"y": "units"
},
"a11y": {
"alt": "Units rose in Q2."
},
"size": {
"width": 640,
"height": 260
},
"annotations": [
{
"type": "trendline",
"method": "mean",
"label": "Mean"
}
]
}Other libraries
Option names are the paths recorded in the matrix. A grep-only cell names the identifier that matched, not a render test. Markdown copy: annotation.trendline.md.
| Library | Status | Option | Verification | Source |
|---|---|---|---|---|
| Chart.js | plugin | —(manual value) | npm · weak | — |
| Recharts | partial | Scatter.lineType=fitting | types · strong | recharts/types/cartesian/Scatter.d.ts:126 |
| Apache ECharts | native | series.markLinetype: 'average' | 'min' | 'max' | 'median' | types · strong | echarts/types/dist/shared.d.ts:12499 |
| Highcharts | native | series.type=trendline | types · strong | highcharts/options/abands.d.ts:1386 |
| Plotly.js | none | — | absence · absence | — |
| Nivo | unknown | — | conflict · unknown | — |
| Victory | unknown | — | conflict · unknown | — |
| visx | none | — | absence · absence | — |
| ApexCharts | none | — | absence · absence | — |
| Tremor (npm) | none | — | absence · absence | — |
| Observable Plot | native | linearRegressionYruleY(data, groupZ({y:'mean'})) | types · strong | @observablehq/plot/src/marks/linearRegression.d.ts:111 |
| Vega-Lite | native | grep: regression | grep · weak | 5: "Aggregate" |
| AG Charts | unknown | — | conflict · unknown | — |
| amCharts 5 | native | AverageSeries, RegressionSeries | types · strong | @amcharts/amcharts5/.internal/charts/stock/drawing/AverageSeries.d.ts:8 |
| Google Charts | native | grep: trendlines | grep · weak | @types/google.visualization/index.d.ts:614 |
| uPlot | none | — | absence · absence | — |
| TradingView Lightweight Charts | none | — | absence · absence | — |
| MUI X Charts | none | — | absence · absence | — |
| Mermaid (chart-ish diagrams only) | none | — | absence · absence | — |
| AntV G2 | native | grep: mean | grep · weak | @antv/g2/lib/spec/transform.d.ts:26 |