Dropdown menu or input to change CSV Source

Share RGraph:   To help my Google visibility (it can't get much worse!), if you like and use RGraph I'd appreciate it if you could link to me

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Dan on 23rd March 2013
Is there any example that uses a dropdown menu to select CSV files to draw a new graph? Perhaps even a basic text input would work?

 
Posted by Dan on 24th March 2013
I have settled with the prompt function. It works well when the page is entered or refreshed. It's rudimentary but it requires less page space and is less complicated.

I put the prompt function just above the callback and the value is used in the AJAX call to the proper csv file. Below is my example:

     cycle_number = prompt("Enter Cycle Number", '');
            var callback = function ()
     {

RGraph.AJAX('/csv/'+cycle_number+'_cycle.cvs', callback);


All is well.
 

Cheers!


www.rgraph.net

Posted by RGraph support on 25th March 2013
Hi there,

There's a basic demo that you might be interested in:

www.rgraph.net/docs/basic-csv.html

This uses the RGraph.AJAX() function to fetch a CSV file and then creates the chart in the myCallback function after parsing the CSV. So something like this:

<select id="myDropdown" onchange="RGraph.AJAX(this.value, myCallback)">
     <option></option>
     <option value="sample.csv">Show Foo</option>
     <option value="bar.csv">Show Bar</option>
</select>

Though when you create the new chart you'll probably want to reset the canvas first:

RGraph.Reset(myCanvas);


Richard, RGraph Support

1 Year Priority Support now reduced to £299:
   www.rgraph.net/support

Add a reply




« Back to message list