饼图在 HIghChart 中不包含动态数据

Pie Chart is not coming with dynamic data in HIghChart

我正在用 json 数据制作饼图,但饼图没有数据后端 data.I 我正在用这种格式生成数据,这实际上是 [=16= 给出的格式] 正在粘贴我的代码

function createChart(array){
//alert(array);
 var arrJobName = [];
var arrRevenue = [];

for(var i=0; i<array.length; i++){
    searchResultArray = array[i].split("$$##$$##");   

    //var label = '\''+ searchResultArray[1]+ '\'';
    //var value = parseInt(searchResultArray[5]);

    //arrJobName.push(searchResultArray[1]);
    //arrRevenue.push(parseInt(searchResultArray[5]));
    //alert(parseFloat(searchResultArray[5]))
    // arrRevenue.push(['\''+ searchResultArray[1]+ '\'',""(parseFloat(searchResultArray[5]))]);

    arrRevenue.push('['+searchResultArray[1]+","+parseFloat(searchResultArray[5])+']');

}

alert(arrRevenue)
//

$(function () {
    $('.containerForDiagram').highcharts({
        chart: {
            plotBackgroundColor: null,
            plotBorderWidth: null,
            plotShadow: false
        },
        title: {
            text: 'Browser market shares at a specific website, 2014'
        },
        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: [{
            type: 'pie',
            name: 'Job By Revenue',
            data: [

                    [arrRevenue]
//['Director - Inventory/Planning Systems',36800],['DevOps Engineer',20000],   ['Java Developer',0],['Software Development Manager',0],['Sr. Business Analyst / Oracle Functional',0],['Product Manager Native Advertising',0],['Corporate Recruiter ',26000],['Sr. Oracle Supply Chain BA',0],['Network Engineer',0],['Sharepoint Programmer Analyst',0],['Commercial Manager -  Mexico',0],['Commercial Manager Colombia',0],['Sr. Global Architect - End User Computing',29900],['Head of Marketing   Peru',0],['Director, Sr Attorney',0]

this is the data i am getting with my code                  ]


        }]
    });
});

}

我为 arrRevenue 获取的数据已给出 here.But 当我使用它时 arrRevenue 不工作 dynamically.I 已经尝试了所有 syntax.But 仍然没有用。有人请帮助.

问题在于生成数据。需要进行两项更改:

  • 数据赋值:data: [arrRevenue] -> data: arrRevenue
  • 数据生成:arrRevenue.push('['+searchResultArray[1]+","+parseFloat(searchResultArray[5])+']'); -> arrRevenue.push( [ searchResultArray[1], parseFloat(searchResultArray[5]) ] );