【问题标题】:Highcharts pie chart plotting different valuesHighcharts 饼图绘制不同的值
【发布时间】:2014-08-14 00:04:43
【问题描述】:

我正在制作一个 highchart 饼图,由于某种奇怪的原因,我告诉它显示的数据与饼图显示的数据不同。

代码如下:

$('#container1').highcharts({
    chart: {
        plotBackgroundColor: null,
        plotBorderWidth: null,
        plotShadow: false
    },
    title: {
        text: 'Data'
    },
    tooltip: {
        pointFormat: '{series.name}: <b>{point.percentage:.2f}%</b>'
    },
    plotOptions: {
        pie: {
            allowPointSelect: true,
            cursor: 'pointer',
            dataLabels: {
                enabled: true,
                color: '#000000',
                onnectorColor: '#000000',
                format: '<b>{point.name}</b>: {point.percentage:.2f} %'
            }
        }
    },
    series: [{
        type: 'pie',
        name: 'Percent of Total Samples:',
        data: [
            ['Tf', 14.28],
            ['To', 5.71],
            ['Ts', 74.28]
        ]
    }]
});

这是小提琴:http://jsfiddle.net/3eL5eqgo/

有人知道为什么会发生这种情况吗?

谢谢!

【问题讨论】:

    标签: javascript jquery charts highcharts


    【解决方案1】:

    它显示的数据与您提供的数据不同的原因是它显示了总数的百分比。如果您的数据加到 100,它会是相同的,但它不会。

    【讨论】:

    • 太棒了。感谢那。我希望越多地使用这些东西,就越能捕捉到这样的小东西。
    • 没问题。祝你好运。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多