Hardware Reference
In-Depth Information
Discussion
You can perform plotting externally, via the jsfiddle site, or locally.
Plotting with jsfiddle
The HTML panel in Figure 6-6 simply creates an area called myplot in which to draw the
plot. The JavaScript code in Example 6-5 then reads the analog in and creates the plot to
display.
Example 6-5. Code for plotting data with Flot (flotDemo.js)
setTargetAddress ( '192.168.7.2' , {
initialized : run
});
function run () {
var b = require ( 'bonescript' );
var POT = 'P9_36' ;
var container = $ ( "#myplot" );
var totalPoints = container . outerWidth () / 2 || 250 ;
var data = [];
var plotOptions = {
series : {
shadowSize : 0
},
yaxis : {
min : 0 ,
max : 1
},
xaxis : {
min : 0 ,
max : totalPoints ,
show : false
}
};
var plot = $ . plot ( container , getData (), plotOptions );
drawGraph ();
function drawGraph () {
plot . setData ( getData ());
plot . draw ();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Search WWH ::




Custom Search