Trying to show two Thermometer charts on one page

« 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 stephen on 6th December 2015
I am trying to display two Thermostats on one page. I have tried the following code.
<title> test2 </title>

<script src='../test/libraries/RGraph.common.core.js' ></script>
<script src='../test/libraries/RGraph.thermometer.js' ></script>
<script src="RGraph.common.csv.js"></script>
    window.onload = function () {
      var water = new RGraph.Thermometer({
       id: 'cvs',
       min: 0,
       max: 100,
       options: {
            centerx: 100
        var rayburn = new RGraph.Thermometer({
       id: 'cvs',
       min: 0,
       max: 100,
       options: {
            centerx: 500


<canvas id="cvs" width="100" height="400">
     [No canvas support]
but this only shows the last thermometer.
I have tried adding the following
  var thermo = new RGraph.Thermometer("cvs", 0,100,56)
but then I get nothing.

please can you help
thank you
Posted by Richard on 6th December 2015

The centerx property is not a valid Thermometer property. Even if it were you are using the same value for both thermometers so the second would sit on top of the first - which is also what is probably happening now.

So you need to increase the width of your canvas to about 300 so that there's room for both thermometers. Then you need to adjust the size of the gutters to accommodate the thermometers. For example:

Thermometer 1:
     gutterLeft: 5
     gutterRight: 155

Thermometer 2:
     gutterLeft: 155
     gutterRight: 5



Add a reply

« Back to message list