Area Chart
Overview
An area chart is a chart type based on the line chart: it also shows information as a series of data points connected by straight line segments, but the area between the X-axis and the line segments is filled with color or a pattern.
The area chart emphasizes the magnitude of change over time and can be used to highlight the total value across a trend. For example, an area chart displaying profit over time can emphasize the total profit.
This article explains how to create a basic 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 Area chart's characteristics:
API | |
---|---|
Class | anychart.core.cartesian.series.Area |
DATA | |
Data Fields | x, value |
Multiple Series | YES |
OPTIONS | |
Stacked | Stacked Area, Percent Stacked Area |
Vertical | Vertical Area |
3D | 3D Area |
Error Bars | Area Chart with Error Bars |
SUPPORTED CHART PLOTS | |
Polar | Polar Area |
Radar | Radar Area |
Scatter | N/A |
Stock | Stock Area |
RELATED TYPES | |
Spline Area | |
Step Area | |
Range Area | |
Range Spline Area | |
Range Step Area | |
SEE ALSO | |
Chartopedia: Area Chart | |
General Settings |
Quick Start
To create an Area chart, use the anychart.area() chart constructor. If you pass the data to this chart constructor, it creates an Area series.
To create an Area series explicitly, call the area() method.
The following sample demonstrates how a basic Area chart is created:
// create a data set
var data = anychart.data.set([
["January", 10000],
["February", 12000],
["March", 18000],
["April", 11000],
["May", 9000]
]);
// create a chart
var chart = anychart.area();
// create an area series and set the data
var series = chart.area(data);
// set the container id
chart.container("container");
// initiate drawing the chart
chart.draw();
General Settings
In AnyChart there are many settings that are configured in the same way for all chart types, including the Area chart (for example, legend and interactivity settings).
Read the overview of general settings: General Settings.
Special Settings
Appearance
Here is a full list of methods used to configure visual settings that are available for the Area series:
- color(), fill(), hatchFill(), stroke() set the color, fill, hatch fill, and stroke
- hoverFill(), hoverHatchFill(), hoverStroke() configure the visual settings on hover
- selectFill(), selectHatchFill(), selectStroke() configure the visual settings on select
You can learn more from the Appearance Settings section.
In the sample below, there are two Area series with some of the appearance settings configured:
// create the first series
var series1 = chart.area(seriesData_1);
// configure the visual settings of the first series
series1.fill("#00cc99", 0.3);
series1.hoverFill("#00cc99", 0.3);
series1.selectFill("#00cc99", 0.5);
series1.stroke("#00cc99", 1, "10 5", "round");
series1.hoverStroke("#00cc99", 2, "10 5", "round");
series1.selectStroke("#00cc99", 4, "10 5", "round");
// create the second series
var series2 = chart.area(seriesData_2);
// configure the visual settings of the second series
series2.fill("#0066cc", 0.3);
series2.hoverFill("#0066cc", 0.3);
series2.selectFill("#0066cc", 0.5);
series2.hatchFill("zigzag", "#808080", 1, 15);
series2.stroke("#0066cc");
series2.hoverStroke("#0066cc", 2);
series2.selectStroke("#0066cc", 4);
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. 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.
Stacked Area
Stacked and percent stacked charts are multi-series charts where related values are placed atop one another, which allows comparing the the contribution of a value to a total, either in absolute or percentage terms.
In AnyChart, you can enable a special mode of the scale to make series stack together: see Stacked Charts.
To learn about the stacked versions of the Area chart and its modifications, see:
- Stacked Area
- Percent Stacked Area
- Stacked Spline Area
- Percent Stacked Spline Area
- Stacked Step Area
- Percent Stacked Step Area
Vertical Area
Most types of series in AnyChart can be drawn both in horizontal and vertical orientation: Vertical Charts.
Here is the information about creating Vertical Area series:
3D Area
Using AnyChart, you can create 3D versions of some chart types, including the Area chart.
To learn about 3D charts in general, see 3D Charts.
The 3D Area chart is described in the following article: 3D Area Chart