Articles in this section
Category / Section

How to bind series with a secondary axis in JavaScript Chart?

1 min read

Essential Chart supports using multiple axes in JavaScript Chart. By default, the primary X axis and primary Y axis are used as horizontal and vertical axes for a series. You can add additional axes to chart by using the axes collection in chart.

To bind series to an axis, assign axis name for xAxisName or yAxisName property of series. The default value for name property of axis is not defined, hence it is mandatory to provide a name for axis before binding it with series.

Use the xAxisName property for binding a horizontal axis and yAxisName property for binding a vertical axis. When these properties are not assigned any value, primary X axis is considered as the horizontal axis for series and primary Y axis is considered as the vertical axis for series.

JS

$("#container").ejChart({
    axes: [{
        name: 'Secondary Axis',
        orientation: 'vertical',
        opposedPosition: true
    },
    . . . . . . .
    . . . . . . .
    ],
    series: [{
        yAxisName: 'Secondary Axis',
        points: [{ x: 10, y: 20 }, { x: 15, y: 21 }, { x: 20, y: 31 }, { x: 25, y: 27 }, { x: 30, y: 17 }],
        type: 'column'
        . . . . . . .
        . . . . . . . 
    },
    . . . . . .
    . . . . . .
    ]
});

The output of the above code example is similar to the following screenshot.

Series with a secondary axis

Figure 1: Output

JS Playground sample link: Secondary Axis


Conclusion

I hope you enjoyed how to bind series with a secondary axis in Chart.

You can refer to our JavaScript Chart feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our JavaScript Chart example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied