James Cho
James Cho

Reputation: 11

Is there anyway to know the value of the meter gauge when clicked?

So I am trying to create a meter gauge with real time update. The way I have coded currently is receiving the value of the meter gauge via parameter and had it replot when the user clicks on the meter gauge. Now, I want the meter gauge to replot with the new value when the user clicks on the different parts of the meter gauge. Therefore, I was wondering if there was anyway to find the such value. Here is the code:

 var gauge = [<%=gauge%>];
$(document).ready(function(){
    s1 = gauge; 
   plot1 = $.jqplot('chart3',[s1],{
       seriesDefaults: {
           renderer: $.jqplot.MeterGaugeRenderer,
           rendererOptions: {
               
               min: 0,
               max: 16,
               showTickLabels: true,
               ticks: ['E','','','','','','','','F'],
               intervals: [8,14,16],
               intervalColors:['#66cc66', '#E7E658', '#cc6666']
           }
       }
       
   });  
   
   $(document).click(function(){
        var newValue = s1;
        plot1.series[0].data[0] = [1,newValue];
        plot1.replot();
        return s1;
     });
  
});

jsfiddle

Upvotes: 1

Views: 29

Answers (0)

Related Questions