首先我有这个功能:
"formatter" : function () {
var s = "";
var sum = 0;
var bugType = 0;
var color = '';
var date = new Date(this.points[0].x);
for (var i = 0; i < this.points.length; ++i) {
if (this.points[i].series.visible) {
bugType = this.points[i].series.name;
color = this.points[i].series.color;
s += '<span style="color:'+color+';">'+bugType+'</span>' + " = "+ this.points[i].y+'<br>';
sum += this.points[i].y;
}
}
s = date.toDateString() + "<br>" + '<span style="color:#FF3333;">Total values</span>'+' = ' +sum +'<br>' +s;
return s;
},
然后这个:
"pointFormat":
"<span style=\"color:{series.color}\">{series.name}</span>:
<b>{point.percentage:.1f}%</b>
({point.y:,.0f} bugs)<br/>"
为什么第二点格式无法识别/不起作用?
谢谢!
按要求完成查询:
{
"chart": {
"type": "area"
},
"plotOptions": {
"series": {
"marker": {
"enabled": false
},
"stacking": "percent"
},
"area": {
"stacking": "percent"
}
},
"yAxis": {
"max": 60,
"title": {
"text": "Percentage"
}
},
"tooltip": {
"shared": true,
"formatter": function () {
var s = "";
var sum = 0;
var date = new Date(this.points[0].x);
for (var i = 0; i < this.points.length; ++i) {
if (this.points[i].series.visible) {
color = this.points[i].series.color;
s += '<span style="color:' + color + ';">' + bugType + '</span>' + " = " + this.points[i].y + '<br>';
sum += this.points[i].y;
}
}
s = date.toDateString() + "<br>" + '<span style="color:#FF3399;">Total values</span>' + ' = ' + sum + '<br>' + s;
return s;
},
"valuePrefix": null,
"valueSuffix": "%",
"pointFormat": "<span style=\"color:{series.color}\">{series.name}</span>: <b>{point.percentage:.1f}%</b> ({point.y:,.0f} bugs)<br/>"
},
"subtitle": {
"text": "Subtitle"
},
"title": {
"text": "Title"
},
"xAxis": {
"type": "datetime"
},