我使用highcharts来绘制系列,x轴上的时间和y轴上的数字。我使用的代码是:
$(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
帮忙吗?
最后它工作了,问题是在我的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>