tic
tic

Reputation: 4189

put labels on the right of the chart area in HighCharts

In a Highcharts line chart, I need to put the series name on the right of the last point of each one. Unfortunately, even if I set chart.spacingRight and chart.marginRight, the space on the right is not used.

enter image description here

Is there any solution/workaround?

Jsfiddle

Highcharts.chart('container', {

        chart: {
    spacingRight: 200
    },
    plotOptions: {
        series: {
            label: {
                enabled:false
            },
            pointStart: 2010,
                        dataLabels: {
              enabled:true,
              align:'left',
              verticalAlign:'middle',
              x:10,
              formatter: function() {
                return this.series.data.indexOf( this.point ) == this.series.data.length - 1 ? this.series.name : '';
              }
           }
        }
    },

    series: [{
        name: 'Installation',
        data: [43934, 52503, 57177, 69658, 97031, 119931, 137133, 154175]
    }, {
        name: 'Manufacturing',
        data: [24916, 24064, 29742, 29851, 32490, 30282, 38121, 40434]
    }, {
        name: 'Sales & Distribution',
        data: [11744, 17722, 16005, 19771, 20185, 24377, 32147, 39387]
    }, {
        name: 'Project Development',
        data: [null, null, 7988, 12169, 15112, 22452, 34400, 34227]
    }, {
        name: 'Other',
        data: [12908, 5948, 8105, 11248, 8989, 11816, 18274, 18111]
    }],

});

Upvotes: 1

Views: 37

Answers (1)

Core972
Core972

Reputation: 4114

You can do that with dataLabels.crop:false and dataLabels.overflow: 'allow'

dataLabels: {
  overflow: 'allow',
  crop:false,
  ...

Api documentation currently broken, so impossible to put the real link

Fiddle

Upvotes: 2

Related Questions