Xrange图表高度

时间:2018-09-23 15:10:40

标签: javascript html highcharts

如何设置xrange图表中每个条形的高度?我不想指定整个图表的高度,而是指定每个单个条形的高度。

这种类型的图表(如链接中所示): http://jsfiddle.net/vqpjL3ns/1/

height of bar

1 个答案:

答案 0 :(得分:0)

您应该为每个数据点创建单独的序列,然后才能为每个条设置不同的宽度:

series: [{
    name: 'Project 1',
    pointWidth: 20,
    data: [{
        x: Date.UTC(2014, 10, 21),
        x2: Date.UTC(2014, 11, 2),
        y: 0,
        partialFill: 0.25
    }],
    dataLabels: {
        enabled: true
    }
}, {
    pointWidth: 15,
    data: [{
        x: Date.UTC(2014, 11, 2),
        x2: Date.UTC(2014, 11, 5),
        y: 1
    }]
}, {
    pointWidth: 30,
    data: [{
        x: Date.UTC(2014, 11, 8),
        x2: Date.UTC(2014, 11, 9),
        y: 2
    }]
}, {
    pointWidth: 40,
    data: [{
        x: Date.UTC(2014, 11, 9),
        x2: Date.UTC(2014, 11, 19),
        y: 1
    }]
}, {
    pointWidth: 10,
    data: [{
        x: Date.UTC(2014, 11, 10),
        x2: Date.UTC(2014, 11, 23),
        y: 2
    }]
}]

实时演示:http://jsfiddle.net/BlackLabel/4uydm6tr/

API:https://api.highcharts.com/highcharts/series.xrange.pointWidth