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!

有帮助吗?

解决方案

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] ]
    }]
    

其他提示

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top