Nir*_*ath 2 javascript charts highcharts lazy-high-charts
我喜欢为高图表动态设置 minPointLengh 的值。但是下面提到的代码不起作用。你能帮我完成它吗?
$(function () {
$('#container').highcharts({
chart: {
type: 'column'
},
xAxis: {
categories: ['Sep', 'Oct', 'Nov', 'Dec']
},
plotOptions: {
var minPointLength;
if(this.y > 0)
minPointLength = 3,
else
minPointLength = 0,
series: {
minPointLength: minPointLength,
}
},
series: [{
data: [4, 0, 1, 5]
}]
});
});
Run Code Online (Sandbox Code Playgroud)
我的建议:将任何0值更改为null值。
该minPointLength不会与空影响任何点y的值。
将代码更新为:
$(function () {
$('#container').highcharts({
chart: {
type: 'column'
},
xAxis: {
categories: ['Sep', 'Oct', 'Nov', 'Dec']
},
plotOptions: {
series: {
minPointLength: 3
}
},
series: [{
data: [4, null, 1, 5]
}]
});
});
Run Code Online (Sandbox Code Playgroud)
例子:
您的代码不起作用的另一个原因:您试图minPointLength直接在plotOptions对象内设置属性- 它需要在系列选择器对象之一(即“ series: {}”、“ column: {}”等)内。
| 归档时间: |
|
| 查看次数: |
1434 次 |
| 最近记录: |