How to rotate data labels in the JavaScript Chart?
Essential Chart supports rotating data labels by using the angle property of the Data Label. Data label rotation can be performed for all the series in the JavaScript Chart by using the commonSeriesOptions or for a specific series in the series collection.
The following code example illustrates the use of commonSeriesOptions to rotate Data Labels of all the series in the Chart.
JS
$("#container").ejChart({ commonSeriesOptions: { marker: { dataLabel: { visible: true, //Rotating data label 90 degrees anti-clockwise of the Chart series. angle: -90, offset: -40, verticalTextAlignment: "near", font: { color: "white", size: "14px" } } } }, . . . . . . . . . . . . . . . . . . . . . . . . });
The following screenshot displays the chart with rotated data labels.
Figure 1: Chart with rotated data labels
JS Playground sample link: Data label rotation using CommonSeriesOptions
The following code example illustrates rotating data labels of individual series in the series collection.
JS
$("#container").ejChart({ title:{text:'Medals'}, series: [{ marker: { dataLabel: { visible: true, //Rotating data label 90 degrees anti-clockwise for the first series of the Chart. angle: -90, offset: -40, verticalTextAlignment: "near", font: { color: "white", size: "14px" } } }, . . . . . . . . . . }, . . . . . . . . . . ], . . . . . . . . . . });
The following screenshot displays the Chart with data labels only for the first series (Gold).
Figure 2: Chart with data labels only for the first series