首页 文章

除了'bar'图表以外的任何内容都会破坏highcharts.js

提问于
浏览
0

**编辑 - 我把它缩小到这条线来打破它 - pointFormat:'% '任何想法为什么会发生这种情况?

几年前我使用过highcharts而且我刚刚重新认识 . 出于某种原因,除了饼图工作之外我什么都得不到 .

使用基本栏示例工作正常:

<script>
$(function () { 
var myChart = Highcharts.chart('stats_container', {
    chart: {
        type: 'bar'
    },
    title: {
        text: 'Fruit Consumption'
    },
    xAxis: {
        categories: ['Apples', 'Bananas', 'Oranges']
    },
    yAxis: {
        title: {
            text: 'Fruit eaten'
        }
    },
    series: [{
        name: 'Jane',
        data: [1, 0, 4]
    }, {
        name: 'John',
        data: [5, 7, 3]
    }]
});
});
</script>

但是当我去使用任何其他例子时,比如饼图:

<script>
$(function () { 
var myChart = Highcharts.chart('stats_container', {
chart: {
    plotBackgroundColor: null,
    plotBorderWidth: null,
    plotShadow: false,
    type: 'pie'
},
title: {
    text: 'Browser market shares January, 2015 to May, 2015'
},
tooltip: {
    pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
},
plotOptions: {
    pie: {
        allowPointSelect: true,
        cursor: 'pointer',
        dataLabels: {
            enabled: true,
            format: '<b>{point.name}</b>: {point.percentage:.1f} %',
            style: {
                color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
            }
        }
    }
},
series: [{
    name: 'Brands',
    colorByPoint: true,
    data: [{
        name: 'Microsoft Internet Explorer',
        y: 56.33
    }, {
        name: 'Chrome',
        y: 24.03,
        sliced: true,
        selected: true
    }, {
        name: 'Firefox',
        y: 10.38
    }, {
        name: 'Safari',
        y: 4.77
    }, {
        name: 'Opera',
        y: 0.91
    }, {
        name: 'Proprietary or Undetectable',
        y: 0.2
    }]
}]
});
});
</script>

我收到了http 500错误 . 我也尝试了一个高品质的例子,同样的问题也发生了 . 任何人都可以看到我错在哪里?我可以在饼图的系列和其他细节中加入,但是当我开始输入它打破的工具提示和plotoptions时 . 谢谢

1 回答

  • 0

    我使用smarty模板,js不在标签内 . Oooops

相关问题