11

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?

enter image description here

1 Answer 1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.