var chart = new Highcharts.Chart({
credits: {
enabled: false
},
chart: {
renderTo: "trendChart",
type: "spline", //显示类型
plotBorderWidth: 2, //主图表边框宽度
zoomType: "xy" //拖动鼠标放大图表的方向
},
title: {
text: ""
},
tooltip: {
// shared: true,
formatter: function(params) {
if (this.series.name.indexOf("率") > -1) {
return "" +
this.series.name +
" " +
this.x +
": " +
((Highcharts.numberFormat(this.y, 4, ".", ",") * 100).toFixed(2) +
"%");
} else if (
this.series.name == "收入" ||
this.series.name == "CPC" ||
this.series.name == "ecpm"
) {
return "" +
this.series.name +
" " +
this.x +
": " +
Highcharts.numberFormat(this.y, 2, ".", ",");
} else {
return "" +
this.series.name +
" " +
this.x +
": " +
Highcharts.numberFormat(this.y, 0, ".", ",");
}
}
},
colors: colors.length > 0 ? colors : ["#50B432", "#058DC7"],
xAxis: {
categories: categories,
reversed: true
},
yAxis: yaxis,
plotOptions: {
spline: {
lineWidth: 2,
states: {
hover: {
lineWidth: 3
}
},
marker: {
enabled: categories.length > 10 ? false : true
}
},
},
series: series
});