0

I have used line chart. Here is the link of line chart http://jsfiddle.net/highcharts/qyntd1xa/ I have stuck in pass dynamically data in line chart. How to pass dynamically data in line chart. i am new in angular js here is my controller function code-

$scope.updatedays   =   function(){ 
        $scope.data =   $scope.getdata();
        console.log($scope.data);

        Highcharts.chart('cont2', {
            xAxis: {
                categories: ['MON 12', 'TUE 13', 'WED 14', 'THU 15', 'FRI 16', 'SAT 17', 'SUN 18']
            },

            series: [{
                data: [1.5, 5.5, 3.0, 2.5, 4.5, 3, 2]
            }]
        });
    }

I tryed pass dynamically data but i getting error in Highcharts.

1 Answers1

1

Store your data and your categories in two separate arrays that match up by index and then use those two arrays as your values.

For example:

xAxis: {
    categories: myCategoriesArray
},

series: [{
    data: myDataArray
}]

If you want to pass the arrays into your function, check out this post.

Community
  • 1
  • 1
Timothy Chen
  • 374
  • 1
  • 15