我有这张图表:http://jsfiddle.net/zf3m6/4/
我无法弄清楚如何更改“mm'到' km'。
以下是当前代码:
$(function () {
var tmpSerie = [{
name: '20 and over',
color: 'Red',
data: [192]
}, {
name: 'Under 20',
color: 'Green',
data: [0, 173]
}, {
name: 'Zero',
color: 'Blue',
data: [0, 0, 25.1]
}, {
name: 'Not Assessed',
color: 'Black',
data: [0, 0, 0, 1.5]
}],
series = [],
len = tmpSerie.length,
i,j,data,dataLen;
for (i = 0; i < len; i++) {
data = [];
dataLen = tmpSerie[i].data.length;
for(j=0;j<dataLen;j++) {
console.log(tmpSerie[i].data[j]);
if(tmpSerie[i].data[j] > 0) {
data.push(tmpSerie[i].data[j]);
}
}
series.push({
name: tmpSerie[i].name,
color: tmpSerie[i].color,
data: data
});
}
$('#container').highcharts({
chart: {
type: 'column'
},
xAxis: {
categories: [
'20 and over',
'Under 20',
'Zero',
'Not Assessed']
},
yAxis: {
min: 0,
title: {
text: 'Kilometers'
}
},
tooltip: {
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
'<td style="padding:0"><b>{point.y:.1f} mm</b></td></tr>',
footerFormat: '</table>',
shared: true,
useHTML: true
},
plotOptions: {
column: {
pointPadding: 0.2,
borderWidth: 0
}
},
series: series
});
});