Javascript 高位图表错误#19
我用highcharts绘制系列图表,时间在X轴上,数字在Y轴上。 我使用的代码是:Javascript 高位图表错误#19,javascript,jquery,highcharts,Javascript,Jquery,Highcharts,我用highcharts绘制系列图表,时间在X轴上,数字在Y轴上。 我使用的代码是: $(function () { $('#container').highcharts({ chart: { type: 'spline' }, title: { text: '<span style="font-weight: bold; color: #B09730">Alert# ' + s[
$(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]
]
}]
});
});
$(函数(){
$(“#容器”)。高图({
图表:{
类型:“样条线”
},
标题:{
文本:“警报”#“+s[0]+”
},
副标题:{
文本:“开始日期:”+s[3]+“结束日期:”+s[4]+“(“+s[5]+”)
},
xAxis:{
键入:“日期时间”,
dateTimeLabelFormats:{//不显示虚拟年份
月份:'%e.%b',
年份:'%b',
日期:'%d'
},
标题:{
文字:“时间”
},
},
亚克斯:{
标题:{
文本:“警报大小”
},
分:0,,
},
工具提示:{
headerFormat:“{series.name}
”,
点格式:“{point.x:%e.%b}:{point.y:.2f}”
},
系列:[{
名称:'点',
//定义数据点。所有系列都有一个虚拟年份
//为了在同一x轴上进行比较,请注意
//在JavaScript中,月份从0开始表示一月,从1开始表示二月,以此类推。
数据:[
[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>
<div style="border: 1px solid #ccc; padding:10px; margin:5px;">
<span id="container" style="width: 850px; margin: 0 auto;"></span>
</div>
我刚刚删除了overflow属性,它工作正常,我的html如下所示:
<div style="border: 1px solid #ccc; padding:10px; margin:5px;">
<span id="container" style="width: 850px; margin: 0 auto;overflow:scroll"></span>
</div>
<div style="border: 1px solid #ccc; padding:10px; margin:5px;">
<span id="container" style="width: 850px; margin: 0 auto;"></span>
</div>
您是否阅读了错误说明?它告诉你这个问题,以及如何解决它:我读了它,但无法理解它,或者如何解决它?你知道吗?我也有同样的问题,但是当我不知道图表的大小时,我怎么知道前面是否会有太多的刻度,因为它可能是响应的,或者是动态的-因此图表的宽度可能取决于浏览器的宽度?@Asped我和你有同样的问题,但是我把静态数据放在前面以使它更清晰,请,,有人帮忙吗@如果你看到这个,可能会对你有帮助。