javascript - dynamically creating the values for high charts -


i want create dynamic data high charts,

i need generate dynamic values in x-axis

xaxis: {  categories:['project1','project2']    }, 

this loop,

var project = []; for(var i=0;i<project.name;i++){    //new array } 

how create dynamic values in x-axis.

you can pass array variabile parameter categories option of chart.

example:

// original array var categories1=['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec']  // copy and/or modifify second array content , stuff var categories2=[]; for(var i=0;i<categories1.length;i++){    categories2.push(categories1[i]); }  var chart = new highcharts.chart({      chart: {         renderto: 'container'     },      xaxis: {         categories: categories2 // reference categories array variabile     },      series: [{         data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]     }]  }); 

working fiddle: http://jsfiddle.net/irvindominin/6c8af/


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -