I did a Java application and need to add a graphics to that. I could do this, but I can only add a product (line) to each graph.
I wish I could add more.
Here is my code
String query="select date,price from produtcs where idProduct like 'Prod1'";
JDBCCategoryDataset dataset = new JDBCCategoryDataset (CriaConexao.getConexao(),query);
JFreeChart chart = ChartFactory.createLineChart(Record of Price", "Date", "Price", dataset, PlotOrientation.VERTICAL, false, true, true);
BarRenderer renderer = null;
CategoryPlot plot= null;
renderer=new BarRenderer();
ChartFrame frame = new ChartFrame("Record of Price", chart);
frame.setVisible(true);
frame.setSize(400,650);
Chart----
The record that show in chart---------
idProduct Date Price
Pro01 2014-05-29 19.1
Pro01 2014-05-29 18.8
Pro01 2014-05-29 18.7
Pro01 2014-05-29 18.9
Pro01 2014-05-29 18.7
Pro01 2014-05-29 18.5
The record that I want show in chart---------
idProduct Date Price
Pro01 2014-05-29 19.1
Pro01 2014-05-29 18.8
Pro02 2014-05-29 18.7
Pro02 2014-05-29 18.9
Pro03 2014-05-29 18.7
Pro03 2014-05-29 18.5
I try this query, but only show one line
String query="select date,price from produtcs where idProduct like 'Prod%'";
EDIT
I edit a new query:
SELECT p1.`Date`
, p1.`Price` as `Price of Prod01`
, p2.`Price` as `Price of Prod02`
, concat(p1.idProduct, ' / ', p2.idProduct) idProduct
FROM (SELECT idProduct, Date, Price
FROM products
WHERE idProduct LIKE 'Pro01') p1
LEFT JOIN (SELECT idProduct, Date, Price
FROM products
WHERE idProduct LIKE 'Pro02') p2
ON p1.Date = p2.Date
And the result is:
Date Price of Prod01 Price of Prod02 Products
2014-05-29 23.8 23.0 BrgTH001 / BrgTH002
2014-05-29 23.8 23.1 BrgTH001 / BrgTH002
2014-05-29 23.8 22.6 BrgTH001 / BrgTH002
2014-05-29 23.8 22.5 BrgTH001 / BrgTH002
2014-05-29 23.8 22.8 BrgTH001 / BrgTH002
2014-05-29 23.8 23.1 BrgTH001 / BrgTH002
But the result is one line again :S