Is there an example that shows a dropdown menu or input to change the CSV source?

« 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.

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

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

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 value="sample.csv">Show Foo</option>
     <option value="bar.csv">Show Bar</option>

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


RGraph Support

Add a reply

« Back to message list