1 回答
TA贡献2条经验 获得超0个赞
已解决,格式搞错了,没有转成json
function getCharts() {//获得图表
var maxD = $('#nLimitMoney').val();
var useD1 = $('#tjesum').val();
var useD = eval("(" + useD1 + ")");//转换为json数据
var pPer = $('#per').val();
//var useD = 22888258.89;
console.log(maxD);
console.log(useD);
console.log(pPer);
var gaugeOptions = {
chart: {
type: 'solidgauge'
},
title: null,
pane: {
center: ['50%', '85%'],
size: '140%',
startAngle: -90,
endAngle: 90,
background: {
backgroundColor: (Highcharts.theme && Highcharts.theme.background2) || '#EEE',
innerRadius: '60%',
outerRadius: '100%',
shape: 'arc'
}
},
tooltip: {
enabled: false
},
// the value axis
yAxis: {
stops: [
[0.1, '#55BF3B'], // green
[0.5, '#DDDF0D'], // yellow
[0.9, '#DF5353'] // red
],
lineWidth: 0,
minorTickInterval: null,
tickPixelInterval: 400,
tickWidth: 0,
title: {
y: -70
},
labels: {
y: 16
}
},
plotOptions: {
solidgauge: {
dataLabels: {
y: 5,
borderWidth: 0,
useHTML: true
}
}
}
};
// The speed gauge
$('#container_useage').highcharts(Highcharts.merge(gaugeOptions, {
yAxis: {
min: 0,
max: maxD,
title: {
text: ''
}
},
credits: {
enabled: false
},
series: [{
name: '额度',
data: [useD],
dataLabels: {
format: '<div style="text-align:center"><span style="font-size:15px;color:' +
((Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black') + '">' + pPer + '%</span><br/>' +
'<span style="font-size:12px;color:silver"></span></div>'
},
tooltip: {
valueSuffix: ''
}
}]
}));
}
- 1 回答
- 0 关注
- 1676 浏览
添加回答
举报