Duc Pham The
Duc Pham The

Reputation: 33

Hightcharts: Set series label in last point

I want to use Accessible line chart of Highcharts (https://www.highcharts.com/demo/accessible-line)

In demo, I saw some series label position on last point, some in middle and first point.

How can I set all series label on last point?

enter image description here

Sorry for my bad English!

Upvotes: 0

Views: 40

Answers (1)

ppotaczek
ppotaczek

Reputation: 39079

You can use data labels instead of series labels.

Example:

    plotOptions: {
        series: {
            dataLabels: {
                enabled: true,
                formatter: function() {
                    if (this.point.index === this.series.points.length - 1) {
                        return this.series.name;
                    }
                }
            },
            ...
        }
    }

Live demo: https://jsfiddle.net/BlackLabel/9ps2ckhr/

API Reference: https://api.highcharts.com/highcharts/plotOptions.series.dataLabels

Upvotes: 1

Related Questions