我有一个带有2行系列的图形。每个系列的点是百分比,但我以这种格式从数据库中获取它们:0.24,为24%,0.02%,为2%...在我的图形选项中,是否有任何方法将值直接乘以100?我尝试使用PointFormat和PointFormatter,但我的测试不是成功的...
我的图形配置:
options.evolRes.chart = {
renderTo: 'container_graph',
backgroundColor: '#F1F1F1',
width: $('#container_graph:parent').width(),
height: 700
};
options.evolRes.title = {
text: 'Title',
x: -20
};
options.evolRes.yAxis = [
{
title: {
text: 'Result'
},
labels: {
format: '{value}%'
},
min: 0,
max: 100,
tickInterval: 10
}
];
options.evolRes.xAxis = {
categories: ['T1','T2','T3','T4','T5','T6'],
labels: {
rotation: -45,
y: 20
}
};
options.evolRes.tooltip = {
crosshairs: true,
shared: true,
valueDecimals: 2
};
options.evolRes.series = [
{
name: 'Result X',
data: [0.2, 0.85, 0.63, 0.05, 0.26, 0.85],
yAxis: 0,
type: 'areaspline',
tooltip: {
valueSuffix : '%'
}
},{
name: 'Result Y',
data: [0.25, 0.35, 0.73, 0.05, 0.16, 0.25],
yAxis: 0,
type: 'areaspline',
tooltip: {
valueSuffix : '%'
}
}
]
尝试此
tooltip: {
formatter: function () {
var s = '<b>' + this.x + '</b>';
$.each(this.points, function () {
s += '<br/>' + this.series.name + ': ' +
this.y *100;
});
return s;
},
shared: true
}
样本小提琴:)