首页 文章

饼图和列中的Highcharts默认颜色不一样?

提问于
浏览
0

为什么对于饼图和柱形图,Higcharst默认列是不同的?你可以在这里看到:http://jsfiddle.net/RqvU4/即约翰在列和馅饼上有不同的颜色?如果不手动定义颜色,我怎样才能使它变得相同?

1 回答

  • 2

    它们的颜色不同,因为 highcharts 为每个 serie 添加了不同的颜色 .
    您可以看到默认颜色here .

    您可以手动为每个系列设置 color ,如下所示 .

    {
        type: 'pie',
        name: 'Total consumption',
        data: [{
            name: 'Jane',
            color: '#4572A7',
            y: 13
        }, {
            name: 'John',
            color: '#AA4643',
            y: 23                    
        }, {
            name: 'Joe',
            color: '#89A54E',
            y: 19
        }],
        center: [100, 50],
        size: 100,
        showInLegend: false,
        dataLabels: {
            enabled: false
        }
    }
    

    Demo

相关问题