Polygon Chart

Overview

In AnyChart, Polygon is a special name for an Area series displayed on a polar plot with a categorized X-scale.

This article explains how to create a basic Polygon 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 Polygon chart's characteristics:

API
Classanychart.core.polar.series.Polygon
DATA
Data Fieldsx, value
Multiple SeriesYES
OPTIONS
StackedStacked Polygon, Percent Stacked Polygon
VerticalN/A
3DN/A
Error BarsN/A
SUPPORTED CHART PLOTS
PolarPolygon
RadarN/A
ScatterN/A
StockN/A
RELATED TYPES
Area
Polar Area
Radar Area
SEE ALSO
Chartopedia: Radar Chart
General Settings

Quick Start

To create a Polylygon chart, use the anychart.polar() chart constructor. Then call the polygon method to create a Polygon series.

The following sample demonstrates how a basic Polygon chart is created:

// create a chart
var chart = anychart.polar();

// create a polygon series and set the data
var series = chart.polygon(data);

// set the type of the x-scale
chart.xScale("ordinal");

// enable sorting points by x
chart.sortPointsByX(true);

// set the inner radius
chart.innerRadius(50);

// 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 Area chart (for example, legend and interactivity settings).

Read the overview of general settings: General Settings.

Special Settings

Appearance

The appearance settings of a Polygon 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 Polygon series with appearance settings configured:

// create the first series
var series1 = chart.polygon(series1.name("Wizard");

// 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().stroke("#00cc99", 1, "10 5", "round");
series1.hovered().stroke("#00cc99", 2, "10 5", "round");
series1.selected().stroke("#00cc99", 4, "10 5", "round");

// create the second series
var series2 = chart.polygon(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().stroke("#0066cc");
series2.hovered().stroke("#0066cc", 2);
series2.selected().stroke("#0066cc", 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.

Stacked Polygon

Stacked and percent stacked charts are multiple-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 Polygon chart, see: