admin管理员组

文章数量:1201025

I'm trying to recreate a chart (the one below) using Highcharts. I'm using a basic bar chart, and I'm wondering if there is a way to get a vertical line showing the average of all the bars? I have the value calculated, I just need it to display as the picture shows. Can I do this using Highcharts?

I'm trying to recreate a chart (the one below) using Highcharts. I'm using a basic bar chart, and I'm wondering if there is a way to get a vertical line showing the average of all the bars? I have the value calculated, I just need it to display as the picture shows. Can I do this using Highcharts?

Share Improve this question asked Aug 18, 2014 at 22:01 Ryan McClureRyan McClure 1,2233 gold badges20 silver badges35 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 24

Yes. You can add it as a plotline, like this:

yAxis: {
    // ...Options
    plotLines: [{
        color: 'red',
        value: '15', // Insert your average here
        width: '1',
        zIndex: 4 // To not get stuck below the regular plot lines or series
    }]
}

See this JSFiddle demonstration.

本文标签: javascriptCan I add an quotaveragequot line to Highcharts ChartStack Overflow