gpt4 book ai didi

javascript - Highcharts Gauge 图表正在向下舍入最大数字

转载 作者:行者123 更新时间:2023-12-01 02:46:40 24 4
gpt4 key购买 nike

max 设置为非常大的数字(例如 666772)时会出现问题。Highcharts 将根据 tickPixelInterval 设置的内容取该数字并将其向下舍入。

如果我将 tickPixelInterval 值设置为更接近 0,则 Gauge 图表上的最大数字开始越来越接近 666772,但仍然是四舍五入的。我希望 min 从 0 开始(确实如此),然后 max 是确切的数字 (666772),甚至是四舍五入的版本(667k)。

有没有一种方法可以只在 Gauge 图表上显示 minmax

   var gaugeOptions = {

chart: {
type: 'solidgauge'
},

title: null,

pane: {
center: ['50%', '85%'],
size: '140%',
startAngle: -90,
endAngle: 90,
background: {
backgroundColor: '#EEE',
innerRadius: '60%',
outerRadius: '100%',
shape: 'arc'
}
},

// the value axis
yAxis: {
stops: [
[0.1, '#DF5353'], // green
[0.5, '#DDDF0D'], // yellow
[0.9, 'green'] // red
],
lineWidth: 0,
minorTickInterval: null,
tickPixelInterval: 400,
tickWidth: 0,
endOnTick: false,
maxPadding: 0,
title: {
y: -70
},
labels: {
y: 10,
format: '{value}'
}
},

credits: {
enabled: false
},

tooltip: {
enabled: false
},

plotOptions: {
solidgauge: {
dataLabels: {
y: 5,
borderWidth: 0,
useHTML: true
}
}
}

};

// Quarter1
jQuery('#quarter1').highcharts(Highcharts.merge(gaugeOptions, {
yAxis: {
min: 0,
max: 666772,
title: {
text: 'Quarter 1'
}
},

series: [{
name: 'Quarter 1',
data: [50],
dataLabels: {
format: '<div style="text-align:center"><span style="font-size:25px;color:' +
((Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black') + '">${y}</span><br/>' +
'<span style="font-size:12px;color:silver">Quota</span><br/><span>Bonus Elegible</span></div>'
}
}]

}));

最佳答案

使用此代码显示确切金额的最小值和最大值。

yAxis: {
min: 0,
max: 2602,
tickPositioner: function() {
return [this.min, this.max];
}

关于javascript - Highcharts Gauge 图表正在向下舍入最大数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30469247/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com