nz1975 Posted May 17, 2013 Report Share Posted May 17, 2013 I'm a n00b so I have a two question: 1. How could I clear my data from chart? (or refresh?) 2. When I set data on my chart I have a data,which I'm not enter. I use your sample code from this site. Thanks Quote Link to comment Share on other sites More sharing options...
0 ExequielA Posted May 17, 2013 Report Share Posted May 17, 2013 Hello, You can clear the data by assigning an empty item to theDataSource, take a look at the following code: varitems = [];chart1.setDataSource(items); Using arrays is a quick way of passing data to the chart,please refer to the sample below: varitems = [ {"Value": 9}, {"Value":15}, {"Value":21}, {"Value":26}, {"Value":35}];chart1.setDataSource(items); Ihope this helps. Quote Link to comment Share on other sites More sharing options...
0 nz1975 Posted May 17, 2013 Author Report Share Posted May 17, 2013 OK,this is a clear,but I need a refresh data so i have this function and she works: " function onLoadDoc() { var vl1; var vl2; var vl3; var val1; var val2; var val3; var chart1; chart1 = new cfx.Chart(); chart1.setGallery(cfx.Gallery.Lines); chart1.getLegendBox().setDock(cfx.DockArea.Bottom); val1 = document.getElementById('v1').value; <-v1,v2,v3 are text input (number) val2 = document.getElementById('v2').value; val3 = document.getElementById('v3').value; vl1 = parseInt(val1); vl2 = parseInt(val2); vl3 = parseInt(val3); var data=[{ "Label": "+18", "text": vl1 }, { "Label": "0", "text": vl2 }, { "Label": "-15", "text": vl3 }]; chart1.setDataSource(data); var chartDiv = document.getElementById('ChartDiv1'); chart1.create(chartDiv); } //*****END OF FUNCTION***** """" This function works but I need next:User change V1,V2 AND V3 (number value) and press a button,then i need just to refresh data in same chart Quote Link to comment Share on other sites More sharing options...
0 mmd Posted May 27, 2013 Report Share Posted May 27, 2013 helo this is a function I wrote for cleaning the chart ..hope this helps .." function PlotClear(chart) { var items = [{ "Series 1": "0,0" }]; chart.setDataSource(items); chart.update();} Quote Link to comment Share on other sites More sharing options...
Question
nz1975
I'm a n00b so I have a two question:
1. How could I clear my data from chart? (or refresh?)
2. When I set data on my chart I have a data,which I'm not enter.
I use your sample code from this site.
Thanks
Link to comment
Share on other sites
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.