A Range Area Series represents data ranges using a shaded area between high and low data values. This series type is often used to show variations or trends in data over a specified time.
Simple Range Area Copy Link
The Range Area Series is created using the range-area series type.
{
series: [
{
type: 'range-area',
xKey: 'date',
yLowKey: 'flatsAndMaisonettes',
yHighKey: 'detachedHouses',
},
],
}
The yLowKey and yHighKey are used to retrieve the range of values for the Y axis.
Multiple Range Area Series Copy Link
Multiple Range Area Series can be combined into a single chart.
{
series: [
{
type: 'range-area',
xKey: 'date',
yLowKey: 'flatsAndMaisonettes',
yHighKey: 'terracedHouses',
xName: 'Date',
yName: 'Flats & Terraced',
yLowName: 'Flats & Maisonettes',
yHighName: 'Terraced',
},
{
type: 'range-area',
xKey: 'date',
yLowKey: 'semiDetachedHouses',
yHighKey: 'detachedHouses',
xName: 'Date',
yName: 'Semi-detached & Detached',
yLowName: 'Semi-detached',
yHighName: 'Detached',
},
],
}
In this configuration:
yNameis used to control the text displayed in the legend.yLowName,yHighNameandxNameare used to control the text displayed in the tooltip.
Missing Data Copy Link
The series handles missing or invalid data based on the presence or validity of xKey, yLowKey and yHighKey values in the data object.
- Data points with a
yLowKeyoryHighKeyvalue of positive or negativeInfinity,null,undefinedorNaNwill be rendered as a gap in the range. - Set
connectMissingData: trueto draw a connecting area between points either side of a missing section. - Data points with invalid
xKeyvalues will be ignored.
Customisation Copy Link
Series markers and labels can be enabled using the marker and label options.
{
series: [
{
// ...
marker: {
size: 7,
},
label: {
padding: 17,
formatter: ({ itemId, value }) => {
return `${itemId === 'low' ? 'L' : 'H'}: ${value.toFixed(0)}`;
},
},
},
],
}
In this configuration:
- Markers have been enabled using the
markeroptions object. - The
yHighKeyandyLowKeyvalues for each data point are presented as labels via thelabeloptions. - The
label.formatterfunction uses theitemIdfrom the params object to distinguish whether the label is aloworhighvalue.
Inverted Style Copy Link
The invertedStyle property allows specifying a fill for areas where the yHighKey line is below the yLowKey line.
{
series: [
{
type: 'range-area',
xKey: 'quarter',
yLowKey: 'projected',
yHighKey: 'actual',
invertedStyle: {
fill: 'red',
},
},
],
}
In this configuration:
- The series
fillof blue is used wherehigh > low. - The
invertedStyle.fillof red is used wherehigh < low. - The
invertedStyleobject supportsfillandfillOpacity.
High and Low Styling Copy Link
By default, the Line and Marker styling options are applied to both the high and low values of the data.
Use the item.high and item.low properties to apply specific overrides.
{
series: [
{
// ...
// Shared high/low styling options:
strokeWidth: 2,
marker: {
size: 12,
fill: '#cccccc',
itemStyler: (params) => {
// Highlight datum styling options:
if (params.highlightState === 'highlighted-item') {
if (params.itemId === 'high') {
return { fill: '#53c653' };
}
if (params.itemId === 'low') {
return { fill: '#ff3333' };
}
}
return {};
},
},
// Differentiated high/low styling options
item: {
high: {
stroke: '#39ac39',
marker: {
stroke: '#39ac39',
},
},
low: {
stroke: '#e60000',
marker: {
stroke: '#e60000',
},
},
},
},
],
}
In this configuration:
- The
strokeWidthis set to 2 on all lines. - All Markers are set a
sizeof 12 with a grayfill. - The
strokefor high line is set to a greenish colour. - The
strokefor low Line is set to a reddish colour. - An itemStyler is used to override the
fillof highlighted Markers, using different fill values for thehighandlowMarkers.