Fix potenziometer bar. Enable autoscale for y axis.
[bertos.git] / boards / sam3x-ek / examples / sam3x-ek_http_server / sd_data / index.htm
index 5879008abe0b040491714f7ba02fea79dabc5ccc..0d52c0c177f64e8b740cd9ecf4143e31c2885d09 100644 (file)
                                          dataType :'json',
                                          success: function(data){
 
-                                                $('#potentiometer').width(200*(parseInt(data['volt'])/4096));
+                                                $('#potentiometer').width(200*(parseInt(data['volt'])/4095));
                                                 $('#uptime').text(data['up_time'] +' sec');
                                                 $('#temperature').text(data['temp']+' °C');
                                                 temperature_data.push([data['up_time'],data['temp']]);
 
-                                                var o = plot_temperature.getAxes().xaxis.options;
-                                                o.max = Math.max(25,data['up_time']);
-                                                o.min = Math.max(0,(o.max - 25));
+                                                var x = plot_temperature.getAxes().xaxis.options;
+                                                var y = plot_temperature.getAxes().yaxis.options;
+                                                x.max = Math.max(25,data['up_time']);
+                                                x.min = Math.max(0,(x.max - 25));
+                                                y.autoscale = true;
                                                 plot_temperature.setData([temperature_data]);
                                                 plot_temperature.setupGrid();
                                                 plot_temperature.draw();