yes, sure Java 2D API is great, but the goal is not to develop that (drawing, scaling, etc...) from the beginning but to use something like rrd to create graphics.
Did you try http://www.epic.noaa.gov/java/sgt/? Or may be some other libraries that can do all that?
Thanks in advance.
To whom it may be interest.
This is a small example to draw a chart having "values on X" and "values on Y" :-) using JFreeChart
import java.awt.Font;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import junit.framework.TestCase;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.chart.plot.XYPlot;
import org.jfree.chart.title.TextTitle;
import org.jfree.data.xy.XYDataset;
import org.jfree.data.xy.XYSeries;
import org.jfree.data.xy.XYSeriesCollection;
public class SimpleChartTest extends TestCase {
private XYSeriesCollection createDataset() {
XYSeriesCollection result = new XYSeriesCollection();
XYSeries s3 = new XYSeries("P", true, false);
s3.add(0, 2.355450986);
s3.add(0.5, 2.799548641);
s3.add(1.5, 3.614688072);
s3.add(11.5, 8.283364855);
s3.add(12.5, 8.534275028);
s3.add(13.5, 8.762648582);
s3.add(14.5, 8.971407287);
s3.add(15.5, 9.163180317);
s3.add(16.5, 9.340328068);
s3.add(17.5, 9.504964014);
s3.add(19.5, 9.804039109);
s3.add(20.5, 9.941644878);
result.addSeries(s3);
return result;
}
private JFreeChart createChart(XYDataset dataset) {
JFreeChart chart = ChartFactory.createXYLineChart(null,
"Value on X", "Value on Y", dataset, PlotOrientation.VERTICAL, true,
true, false);
TextTitle t1 = new TextTitle("Title1", new Font(
"SansSerif", Font.BOLD, 14));
TextTitle t2 = new TextTitle(
"Title2",
new Font("SansSerif", Font.PLAIN, 11));
chart.addSubtitle(t1);
chart.addSubtitle(t2);
XYPlot plot = chart.getXYPlot();
NumberAxis domainAxis = (NumberAxis) plot.getDomainAxis();
domainAxis.setUpperMargin(0.12);
domainAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());
NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();
rangeAxis.setAutoRangeIncludesZero(false);
return chart;
}
public void test() throws IOException {
XYSeriesCollection dataset = createDataset();
JFreeChart chart = createChart(dataset);
BufferedImage image = chart.createBufferedImage(360, 500);
File file = new File("test-data/charts/newimage.png");
ImageIO.write(image, "png", file);
}
}