Gauge chart using SQL data


« 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 Robert on 19th March 2013
Ok, this is probably a basic question, but I am treading into new waters here.

I want to use the Gauge charts. I have a page displaying data from a SQL query. I want to change this to be a gauge. So the setup for the setup for the gauge is:

var gauge = new RGraph.Gauge('cvs', 0, 10, 3);

I want to change the actual value (3) to be a value from the query. So do I just do this:

var gauge = new RGraph.Gauge('cvs', 0, 10, <%# UnreleasedCount %>);

I assume the answer is "no", because that doesn't work.

Any help for a newbie would be appreciated.

Thanks
Posted by RGraph support on 19th March 2013
Hi there,

I don't know what language that is - presumably ASP which I don't know. With PHP you would do this:

var gauge = new RGraph.Gauge('cvs', 0, 10, <php print($UnreleasedCount); ?>);

$UnreleasedCount is the variable and as you can see it's just printing the variable. So in your browser that would become something like this:

var gauge = new RGraph.Gauge('cvs', 0, 10, 5);

You can see what yours is doing by viewing the source in your browser.



Richard, RGraph Support

1 Year Priority Support now reduced to £299:
   www.rgraph.net/support
Posted by Robert on 19th March 2013
Yes, it is ASP. I am probably not entering the variable correctly. I will try a few other things.

Thanks for the fast response!
Posted by RGraph support on 19th March 2013
Hi there,

One more thing to remember is to use *numbers* and not strings/text. So this is WRONG:

var gauge = new RGraph.Gauge('cvs', 0, 10, '9');

It should be like this:

var gauge = new RGraph.Gauge('cvs', 0, 10, 9);



Richard, RGraph Support

1 Year Priority Support now reduced to £299:
   www.rgraph.net/support
Posted by Robert on 19th March 2013
Roger that. I got it to work. For anyone else interested, it should be like this:

var gauge = new RGraph.Gauge('tucsonyesterdaypacked', 0, 3000, <%=UnreleasedCount%>);

I was close to begin with.

Thanks again!

Add a reply

 




« Back to message list
RGraph on social media