0

重要提示:它会以某种方式导致您的浏览器崩溃。我正在寻找这段代码很长时间,但找不到原因。我不会给出 jsfiddle 代码,因为如果你运行它会立即填满内存,尽管我有 5 个不同的值。谁能帮我找出错误?我很沮丧。

HTML

<div id="container" style="width:400px; height:300px"> </div>


JAVASCRIPT

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);
4

2 回答 2

1

这是因为类别是 forxAxys而不是 foryAxis

xAxis: {
    categories: ['Login', 'Bar', 'Line', 'Share', 'Target', 'Peaklist', 'Monitor', 'Diğer']
}

工作演示

参考

于 2012-12-15T00:08:13.620 回答
0

最后,我发现了问题。categories: ['Login', 'Bar', 'Line', 'Share', 'Target', 'Peaklist', 'Monitor', 'Diğer']导致问题,虽然我不知道原因。也许是因为字符串数组包含来自其他字符的字符

于 2012-12-14T23:44:15.117 回答