Question

I have made a chart similar to this (http://www.highcharts.com/demo/bar-basic) using Highcharts, and now I would like to add a marker in the form of a vertical line on each of the bars. I've been trying to use "scatter" but that only allows me to add one marker per group of bars. Is there any way to change that? Or any other solutions? Thanks!

Was it helpful?

Solution

You have two solutions:

  • use scatter as you said, but calculate x-position (for example two bar series mean -0.25 and +0.25 to x-category. For example [1.25, 200] to show for second bar in second category.
  • use column range series with minPointLength set: http://jsfiddle.net/7F4hQ/ and stacks to connect series together

    plotOptions: {
        bar: {
            dataLabels: {
                enabled: true
            }
        },
        columnrange: {
            minPointLength: 5,
            borderWidth: 0
        }
    },
    series: [{
        stack: 1,
        name: 'Year 1800',
        data: [107, 31, 635, 203, 2]
    }, {
        stack: 2,
        name: 'Year 1900',
        data: [133, 156, 947, 408, 6]
    }, {
        stack: 3,
        name: 'Year 2008',
        data: [973, 914, 4054, 732, 34]
    }, {
        stack: 1,
        linkedTo: 0,
        type: 'columnrange',
        name: 'Year 1800',
        data: [ [107, 108], [107, 108],[107, 108], [107, 108],[107, 108] ]
    }, {
        stack: 2,
        linkedTo: 1,
        type: 'columnrange',
        name: 'Year 1900',
        data: [ [107, 108], [107, 108],[107, 108], [107, 108],[107, 108] ]
    }, {
        stack: 3,
        linkedTo: 2,
        type: 'columnrange',
        name: 'Year 2008',
        data: [ [10, 11], [107, 108],[107, 108], [107, 108],[107, 108] ]
    }]
    

OTHER TIPS

I think Bullet Chart is what you were looking for. They might have added this feature in later versions. You can add as many bars as you want. enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top