I want to plot the graph of reading of gyroscope data vs Time. I am using grafica library. I am adding the point in the points in the loop and want to change the color of specific points when certain condition is detected while plotting the graph. the code my plot_graph() is called from the draw function. But it changes the color of complete graph.
Please help. Please suggest
gy: has array of gyroscope data and time has timestamp
void draw(){
while (iteration<max_count)
{
plot_graph();
iteration++;
}
}
plot_graph()
{
points2.add(time[iteration],gy[iteration]);
plot1.setPoints(points2);
plot1.beginDraw();
plot1.drawBackground();
plot1.drawXAxis();
plot1.drawYAxis();
plot1.drawTopAxis();
plot1.drawRightAxis();
plot1.drawTitle();
plot1.drawGridLines(GPlot.BOTH);
if (status==a)
{
plot1.setPointColor(color(0, 200, 0));
}
else if (status==b)
{
plot1.setPointColor(color(200,0, 42));
}
plot1.getMainLayer().drawPoints();
plot1.activatePointLabels();
plot1.activatePanning();
plot1.activateZooming(1.1, CENTER, CENTER);
plot1.activateZooming(1.5);
plot1.endDraw();
}