23rd April 2005, 4:49 PM
You're probably way past this point already Derek, but if you haven't got around to it yet, this might save you some time.
The first <a href="http://www.sci.usq.edu.au/staff/leighb/graph/examples/example1.html">example</a> looks like it can do what you want. Assuming I am right in what you want. :) My understanding is you want to keep track of how much interest you pay over time or something like that, so this should work okay.
It looks like he uses that data array to store each point of the graph (I think it's a parabola):
for(i=j=0; i<np; i++,j+=2) {
data[j] = j-np;
data[j+1] = 60000 * Math.pow( ((double)data[j]/(np-2) ), 2);
}
Sets those DataSet objects (data1 and data2) with the curve info here:
data1 = graph.loadDataSet(data,np);
(np is just the max size of the array, I don't know why he didn't declare it <b>final</b>)
And finally sets the axis with the DataSets and the graph names and units.
xaxis = graph.createAxis(Axis.BOTTOM);
xaxis.attachDataSet(data1);
xaxis.attachDataSet(data2);
.
.
.
Really the only thing you need to even touch is the part where he loads the data array with the data points he wants to graph. You should be able to do it pretty easily. I can't say I've done a lot with Applets (hopefully you have), so I don't know if any of that needs to be changed or if it will automatically pull up a browser and run the applet there. Sorry.
[edit]I don't know why this board won't display all the code. It keeps cutting off the for loop.[/edit]
The first <a href="http://www.sci.usq.edu.au/staff/leighb/graph/examples/example1.html">example</a> looks like it can do what you want. Assuming I am right in what you want. :) My understanding is you want to keep track of how much interest you pay over time or something like that, so this should work okay.
It looks like he uses that data array to store each point of the graph (I think it's a parabola):
for(i=j=0; i<np; i++,j+=2) {
data[j] = j-np;
data[j+1] = 60000 * Math.pow( ((double)data[j]/(np-2) ), 2);
}
Sets those DataSet objects (data1 and data2) with the curve info here:
data1 = graph.loadDataSet(data,np);
(np is just the max size of the array, I don't know why he didn't declare it <b>final</b>)
And finally sets the axis with the DataSets and the graph names and units.
xaxis = graph.createAxis(Axis.BOTTOM);
xaxis.attachDataSet(data1);
xaxis.attachDataSet(data2);
.
.
.
Really the only thing you need to even touch is the part where he loads the data array with the data points he wants to graph. You should be able to do it pretty easily. I can't say I've done a lot with Applets (hopefully you have), so I don't know if any of that needs to be changed or if it will automatically pull up a browser and run the applet there. Sorry.
[edit]I don't know why this board won't display all the code. It keeps cutting off the for loop.[/edit]