怎么设置 highcharts StockChart 的鼠标提示
轴的具体名称 该怎么设置啊 我看你的都是日期 我的不知道生成的是什么 展开
给你个例子参考参考
注意 tooltip
var chartData=[{"name":"总车流量","type":"spline","tooltip":{"valueDecimals":3,"xDateFormat":"%Y-%m-%d %H:%M:%S"},"data":[[1436958000000,1766],[1436961600000,1776],[1436965200000,1282],[1436968800000,1926],[1436972400000,1432],[1436976000000,660],[1436979600000,620],[1436983200000,660],[1436986800000,430],[1436990400000,520]]}]
showSpline('html标签id',chartData,'y轴名字')
function showSpline(id, chartData, yName) {
var yZhouBiaoTi = "";//竖立后的y轴标题
for (var i = 0; i < yName.length; i++) {
yZhouBiaoTi += yName[i] + "<br/>";
}
yName = yZhouBiaoTi;
chart = $('#' + id).highcharts('StockChart', {
navigator: {
height: 18
},
tooltip: {
formatter: function () {
var yDisplayText = "";
yDisplayText += new Date(this.x).toLocaleString() + ' <br/> <span style="color:' + this.points[0].point.series.color + '"> ' + this.points[0].series.name + '</span>:' + this.points[0].y;
return yDisplayText;
}
},
xAxis: {
type: 'datetime'
},
chart: {
backgroundColor: 'rgba(255, 255, 255, 0)'
},
rangeSelector: {
enabled: false,
inputEnabled: false,
selected: 1
},
legend: {
enabled: true,
magrgin: 20
},
title: {
text: ''
},
series: chartData,
yAxis: {
title: {
text: yName,
rotation: 0
},
opposite: false
}
, credits: {
enabled: false
}
, plotOptions: {
series: {
connectNulls: true,
dataLabels: {
enabled: true
}
}
}
});
}