Polyline Chart
Overview
In AnyChart, Polyline is a special name for a Line series displayed on a polar plot with a categorized X-scale.
This article explains how to create a basic Polyline 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 Polyline chart's characteristics:
API | |
---|---|
Class | anychart.core.polar.series.Polyline |
DATA | |
Data Fields | x, value |
Multiple Series | YES |
OPTIONS | |
Stacked | N/A |
Vertical | N/A |
3D | N/A |
Error Bars | N/A |
SUPPORTED CHART PLOTS | |
Polar | Polyline |
Radar | N/A |
Scatter | N/A |
Stock | N/A |
RELATED TYPES | |
Line | |
Polar Line | |
Radar Line | |
SEE ALSO | |
Chartopedia: Radar Chart | |
General Settings |
Quick Start
To create a Polyline chart, use the anychart.polar() chart constructor. Then call the polyline method to create a Polyline series.
The following sample demonstrates how a basic Polyline chart is created:
// create data
var data = [
["Strength", 8],
["Dexterity", 14],
["Concentration", 14],
["Intelligence", 15],
["Wisdom", 12],
["Charisma", 8]
];
// create a chart
var chart = anychart.polar();
// create a polyline series and set the data
var series = chart.polyline(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();
General Settings
In AnyChart there are many settings that are configured in the same way for all chart types, including the Polyline chart (for example, legend and interactivity settings).
Read the overview of general settings: General Settings.
Special Settings
Appearance
The appearance settings of a Polyline chart can be configured in three states: normal, hover, and selected. Use the normal(), hovered(), and selected() methods.
Combine them with the stroke() method. Also, you can use some other methods from anychart.core.StateSettings.
In the sample below, there are two Polyline series with appearance settings configured:
// create the first series
var series1 = chart.polyline(seriesData_1);
// configure the visual settings of the first series
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.polyline(seriesData_2);
// configure the visual settings of the second series
series2.normal().stroke("#0066cc");
series2.hovered().stroke("#0066cc", 2);
series2.selected().stroke("#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 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.