Skip to content

Area and line

Compare one filled area series with one or more line series.

Chart ID: areaLine. Independent import: @revolist/charts/area-line.

Loading chart…

Start with a filled area and accompanying lines, then assign other supported layer styles per series. Layers share the category/time coordinates rather than arbitrary independent numeric X values.

Use one category per row and one or more numeric series. Values are finite numbers or explicit nulls; the row mapper does not group or aggregate repeated keys.

The roles below describe the chart's data contract. Generic category/value roles resolve from the dataset; explicitly bind specialized numeric roles as shown in the complete example.

Data roleField count
category1 or more
value1 or more
series2 or more

Download the complete sample data and settings (JSON). See Data & Configuration for mapping, null values, updates and lifecycle rules.

Install the package using the installation guide, give the host an explicit height, and call createAreaLineChart after the host mounts. This factory fixes the chart type to areaLine.

<div id="chart" style="width: 100%; height: 450px;"></div>
Complete runnable TypeScript example with sample data
import { createAreaLineChart } from '@revolist/charts/area-line';
const container = document.getElementById('chart')!;
const chart = await createAreaLineChart({
container,
"dataset": {
"revision": 0,
"source": "client",
"categories": [
{
"id": "preview-category-0",
"label": "Jan",
"path": [
"Jan"
],
"labels": [
"Jan"
],
"depth": 1,
"kind": "leaf"
},
{
"id": "preview-category-1",
"label": "Feb",
"path": [
"Feb"
],
"labels": [
"Feb"
],
"depth": 1,
"kind": "leaf"
},
{
"id": "preview-category-2",
"label": "Mar",
"path": [
"Mar"
],
"labels": [
"Mar"
],
"depth": 1,
"kind": "leaf"
},
{
"id": "preview-category-3",
"label": "Apr",
"path": [
"Apr"
],
"labels": [
"Apr"
],
"depth": 1,
"kind": "leaf"
}
],
"series": [
{
"id": "preview-series-0",
"label": "Actual",
"columnPath": [
"Actual"
],
"labels": [
"Actual"
],
"kind": "leaf",
"prop": "preview-0"
},
{
"id": "preview-series-1",
"label": "Target",
"columnPath": [
"Target"
],
"labels": [
"Target"
],
"kind": "leaf",
"prop": "preview-1"
},
{
"id": "preview-series-2",
"label": "Forecast",
"columnPath": [
"Forecast"
],
"labels": [
"Forecast"
],
"kind": "leaf",
"prop": "preview-2"
}
],
"values": [
[
32,
24,
28
],
[
51,
38,
42
],
[
43,
49,
46
],
[
68,
56,
61
]
],
"analyticalFrame": {
"fields": [
{
"id": "pivot:category",
"label": "pivot:category",
"role": "dimension",
"semanticType": "category"
},
{
"id": "pivot:series",
"label": "pivot:series",
"role": "dimension",
"semanticType": "category"
},
{
"id": "preview-series-0",
"label": "Actual",
"role": "measure",
"semanticType": "number",
"sourceField": "preview-0"
},
{
"id": "preview-series-1",
"label": "Target",
"role": "measure",
"semanticType": "number",
"sourceField": "preview-1"
},
{
"id": "preview-series-2",
"label": "Forecast",
"role": "measure",
"semanticType": "number",
"sourceField": "preview-2"
}
],
"observations": [
{
"id": "[\"preview-category-0\",\"preview-series-0\"]",
"dimensions": {
"pivot:category": {
"value": "Jan",
"label": "Jan",
"path": [
"Jan"
],
"labels": [
"Jan"
]
},
"pivot:series": {
"value": "Actual",
"label": "Actual",
"path": [
"Actual"
],
"labels": [
"Actual"
]
}
},
"measures": {
"preview-series-0": 32
}
},
{
"id": "[\"preview-category-0\",\"preview-series-1\"]",
"dimensions": {
"pivot:category": {
"value": "Jan",
"label": "Jan",
"path": [
"Jan"
],
"labels": [
"Jan"
]
},
"pivot:series": {
"value": "Target",
"label": "Target",
"path": [
"Target"
],
"labels": [
"Target"
]
}
},
"measures": {
"preview-series-1": 24
}
},
{
"id": "[\"preview-category-0\",\"preview-series-2\"]",
"dimensions": {
"pivot:category": {
"value": "Jan",
"label": "Jan",
"path": [
"Jan"
],
"labels": [
"Jan"
]
},
"pivot:series": {
"value": "Forecast",
"label": "Forecast",
"path": [
"Forecast"
],
"labels": [
"Forecast"
]
}
},
"measures": {
"preview-series-2": 28
}
},
{
"id": "[\"preview-category-1\",\"preview-series-0\"]",
"dimensions": {
"pivot:category": {
"value": "Feb",
"label": "Feb",
"path": [
"Feb"
],
"labels": [
"Feb"
]
},
"pivot:series": {
"value": "Actual",
"label": "Actual",
"path": [
"Actual"
],
"labels": [
"Actual"
]
}
},
"measures": {
"preview-series-0": 51
}
},
{
"id": "[\"preview-category-1\",\"preview-series-1\"]",
"dimensions": {
"pivot:category": {
"value": "Feb",
"label": "Feb",
"path": [
"Feb"
],
"labels": [
"Feb"
]
},
"pivot:series": {
"value": "Target",
"label": "Target",
"path": [
"Target"
],
"labels": [
"Target"
]
}
},
"measures": {
"preview-series-1": 38
}
},
{
"id": "[\"preview-category-1\",\"preview-series-2\"]",
"dimensions": {
"pivot:category": {
"value": "Feb",
"label": "Feb",
"path": [
"Feb"
],
"labels": [
"Feb"
]
},
"pivot:series": {
"value": "Forecast",
"label": "Forecast",
"path": [
"Forecast"
],
"labels": [
"Forecast"
]
}
},
"measures": {
"preview-series-2": 42
}
},
{
"id": "[\"preview-category-2\",\"preview-series-0\"]",
"dimensions": {
"pivot:category": {
"value": "Mar",
"label": "Mar",
"path": [
"Mar"
],
"labels": [
"Mar"
]
},
"pivot:series": {
"value": "Actual",
"label": "Actual",
"path": [
"Actual"
],
"labels": [
"Actual"
]
}
},
"measures": {
"preview-series-0": 43
}
},
{
"id": "[\"preview-category-2\",\"preview-series-1\"]",
"dimensions": {
"pivot:category": {
"value": "Mar",
"label": "Mar",
"path": [
"Mar"
],
"labels": [
"Mar"
]
},
"pivot:series": {
"value": "Target",
"label": "Target",
"path": [
"Target"
],
"labels": [
"Target"
]
}
},
"measures": {
"preview-series-1": 49
}
},
{
"id": "[\"preview-category-2\",\"preview-series-2\"]",
"dimensions": {
"pivot:category": {
"value": "Mar",
"label": "Mar",
"path": [
"Mar"
],
"labels": [
"Mar"
]
},
"pivot:series": {
"value": "Forecast",
"label": "Forecast",
"path": [
"Forecast"
],
"labels": [
"Forecast"
]
}
},
"measures": {
"preview-series-2": 46
}
},
{
"id": "[\"preview-category-3\",\"preview-series-0\"]",
"dimensions": {
"pivot:category": {
"value": "Apr",
"label": "Apr",
"path": [
"Apr"
],
"labels": [
"Apr"
]
},
"pivot:series": {
"value": "Actual",
"label": "Actual",
"path": [
"Actual"
],
"labels": [
"Actual"
]
}
},
"measures": {
"preview-series-0": 68
}
},
{
"id": "[\"preview-category-3\",\"preview-series-1\"]",
"dimensions": {
"pivot:category": {
"value": "Apr",
"label": "Apr",
"path": [
"Apr"
],
"labels": [
"Apr"
]
},
"pivot:series": {
"value": "Target",
"label": "Target",
"path": [
"Target"
],
"labels": [
"Target"
]
}
},
"measures": {
"preview-series-1": 56
}
},
{
"id": "[\"preview-category-3\",\"preview-series-2\"]",
"dimensions": {
"pivot:category": {
"value": "Apr",
"label": "Apr",
"path": [
"Apr"
],
"labels": [
"Apr"
]
},
"pivot:series": {
"value": "Forecast",
"label": "Forecast",
"path": [
"Forecast"
],
"labels": [
"Forecast"
]
}
},
"measures": {
"preview-series-2": 61
}
}
],
"matrixCells": [
{
"categoryId": "preview-category-0",
"seriesId": "preview-series-0",
"observationId": "[\"preview-category-0\",\"preview-series-0\"]",
"measureFieldId": "preview-series-0"
},
{
"categoryId": "preview-category-0",
"seriesId": "preview-series-1",
"observationId": "[\"preview-category-0\",\"preview-series-1\"]",
"measureFieldId": "preview-series-1"
},
{
"categoryId": "preview-category-0",
"seriesId": "preview-series-2",
"observationId": "[\"preview-category-0\",\"preview-series-2\"]",
"measureFieldId": "preview-series-2"
},
{
"categoryId": "preview-category-1",
"seriesId": "preview-series-0",
"observationId": "[\"preview-category-1\",\"preview-series-0\"]",
"measureFieldId": "preview-series-0"
},
{
"categoryId": "preview-category-1",
"seriesId": "preview-series-1",
"observationId": "[\"preview-category-1\",\"preview-series-1\"]",
"measureFieldId": "preview-series-1"
},
{
"categoryId": "preview-category-1",
"seriesId": "preview-series-2",
"observationId": "[\"preview-category-1\",\"preview-series-2\"]",
"measureFieldId": "preview-series-2"
},
{
"categoryId": "preview-category-2",
"seriesId": "preview-series-0",
"observationId": "[\"preview-category-2\",\"preview-series-0\"]",
"measureFieldId": "preview-series-0"
},
{
"categoryId": "preview-category-2",
"seriesId": "preview-series-1",
"observationId": "[\"preview-category-2\",\"preview-series-1\"]",
"measureFieldId": "preview-series-1"
},
{
"categoryId": "preview-category-2",
"seriesId": "preview-series-2",
"observationId": "[\"preview-category-2\",\"preview-series-2\"]",
"measureFieldId": "preview-series-2"
},
{
"categoryId": "preview-category-3",
"seriesId": "preview-series-0",
"observationId": "[\"preview-category-3\",\"preview-series-0\"]",
"measureFieldId": "preview-series-0"
},
{
"categoryId": "preview-category-3",
"seriesId": "preview-series-1",
"observationId": "[\"preview-category-3\",\"preview-series-1\"]",
"measureFieldId": "preview-series-1"
},
{
"categoryId": "preview-category-3",
"seriesId": "preview-series-2",
"observationId": "[\"preview-category-3\",\"preview-series-2\"]",
"measureFieldId": "preview-series-2"
}
]
}
},
"bindings": {},
"presentation": {
"dataLabels": false
}
});
// When the host unmounts:
// chart.destroy();

Await updates before reading a snapshot or exporting. Call chart.destroy() when the host unmounts. See the live catalog to interact with this type.

Set these fields in chartOptions. The option schema validates supported keys, ranges and choices; updating chartOptions replaces that authored object.

OptionDefaultAccepted values
showGridLinestruetrue or false
markOpacity10.2 to 1; step 0.05
strokeWidth21 to 6; step 0.5
fillOpacity0.340.1 to 0.9; step 0.01

Titles, legends, theme and labels belong to presentation or the corresponding top-level setting. Axis, color, navigation and interaction support depends on the selected chart; see Data & Configuration.

  • Column and line — Compare one column series with one or more line series.

Charts overview · Installation · Data & Configuration