[Ccoptions-development] Altering graphs using controls
Status: Planning
Brought to you by:
csvgr
|
From: Daniel W. <d.r...@wa...> - 2003-09-16 17:49:11
|
This email is really to Peter but I thought I'd post to the list to keep
everyone informed.
Hi Peter,
I've been looking at the code you did to test the graphing and I've copied
it into a class for creating the inner frame holding a 'global temperature
rise' graph. I've tried to comment the code so I don't forget what it's
doing but there is some stuff I'm not sure about or don't understand at
all... Here is what I have written:
private void createGraph() {
// loads global CO2 data from the CSV file
CCDataSet pastworldco2 = new CCDataSet("co2", ".GLOBAL");
// revision point with 450 ppmv, start year of 2000, convergence year of
// 2040 and population cutoff of 2025
CCRevisionPoint revision = new CCRevisionPoint(450, 2000, 2040, 2025);
// presumably a model for the contraction using the given revision
CCContraction CCContraction1 = new CCContraction(pastworldco2,
revision);
// get the data from 1900 to 2200 at intervals of every two years.
CCDataSet ds = CCContraction1.model(1900, 2200, 2);
// graphing stuff
TimeSeriesCollection dataset = new TimeSeriesCollection();
// what is this? If it is co2 concentrations then what is the GLOBAL co2
stuff?
CCDataSet co2concs = new CCDataSet("global", "co2concs");
// what does the smoothed add?
CCDataSet smoothedco2concs = new CCDataSet("global",
"smoothedco2concs");
CCCo2Concentrations co2conc = new CCCo2Concentrations(co2concs, ds,
revision);
// CO2 concentrations from 1900 to 2200?
CCDataSet ds2 = co2conc.model(1900, 2200, 1);
// Using the predicted CO2, get the smoothed temperature model.
CCSmoothedTemp cct = new CCSmoothedTemp(ds2, smoothedco2concs);
// why does it all go so wonky if i set the temperature back to 1900?
// do we have any data on temperature rises in the past?
CCDataSet ds3 = cct.model(2000, 2200, 1);
TimeSeries s2 = ds3.toTimeSeries("Global Temperature Rise");
dataset.addSeries(s2);
dataset.setDomainIsPointsInTime(true);
dataset.setPosition(TimeSeriesCollection.MIDDLE);
JFreeChart chart = createChart(dataset,
"Predicted Global Temperate Rise");
ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));
chartPanel.setMouseZoomable(true, false);
getContentPane().add(chartPanel);
}
If you could reply with some examples of how the control could alter the
graph and correct my comments above then that would be very useful...
Cheers,
Dan.
|