xxxxxxxxxx
let myPlot; // variable to store p5.Plot() object
let myArr = [-1, 0, 10, 50, -33, 2.5, 0];
let myObj = [{stuff: 50, things: 20}, {stuff: 55, things: 33}, {stuff: 33, things: 45}, {stuff: 60, things: 12}, {stuff: 30, things: 90}];
function setup() {
createCanvas(windowWidth, windowHeight);
background(255);
// CONSTRUCTOR:
myPlot = new p5.Plot({left: width*0.2, top: height*0.3, right: width*0.8, bottom: height*0.7});
// PLOT COMMAND:
myPlot.plot({data: myArr, type:'point', });
//myPlot.plot({data: myObj, type:'point'});
}
function draw() {
background(255);
// call redraw() function if you use hover() function
myPlot.redraw();
// use 'point' for line and point graph, 'bin' for histogram
myPlot.hover(mouseX, mouseY, 'point');
}