How to bind data to line chart in highcharts in MVC3?

后端 未结 1 871
轻奢々
轻奢々 2021-01-25 14:12

Hi all i have storedprocedure which where i get the output data like this

var loggedbugs

    projectName ProjectYear ProjectMonth    Wee         


        
1条回答
  •  迷失自我
    2021-01-25 14:37

    See here

    chart.series[0].data = loggedbugs;
    chart.series[1].data = closedbugs;
    var chart;
    chart = new Highcharts.Chart({
          ........
    });
    

    First, You are adding data to series before creating Chart and even defining chart variable.

    Second, You can set data in series using:

    series: [{
           name: 'Logged Bugs',
           data: loggedbugs
    
    },
    {
          name: 'ClosedBugs',
          data: closedbugs
    }]
    

    So, You event don't need

    chart.series[0].data = loggedbugs;
    chart.series[1].data = closedbugs;
    

    Here is the example: http://jsfiddle.net/mhardik/JRq7Z/

    EDIT: I dont know asp.net MVC3

    Check whether you are getting data. Print response in console using console.log() if you are using FF.

    for (var i in json) {
             loggedbugs.push([json[i].LoggedBugsCount]);
             closedbugs.push([json[i].ClosedBugs]);
    
     }
     // Check
     console.log(loggedbugs); console.log(closedbugs);
    

    0 讨论(0)
提交回复
热议问题