Javascript Highcharts正在将十进制值修约为0。如何避免呢?
我正在传递ecpm,如下所示,[“0.4”、“0.2”、“0.6”、“0.3”]作为y轴的数据,使用highcharts在多轴图形上绘制样条曲线。但它将样条曲线绘制为一条水平直线,并将值视为0。工具提示中每个点的值也是0 以下是使用的脚本:Javascript Highcharts正在将十进制值修约为0。如何避免呢?,javascript,jquery,highcharts,Javascript,Jquery,Highcharts,我正在传递ecpm,如下所示,[“0.4”、“0.2”、“0.6”、“0.3”]作为y轴的数据,使用highcharts在多轴图形上绘制样条曲线。但它将样条曲线绘制为一条水平直线,并将值视为0。工具提示中每个点的值也是0 以下是使用的脚本: $('#dual-axes-line-and-column4').highcharts({ chart: { zoomType: 'xy' },
$('#dual-axes-line-and-column4').highcharts({
chart: {
zoomType: 'xy'
},
title: {
text: 'Some Matrix'
},
subtitle: {
text: ''
},
xAxis: [{
categories: perfCategoriesStr
}],
yAxis: [
{ // Primary yAxis
labels: {
format: '{value}',
style: {
color: '#89A54E'
}
},
title: {
text: 'Views',
style: {
color: '#89A54E'
}
},
opposite:false
}, { // Secondary yAxis
title: {
text: 'Revenue in $',
style: {
color: '#4572A7'
}
},
labels: {
format: '{value}',
style: {
color: '#4572A7'
}
},
opposite: true
}, { // Secondary yAxis
title: {
text: 'eCPM in $',
style: {
color: '#4572A7'
}
},
labels: {
format: '{value}',
style: {
color: '#4572A7'
}
},
opposite: true
}],
tooltip: {
shared: true
},
legend: {
layout: 'vertical',
align: 'left',
x: 70,
verticalAlign: 'top',
y: 10,
floating: true,
backgroundColor: '#FFFFFF'
},
series: [{
name: 'Views',
color: '#4572A7',
type: 'column',
data: views,
tooltip: {
valueSuffix: ' views'
}
}, {
name: 'Revenue',
color: '#89A54E',
type: 'spline',
yAxis:1,
data: revenue,
tooltip: {
valuePrefix: '$ '
}
}, {
name: 'eCPM',
color: '#000000',
type: 'spline',
yAxis: 1,
data: ecpm,
tooltip: {
valuePrefix: '$ '
}
}]
});
我刚想出来。传递的值应该是数字而不是字符串。如果我们在数组中传递javascript数字,而不是在问题中看到的字符串中传递javascript数字,那么它就可以正常工作。您还可以在highcharts代码中发布吗?可能是选项参数?谢谢@Omkar的介绍。