javascript - Creating a chart using jchartfx -


i need create chart through dynamic data.

<script type="text/javascript" language="javascript">     // step 1     // on window load data using ajax     window.onload = function () {         getajaxdata();     }      // step 2     // after getting data, call chart function , pass data     function getajaxdata() {         var values;         $.ajax({             cache : false,             type : "get",             url : 'chartvalues',             format:'json',             success: function(values) {                 onloaddoc(values);             }         });     }      // step 3     // process chart using passed data     function onloaddoc(values) {         var chart1;         chart1 = new cfx.chart();chart1.getanimations().getload().setenabled(true);         var axisy = chart1.getaxisy();         axisy.setmin(0);         axisy.setmax(30);          //----assign data fields--------         var fields = chart1.getdatasourcesettings().getfields();         var field1 = new cfx.fieldmap();         field1.setname("value");         field1.setusage(cfx.fieldusage.value);         fields.add(field1);         var field2 = new cfx.fieldmap();         field2.setname("date");         field2.setusage(cfx.fieldusage.xvalue);         fields.add(field2);          chart1.setgallery(cfx.gallery.bar);          //----set sample data------------         var items = values;         alert (items);         chart1.setdatasource(items);         chart1.getview3d().setenabled(true);          var chartdiv = document.getelementbyid('chartdiv1');         chart1.create(chartdiv);     } </script> 

in variable items getting value in json format like:

[     { "date": "2012-01-21t23:45:10.280z", "value": 15 },     { "date": "2012-02-10t23:45:10.280z", "value": 12 }, ] 

but chart not displaying? need do?


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -