Click here to Skip to main content
15,894,291 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello ,

I want to take dynamically array value in High chart,

I have created following code , Here I am retrieving value from SharePoint list And according to that values I need to develop a graph So what I can do for That?

So Please help provide me any answer...
JavaScript
 ........Something Code above.......
    $().SPServices({
                operation: method,
                async: false,  //if you set this to true, you may get faster performance, but your order may not be accurate.
                listName: list,
                CAMLViewFields: fieldsToRead,
                  CAMLQuery: query,
                      //this basically means "do the following code when the call is complete"
                    completefunc: function (xData, Status) { 
                        //this code iterates through every row of data returned from the web service call
                        $(xData.responseXML).SPFilterNode("z:row").each(function() { 
    var Name = ($(this).attr("ows_Title"));
 var Salary = ($(this).attr("ows_Salary"));
 var iID=$(this).attr("ows_ID");
                         
                       
                            //call a function to add the data from the row to a table on the screen
                            AddRowToTable(Name ,Salary ,iID);
                            
                            
                            
                        });                
                    }
        });

}
 function AddRowToTable(Name ,Salary ,iID)
     {

         alert(Salary);
         
          $.getJSON("arr", function AddRowToTable(Name ,Salary ,iID) {
        $('#courseTable').highcharts({
           title: {
             text: 'Monthly Average Salary',
              x: -20 //center
           },
            subtitle: {
               text: '',
               x: -20
            },
            xAxis: {
               categories:[''+Name+'']
                         },
            yAxis: {
            
                       
              title: {
                  text: 'Salary (RS)'
                },
                
                    plotLines: [{
                  
                    value: 0,
                    width: 1,
                   color: '#808080'
               }]
               
             

            },
            tooltip: {
                valueSuffix: 'Rs'
            },
            
          
            legend: {
                layout: 'vertical',
                align: 'right',
                verticalAlign: 'middle',
               borderWidth: 1
            },
            
            series: [{
                             
              name: [''+Name+''],
              data: JSON.parse("[" + Salary+ "]") 
                    
                     }]
       });
       });
    };

</script>


[EDIT]Please, use code formatting. Thank you. Maciej Los[/EDIT]
Posted
Updated 21-Feb-14 4:56am
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900