grafica icon indicating copy to clipboard operation
grafica copied to clipboard

Need help on addPoint syntax

Open mag-immo opened this issue 5 years ago • 2 comments

Hi, I would like to plot a simple graph in real time from two sensors values sent by an arduino based on the mouse position example. My problem is that I don't understand the syntax of the example. The code below works perfectly with the mouse position but when I try to change it with my values , I get The function "addPoint()" expects parameters like : "addPoint(GPoint)"

public void setup(){
   plot1 = new GPlot(this);
   plot1.setPos(350, 150);
   plot1.setDim(700, 500);
   plot1.getTitle().setText("Effet tactile");
   plot1.getXAxis().getAxisLabel().setText("Déplacement (mm)");
   plot1.getYAxis().getAxisLabel().setText("Force (N)");
}
public void draw(){   
   plot1.addPoint(mouseX, -mouseY, "(" + str(mouseX) + " , " + str(mouseY) + ")");
}

Could you please help me ?

Regards, Yves

mag-immo avatar Mar 29 '19 15:03 mag-immo