Javascript 当我分配选项时,Highcharts崩溃
重要提示:它会以某种方式导致浏览器崩溃。我查找此代码很长时间,但找不到原因。我不会给出JSFIDLE代码,因为如果您运行它,它会立即填满内存,尽管我在其中有5个不同的值。有人能帮我找出错误吗?我很沮丧Javascript 当我分配选项时,Highcharts崩溃,javascript,highcharts,Javascript,Highcharts,重要提示:它会以某种方式导致浏览器崩溃。我查找此代码很长时间,但找不到原因。我不会给出JSFIDLE代码,因为如果您运行它,它会立即填满内存,尽管我在其中有5个不同的值。有人能帮我找出错误吗?我很沮丧 HTML 最后,我发现了问题所在类别:['Login','Bar','Line','Share','Target','Peaklist','Monitor','Diğer']导致问题,尽管我不知道原因。可能是因为字符串数组包含来自其他字符的字符这是因为类别用于xAxys,而不是yAxis xAxi
HTML
最后,我发现了问题所在<代码>类别:['Login','Bar','Line','Share','Target','Peaklist','Monitor','Diğer']导致问题,尽管我不知道原因。可能是因为字符串数组包含来自其他字符的字符这是因为类别用于
xAxys
,而不是yAxis
xAxis: {
categories: ['Login', 'Bar', 'Line', 'Share', 'Target', 'Peaklist', 'Monitor', 'Diğer']
}
首先,您需要将
style=“width:400px;height:300px”
放入您的div#容器中。请注意分号而不是逗号。您使用的是高图表
还是高股票
?看看我的答案,您就会知道问题所在。
var options = {
colors: [ "#7798BF", "#55BF3B", "#DF5353", "#aaeeee", "#ff0066", "#eeaaee",
"#55BF3B", "#DF5353", "#7798BF", "#aaeeee","#DDDF0D"],
chart: {
borderWidth: 0,
borderRadius: 15,
plotBackgroundColor: null,
plotShadow: true,
plotBorderWidth: 0,
margin: 30,
renderTo: 'container'
},
title: {
text: 'Toplam sayfa ziyaret süreleri',
style: {
color: '#555',
font: '16px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif'
}
},
subtitle: {
style: {
color: '#DDD',
font: '12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif'
},
text: 'this is subtitle'
},
xAxis: {
minTickInterval: 10,
gridLineWidth: 0,
lineColor: '#999',
tickColor: '#999',
labels: {
style: {
color: '#444',
fontWeight: 'bold'
}
},
title: {
style: {
color: '#AAA',
font: 'bold 12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif'
}
},
offset: 0
},
yAxis: {
categories: ['Login', 'Bar', 'Line', 'Share', 'Target', 'Peaklist', 'Monitor', 'Diğer'],
alternateGridColor: null,
minorTickInterval: 600000, //600 seconds
type: 'datetime',
dateTimeLabelFormats:{
second: '%M:%S',
minute: '%M:%S',
hour: '%H:%M:%S',
day: '%e. %b',
week: '%e. %b',
month: '%b \'%y',
year: '%Y'
},
gridLineColor: 'rgba(255, 255, 255, .1)',
lineWidth: 0,
tickWidth: 1,
labels: {
style: {
color: '#999',
fontWeight: 'bold'
}
},
title: {
style: {
color: '#AAA',
font: 'bold 12px Lucida Grande, Lucida Sans Unicode, Verdana, Arial, Helvetica, sans-serif'
}
}
},
labels: {
style: {
color: '#CCC'
}
},
tooltip: {
enabled: false
},
plotOptions: {
bar: {
dataLabels: {
color: '#CCC'
}
}
},
toolbar: {
itemStyle: {
color: '#CCC'
}
},
// special colors for some of the demo examples
dataLabelsColor: '#444',
textColor: '#E0E0E0',
maskColor: 'rgba(255,255,255,0.3)',
series: [{
type: 'column',
name: 'Data',
data: [[0,100000],[1,200000],[2,1950000],[3,10000],[4,2000],[5,100000],[6,10000], [7,0000]],
color: 'rgba(100,100,150,0.5)'
}],
legend:{
enabled: false
}
};
chart2 = new Highcharts.Chart(options);
xAxis: {
categories: ['Login', 'Bar', 'Line', 'Share', 'Target', 'Peaklist', 'Monitor', 'Diğer']
}