FusionCharts - Thermometer Gauge - A simple example

Created using FusionCharts Suite XT - www.fusioncharts.com

by FusionCharts

HTML

<script src="https://cdn.fusioncharts.com/fusioncharts/latest/fusioncharts.js"></script>
<script src="https://cdn.fusioncharts.com/fusioncharts/latest/themes/fusioncharts.theme.fusion.js"></script>
<!-- A simple example of Thermometer gauge -->
<div id="chart-container">FusionCharts will render here</div>

JavaScript

FusionCharts.ready(function() {
  var updateAnnotation,
    chart = new FusionCharts({
      type: 'thermometer',
      renderAt: 'chart-container',
      id: 'myThm',
      width: '240',
      height: '310',
      dataFormat: 'json',
      dataSource: {
        "chart": {
          "theme": "fusion",
          "caption": "Temperature Monitor",
          "subcaption": " Central cold store",
          "lowerLimit": "-10",
          "upperLimit": "0",

          "decimals": "1",
          "numberSuffix": "°C",
          "showhovereffect": "1",
          "thmFillColor": "#008ee4",
          "showGaugeBorder": "1",
          "gaugeBorderColor": "#008ee4",
          "gaugeBorderThickness": "2",
          "gaugeBorderAlpha": "30",
          "thmOriginX": "100",
          "chartBottomMargin": "20",
          "valueFontColor": "#000000",
          "theme": "fusion"
        },
        "value": "-6",
        //All annotations are grouped under this element
        "annotations": {
          "showbelow": "0",
          "groups": [{
            //Each group needs a unique ID
            "id": "indicator",
            "items": [
              //Showing Annotation
              {
                "id": "background",
                //Rectangle item 
                "type": "rectangle",
                "alpha": "50",
                "fillColor": "#AABBCC",
                "x": "$gaugeEndX-40",
                "tox": "$gaugeEndX",
                "y": "$gaugeEndY+54",
                "toy": "$gaugeEndY+65"
              }
            ]
          }]

        },
      },
      "events": {
        "initialized": function(evt, arg) {
          var dataUpdate = setInterval(function() {
            var value,
              prevTemp = FusionCharts.items["myThm"].getData(),
              mainTemp = (Math.random() * 10) * (-1),
              diff = Math.abs(prevTemp - mainTemp);

            diff = diff > 1 ? (Math.random() * 1) : diff;
            if (mainTemp > prevTemp) {
             ...