pee2pee
pee2pee

Reputation: 3802

Highcharts display value of the average with addPlotLine

Looking at http://jsfiddle.net/0tfkfh2v/16/ which does what I want but it doesn't display the average amount - how would I get around this?

yAxis.addPlotLine({
    value: (sum/count),
    color: 'red',
    width: 2,
    id: 'avgLine'
});

Thanks

Upvotes: 0

Views: 251

Answers (1)

Deep 3015
Deep 3015

Reputation: 10075

Add label inside yAxis.addPlotLine({...})

Fiddle Demo

 yAxis.addPlotLine({
    value: (sum / count),
    label: {
      text: (sum / count).toFixed(2),
      verticalAlign: 'middle',
      align: 'right',
      rotation: 0,
    },
    color: 'red',
    width: 2,
    id: 'avgLine'
  });

Upvotes: 1

Related Questions