Using query string data

From version 6.06 RGraph has a set of functions that are targeted at making getting hold of data from the query string easy for you. There are functions to read numbers, strings (text), lists/arrays and JSON. This documentation also applies to the SVG versions of these functions.


If you're passing data around via the query string that's going to be displayed on your charts then RGraph has a set of functions that will make this much easier for you.

These functions take the name of the query string parameter that you want and return the value to you in the desired format which can be a number, a string, a JSON object or a JavaScript array depending on your data and which function you use.

The available functions

The available functions are:

An example

This is an example of using the RGraph.GET.json() function (because it's the most versatile). Click the link below to add some JSON to the URL and the chart that it produces will appear:


    json = RGraph.GET.json('json');

    if(json) {
        new RGraph.Bar({
            id: 'cvs',
            options: {
                xaxisLabels: json.labels,
                xaxis: false,
                yaxis: false,
                backgroundGridVlines: false,
                backgroundGridBorder: false
            {maxWidth: null, width: 700, height: 300, options:{textSize: 16, marginInner: 20}},
            {maxWidth: 750, width: 400, height: 200, options:{textSize: 11, marginInner: 5}}