I created a graph with a single line, with connection to the database as I show below.
I just used a dataset that returns the data of the query. I need to display more lines to create this thought in various datasets but don't know how can I implement it or even if it is possible.
I've seen examples of graph with multiple lines, but none helped me in what I wanted, which is to return values from the database.
String query="select date,tempfrom records where idSensor like 'Sensor1'";
JDBCCategoryDataset dataset = new JDBCCategoryDataset(CriaConexao.getConexao(),
query);
JFreeChart chart = ChartFactory.createLineChart("Records", "date", "temp",
dataset, PlotOrientation.VERTICAL, false, true, true);
BarRenderer renderer = null;
CategoryPlot plot= null;
renderer=new BarRenderer();
ChartFrame frame = new ChartFrame("Records", chart);
frame.setVisible(true);
frame.setSize(400,650);