Display a value from a webpage text box on an RGraph Bar chart

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 Dave on 15th January 2016
I am trying to display a value from a webpage text box on a Rgraph Bar chart.


//data for bar chart is
data: DeltaT,

//but assigning values from the webpage textbox 'textboxDT' as follows does not work

DeltaT [0]= textboxDT.value;
   
//But assigning a value like this works
DeltaT [0]=9;


//Whats wrong with my code please
Posted by Richard on 15th January 2016
Hi,

It might be that the value from the text box, although appearing numeric, is actually a string (text). So you will need to convert it like this:

DeltaT[0] = Number(textboxDT.value);




Richard
Posted by Richard on 15th January 2016
Hi,

Thinking about it again - you might also try this:

DeltaT[0] = parseFloat(textboxDT.value);

They should both work though.




Richard
Posted by Dave on 15th January 2016
Thanks... That sorted it!

Add a reply




« Back to message list