我在工具提示Sankey-diagram Highcharts上收到错误

时间:2018-03-20 16:44:02

标签: javascript highcharts sankey-diagram

我试图使用highcharts库创建一个sankey图。工具提示在sankey行上运行正常,从节点开始,当我将鼠标悬停在节点上时会抛出错误:

无法检索'系列' null或未定义引用的属性

我用于sankey的代码非常简单,我不明白为什么它不起作用。这是代码:

 var sankeyOptions = {
                    chart: {                      
                        renderTo: "container"                       
                    },
                    title: {
                        text: title
                    },

                series: [{
                    keys: ['from', 'to', 'weight'],
                    data: [
                        ['Oil', 'Transportation', 94],
                        ['Natural Gas', 'Transportation', 3],
                        ['Coal', 'Transportation', 0],
                        ['Renewable', 'Transportation', 0],
                        ['Nuclear', 'Transportation', 3],

                        ['Oil', 'Industrial', 41],
                        ['Natural Gas', 'Industrial', 40],
                        ['Coal', 'Industrial', 7],
                        ['Renewable', 'Industrial', 11],
                        ['Nuclear', 'Industrial', 0],

                        ['Oil', 'R&C', 17],
                        ['Natural Gas', 'R&C', 76],
                        ['Coal', 'R&C', 1],
                        ['Renewable', 'R&C', 7],
                        ['Nuclear', 'R&C', 0],

                        ['Oil', 'Electric Power', 1],
                        ['Natural Gas', 'Electric Power', 18],
                        ['Coal', 'Electric Power', 48],
                        ['Renewable', 'Electric Power', 11],
                        ['Nuclear', 'Electric Power', 22]

                    ],

                    type: 'sankey',
                    name: 'Energy in the United States'
                }]
            };

           var chartObject = new Highcharts.Chart(sankeyOptions);

感谢您的帮助。

0 个答案:

没有答案