How do you change a Thermometers current value using the Set() method?

« 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 gng on 15th November 2012
Can anyone give an example of how to change a thermometer's current value by calling the appropriate set method ?

I've tried :-

thermometer.Set(value, 78);

thermometer.Set("value", 78);

thermometer.Set("currentValue", 78);

etc but it has no effect.

Thanks for any help !
Posted by RGraph support on 15th November 2012

You can take a look at this page:

The first (green) thermometer is adjustable (with a Grow effect). The relevant code is (put this after you've made and drawn the thermometer):

myThermometer.canvas.onmousedown = function (e)
     var obj =;
     var value = obj.getValue(e);

     obj.value = value;
Posted by Lisp on 23rd November 2012
sorry but i don't understand, i want change value of thermo by clicking a button that call a function where i declare the object, something like this:

     <script >
      function changevalue(newvalue) {

is it possible to do something like this ?
Posted by gradtje on 24th November 2012
Hi there,

I`ve just spend yestrday`s evening with exact the same problem. I`m not very experienced with js...

Try thermometer.value = newvalue...

Then you need to clear and redraw of course.

Good luck !
Posted by RGraph support on 26th November 2012

Yes - as the the post above mentions - you set the value , clear and redraw. So wrapping that up in a function:

function SetValue (thermometer, value)
     thermometer.value = value;

     // There's a few ways to redraw your canvas - this is the easiest

Add a reply

« Back to message list