Range Area Chart

Overview

A range area chart displays information as a range of data by plotting two Y-values (low and high) per data point. It looks like two lines, the area between them usually being filled with color or a pattern.

Such charts are used to emphasize the magnitude of difference between high and low values and at the same time to show trends in data over time.

This article explains how to create a basic Range Area chart as well as configure settings that are specific to the type. You can also see the table below to get a brief overview of the Range Area chart's characteristics:

ModulesCore + Basic Cartesian / Base
API
Classanychart.core.cartesian.series.RangeArea
DATA
Data Fieldsx, value
Multiple SeriesYES
OPTIONS
StackedN/A
VerticalVertical Range Area
3DN/A
Error BarsN/A
SUPPORTED CHART PLOTS
PolarN/A
RadarN/A
ScatterN/A
StockStock Range Area
RELATED TYPES
Area
Spline Area
Step Area
Range Spline Area
Range Step Area
HiLo
SEE ALSO
Chartopedia: Range Area Chart
General Settings

Modules

The Range Area chart requires adding the Core and Basic Cartesian modules:

<script src="https://cdn.anychart.com/releases/8.13.0/js/anychart-core.min.js"></script>
<script src="https://cdn.anychart.com/releases/8.13.0/js/anychart-cartesian.min.js"></script>

Alternatively, you can use the Base module, which includes, among other things, the two modules mentioned above:

<script src="https://cdn.anychart.com/releases/8.13.0/js/anychart-base.min.js"></script>

Learn more: Modules.

Quick Start

To create a Range Area series, use the rangeArea() method (before, of course, you should create a chart by using anychart.area() or any other cartesian chart constructor).

Since range area charts plot two Y-values per data point, you need to specify two values for each category by using the low and high parameters. This is how it looks like in object notation:

var data = [
  {x: "January", low: 0.7, high: 6.1},
  {x: "February", low: 0.6, high: 6.3},
  {x: "March", low: 1.9, high: 8.5},
  {x: "April", low: 3.1, high: 10.8},
  {x: "May", low: 5.7, high: 14.4}
];

The following sample demonstrates how a basic Range Area chart is created:

// create data
var data = [
  ["January", 0.7, 6.1],
  ["February", 0.6, 6.3],
  ["March", 1.9, 8.5],
  ["April", 3.1, 10.8],
  ["May", 5.7, 14.4]
];

// create a chart
chart = anychart.area();

// create a range area series and set the data
var series = chart.rangeArea(data);

// set the container id
chart.container("container");

// initiate drawing the chart
chart.draw();

Playground

General Settings

In AnyChart there are many settings that are configured in the same way for all chart types, including the Range Area chart (for example, legend and interactivity settings).

Read the overview of general settings: General Settings.

Special Settings

Appearance

The appearance settings of a Range Area chart can be configured in three states: normal, hover, and selected. Use the normal(), hovered(), and selected() methods.

Combine them with the following methods:

Also, you can use some other methods from anychart.core.StateSettings.

In the sample below, there are two Range Area series with appearance settings configured:

// create the first series
var series1 = chart.rangeArea(seriesData_1);

// configure the visual settings of the first series
series1.normal().fill("#00cc99", 0.3);
series1.hovered().fill("#00cc99", 0.1);
series1.selected().fill("#00cc99", 0.5);
series1.normal().lowStroke("#00cc99", 1, "10 5", "round");
series1.hovered().lowStroke("#00cc99", 2, "10 5", "round");
series1.selected().lowStroke("#00cc99", 4, "10 5", "round");
series1.normal().highStroke("#ff6666", 1, "10 5", "round");
series1.hovered().highStroke("#ff6666", 2, "10 5", "round");
series1.selected().highStroke("#ff6666", 4, "10 5", "round");

// create the second series
var series2 = chart.rangeAarea(seriesData_2);
// configure the visual settings of the second series
series2.normal().fill("#0066cc", 0.3);
series2.hovered().fill("#0066cc", 0.1);
series2.selected().fill("#0066cc", 0.5);
series2.normal().hatchFill("forward-diagonal", "#0066cc", 1, 15);
series2.hovered().hatchFill("forward-diagonal", "#0066cc", 1, 15);
series2.selected().hatchFill("forward-diagonal", "#0066cc", 1, 15);
series2.normal().lowStroke("#0066cc", 1);
series2.hovered().lowStroke("#0066cc", 2);
series2.selected().lowStroke("#0066cc", 4);
series2.normal().highStroke("#ff6666");
series2.hovered().highStroke("#ff6666", 2);
series2.selected().highStroke("#ff6666", 4);

Playground

Labels

Labels are text or image elements that can be placed anywhere on any chart (you can enable them on a whole series or in a single point). For text labels, font settings and text formatters are available.

Tooltips

A Tooltip is a text box displayed when a point on a chart is hovered over. There is a number of visual and other settings available: for example, you can edit the text by using font settings and text formatters, change the style of background, adjust the position of a tooltip, and so on.

Scales

When Range Area chart is used with the ordinal scale and you wish to remove the gaps to the right and left of the area you need to change the ordinal scale mode to 'continuous':

chart.xScale().mode('continuous');

Playground

Vertical Range Area

Most types of series in AnyChart can be drawn both in horizontal and vertical orientation: Vertical Charts.

Here is information about creating Vertical Range Area series: