Using variables in MeterGauge

8 views
Skip to first unread message

dsteiner

unread,
Dec 16, 2021, 12:53:24 PM12/16/21
to jqplot-users
Hi all,

I try to use variables which are set through a mysql querie in my metergauge.

Can anyone point me in the right direction on how to use these variables in the code?

<script>
$(document).ready(function() {
  var chart_data = [ [23] ];
  var chart_opt = {
    title:'Temperatur',
    seriesDefaults:{
      renderer:$.jqplot.MeterGaugeRenderer,
       rendererOptions: {
         min: 00,
         max: 50,
         intervals:[10, 20, 30, 40, 50],
         intervalColors:['#33ccff', '#66cc66', '#93b75f', '#E7E658', '#cc6666']
       }
    }
  };

  $.jqplot('chart4', chart_data, chart_opt);
});
</script>

I would like to replace the data in " var chart_data = [ [23] ]; " with the variable $temp which is set outside the script.

Thanks
Reply all
Reply to author
Forward
0 new messages