Jdruiter
Jdruiter

Reputation: 355

Highcharts series names in datalabel

I'm using highcharts library to output a column chart with 6 categories and 4 series.

I want to display the series name in the datalabel. Now it just gives the number.

chart 1

I've implemented a temporary solution but its not pretty:

chart 2

In the best solution, it would have O M G U above the category name, corresponding to the 4 columns per category.

Upvotes: 2

Views: 885

Answers (1)

ppotaczek
ppotaczek

Reputation: 39139

Use the format option to display series name as a data label, example:

    plotOptions: {
        column: {
            dataLabels: {
                ...,
                verticalAlign: 'bottom',
                format: '{point.series.name}'
            }
        }
    }

Live demo: http://jsfiddle.net/BlackLabel/8k5omy6z/

API Reference: https://api.highcharts.com/highcharts/series.column.dataLabels.verticalAlign

Upvotes: 2

Related Questions