grafica
grafica copied to clipboard
Need help on addPoint syntax
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