highcharts.js中的参数行80无效

时间:2013-12-19 06:42:10

标签: javascript highcharts

我已经在代码中检查了昏迷,分号,一切看起来都很好。在Firefox和Chrome中它运行正常但在IE8中它提示我在Highcharts.js中的无效参数行80指向:

if(!C.namespaces.hcv)C.namespaces.add("hcv","urn:schemas-microsoft-com:vml")

这是我的代码

var chart = new Highcharts.Chart({
        chart: {
            renderTo: container[0],
            type: 'column',
            style: {
                fontFamily: '"Arial", "Helvetica", "sans-serif"',
                fontSize: '12px',
                fontWeight: 'bold'
            },
            spacingLeft: 0

        },
        credits: {
            enabled: false
        },
        title: null,
        yAxis: {
        title: null,
            lineWidth: 2,
            lineColor: '#505050',
            gridLineWidth: 0,
            labels: {
                step: 1,
                y: 0,
                style: {
                    fontFamily: '"Arial", "Helvetica", "sans-serif"',
                    fontSize: '11px',
                    fontWeight: 'normal'
                }
            },



            min: 0,
            minRange:0.1

        },
        xAxis: {
            categories:cat,
            labels: {
                style: {
                    fontFamily: '"Arial", "Helvetica", "sans-serif"',
                    fontSize: '11px',
                    fontWeight: 'normal',
                    width: '90px'
                }
            },
            tickWidth: 0
        },
        plotOptions: {
            column: {

                dataLabels: {
                    enabled: true,
                formatter: function() {


                        var percent =0;

                        var catName =this.x;

                        if(catName.indexOf('TAM')>=0){
                            percent = this.y ;             
                            if (percent <= 50) {
                                return '<span style="color: #7b4000">' + percent + '</span>';
                            } else {
                                return '<span style="color: #3a5305">' + percent + '</span>';
                            }

                        }

                        else {
                           percent =Math.round( this.point.shareValue * 100)/100;

                            if (percent <= 50) {
                                return '<span style="color: #7b4000">' + percent + '%</span>';
                            } else {
                                return '<span style="color: #3a5305">' + percent + '%</span>';
                            }
                        }
                    },

                    style: {
                        fontFamily: '"Arial", "Helvetica", "sans-serif"',
                        fontWeight: 'bold'
                    },
                    zIndex: 11,
                    useHTML: true
                },
                borderWidth: 0,
                shadow: false
            }
        },
        series: [{
            data: data
        }],
        legend: {
            enabled: false
        },
        tooltip: {
            enabled: false
        }
    }, function(chart) {
        for (var i = 0; i < 5; ++i) {
            chart.renderer.path(['M', 23, 160.5 - 28 * i, 'L', 34, 160.5 - 28 * i]).attr({
                'stroke-width': 1,
                stroke: 'white',
                'stroke-opacity': 0.7,
                zIndex: 10
            }).add();
            if ($.browser.msie && parseInt($.browser.version <= 8) && !CHART_CUT_LINE_FOR_IE) {
                continue;
            }
            chart.renderer.path(['M', 30, 160.5 - 28 * i, 'L', 300, 160.5 - 28 * i]).attr({
                'stroke-width': 1,
                stroke: 'white',
                'stroke-opacity': 0.3,
                zIndex: 10
            }).add();
        }
    });  

有什么想法吗?

感谢。

2 个答案:

答案 0 :(得分:0)

尝试更改该行:

if ($.browser.msie && parseInt($.browser.version <= 8) && !CHART_CUT_LINE_FOR_IE) {
            continue;
        }

为:

if ($.browser.msie && parseInt($.browser.version, 10) <= 8 && !CHART_CUT_LINE_FOR_IE) {
            continue;
        }

答案 1 :(得分:0)

我碰到了这个网址:Highcharts IE issues with jQuery ajax load。我在mycharts.js文件中评论了下面的代码片段

,C.createStyleSheet().cssText="hcv\\:fill, hcv\\:path, hcv\\:shape, hcv\\:stroke{ behavior:url(#default#VML); display: inline-block; }

它有效,现在它在IE中工作。