Spline Chart
Overview
A spline chart is a line chart in which data points are connected by smooth curves: this modification is aimed to improve the design of a chart.
Like the regular line chart, it is commonly used to emphasize trends in data over equal time intervals.
The Line and Spline chart types share all the settings, so this article explains just how to create a basic Spline chart. To learn about other settings, read the Line Chart article. You can also see the table below to get a brief overview of the Spline chart's characteristics:
Modules | Core + Basic Cartesian / Base |
API | |
---|---|
Class | anychart.core.cartesian.series.Spline |
DATA | |
Data Fields | x, value |
Multiple Series | YES |
OPTIONS | |
Stacked | N/A |
Vertical | Vertical Spline |
3D | N/A |
Error Bars | Spline Chart with Error Bars |
SUPPORTED CHART PLOTS | |
Polar | N/A |
Radar | N/A |
Scatter | N/A |
Stock | Stock Spline |
RELATED TYPES | |
Line | |
Step Line | |
SEE ALSO | |
Chartopedia: Spline Chart | |
General Settings |
Modules
The Spline 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 Spline series, use the spline() method (before, of course, you should create a chart by using anychart.line() or any other cartesian chart constructor):
// create data
var data = [
{x: "January", value: 10000},
{x: "February", value: 12000},
{x: "March", value: 18000},
{x: "April", value: 11000},
{x: "May", value: 9000}
];
// create a chart
chart = anychart.line();
// create a spline series and set the data
var series = chart.spline(data);
// set the container id
chart.container("container");
// initiate drawing the chart
chart.draw();
Settings
The Spline chart is a modification of the Line chart, so these two types share all the settings. You can find more settings in this article: Line Chart.
Also, in AnyChart there are many settings that are configured in the same way for all chart types, including the Spline chart (for example, legend and interactivity settings): General Settings.
In addition, see the full list of methods available for the Spline series: anychart.core.cartesian.series.Spline.