I have a program in processing and i try to plot a temperature graph When i create the trace , i use the following :
double temp = random(20, 40); Line2DTrace temptrace = new Line2DTrace(new eq3()); g.addTrace(temptrace); The eq3() :
public class eq3 implements ILine2DEquation{
public double computePoint(double temp,int pos) {
return Math.random();
}
}
I know that eq3 does not make thinks right but i dont understand , and see how to make it .
temp is a random double number
Below is the g element of the plot i created :
g = new Graph2D(p, 600, 200, false);
// setting attributes for the X and Y-Axis g.setYAxisMin(-5); g.setYAxisMax(50); g.setXAxisMin(-900); g.setXAxisMax(0); g.setXAxisLabel("Sec"); g.setYAxisLabel("Temp-Hum"); g.setXAxisLabelAccuracy(1); g.setYAxisLabelAccuracy(1); g.setXAxisTickSpacing(100); g.setYAxisTickSpacing(10);
// switching of the border, and changing the label positions g.setNoBorder(); g.setXAxisLabelPos(LabelPos.END); g.setYAxisLabelPos(LabelPos.END);
// switching on Grid, with differetn colours for X and Y lines gb = new GridBackground(new GWColour(240)); gb.setGridColour(200,100,200,180,180,180); g.setBackground(gb);
g.position.y = 100; g.position.x = 575; Could you please help me ?