如何使子弹更高,带子更薄

时间:2019-12-08 14:04:16

标签: highcharts

我正在使用子弹图,并且不能使子弹更高,带子更细。

我所拥有的:

original

我想要什么:

desire

我尝试设置厚度,但这没有帮助:

plotBands: [
  {
    from: 0,
    to: 50,
    color: "#61Cd8D",
    thickness: '5%'
  }

这里是示例: https://jsfiddle.net/e9z5rvat/2/

请帮助我

1 个答案:

答案 0 :(得分:1)

绘图线占据了绘图区域的整个高度,并且在其外部看不到序列。作为解决方案,您可以添加堆叠的column系列来代替使用绘图线:

series: [{
    stacking: 'normal',
    type: 'column',
    groupPadding: 0.1,
    pointPadding: 0,
    enableMouseTracking: false,
    data: [{
            x: 0,
            y: 50,
            color: "#61Cd8D"
        },
        {
            x: 0,
            y: 50,
            color: "#E6E4A5"
        },
        {
            x: 0,
            y: 51,
            color: "#F0A434"
        }
    ]
}, {
    data: [{
        y: 0,
        target: 45
    }],
    groupPadding: 0,
    pointPadding: 0,
    targetOptions: { // Options related with look and position of targets
        width: '100%', // The width of the target
        height: 5, // The height of the target
        borderWidth: 0, // The border width of the target
        borderColor: 'black', // The border color of the target
        color: 'black' // The color of the target
    }
}]

实时演示: https://jsfiddle.net/BlackLabel/wjyadh7f/

API参考: https://api.highcharts.com/highcharts/series.column.groupPadding