我使用highcharts绘制系列图表,xAxis上的时间和yAxis上的数字。 我使用的代码是:
$(function () {
$('#container').highcharts({
chart: {
type: 'spline'
},
title: {
text: '<span style="font-weight: bold; color: #B09730">Alert# ' + s[0] + '</span>'
},
subtitle: {
text: 'Start Date: ' + s[3] + " End Date: " + s[4] + "(" + s[5] + ")"
},
xAxis: {
type: 'datetime',
dateTimeLabelFormats: { // don't display the dummy year
month: '%e. %b',
year: '%b',
day: '%d'
},
title: {
text: 'Time'
},
},
yAxis: {
title: {
text: 'Alert Size'
},
min: 0,
},
tooltip: {
headerFormat: '<b>{series.name}</b><br>',
pointFormat: '{point.x:%e. %b}: {point.y:.2f}'
},
series: [{
name: 'Point',
// Define the data points. All series have a dummy year
// of 1970/71 in order to be compared on the same x axis. Note
// that in JavaScript, months start at 0 for January, 1 for February etc.
data: [
[1441293135000, 50],
[1441293195000, 100],
[1441293255000, 150],
[1441293315000, 250],
[1441293375000, 50]
]
}]
});
});
这段代码在chrome上工作正常,但是在mozilla上firefox不起作用,它给了我错误:
未捕获的异常:Highcharts错误#19:www.highcharts.com/errors/19
任何帮助?
答案 0 :(得分:0)
最后它有效,问题出在我的html元素的css属性中,我的html代码是这样的:
<div style="border: 1px solid #ccc; padding:10px; margin:5px;">
<span id="container" style="width: 850px; margin: 0 auto;overflow:scroll"></span>
</div>
我刚刚删除了溢出属性,它运行正常,我的html变成了这样:
<div style="border: 1px solid #ccc; padding:10px; margin:5px;">
<span id="container" style="width: 850px; margin: 0 auto;"></span>
</div>