Hi
i am spending a lot of time trying to use the combined plots. What i need is a chart with a XYplot (a pressure level) and 6 VerticalBar (state on/off for 6 compressors), to be updated after a new file is read.
I can see the plot but it is not updated. The data is read correctely (i can dump the new x/y values but the graph is not updated.
Where is my error?
Thank you for your help
neri alamanni
The piece of code handling the plot generation is the following:
----------------------------------------------------------------------------------
CombinedXYPlot plot = new CombinedXYPlot(new HorizontalDateAxis("time"), CombinedXYPlot.VERTICAL);
prdataset=create_dataset_pr(); // XYDataset with the pressure level
XYItemRenderer rend = new StandardXYItemRenderer();
rend.setToolTipGenerator(new TimeSeriesToolTipGenerator("d-MMM-yyyy","0.00"));
NumberAxis axis_pr_line = new VerticalNumberAxis("Press.");
axis_pr_line.setAutoRange(true);
XYPlot plot_pline = new XYPlot(prdataset,null, axis_pr_line, rend);
plot.add(plot_pline,3);
for (int i=0; i<prdataset.getItemCount(0); i++) // Debug data dump
{
frm_main.debug("X="+prdataset.getXValue(0,i)+"; Y="+prdataset.getYValue(0,i));
}
//
c1dataset = create_dataset_state(1); // IntervalXYDataset withState compr. #1
XYItemRenderer rend1 = new VerticalXYBarRenderer(0.20);
rend1.setToolTipGenerator(new TimeSeriesToolTipGenerator("d-MMM-yyyy","0.00"));
XYPlot plot_c1 = new XYPlot(c1dataset,null, new VerticalNumberAxis("C.1"), rend1);
plot.add(plot_c1,1);
//
c2dataset = create_dataset_state(2); // compr. #2
XYItemRenderer rend2 = new VerticalXYBarRenderer(0.20);
rend1.setToolTipGenerator(new TimeSeriesToolTipGenerator("d-MMM-yyyy","0.00"));
XYPlot plot_c2 = new XYPlot(c2dataset,null, new VerticalNumberAxis("C.2"), rend2);
plot.add(plot_c2,1);
//
c3dataset = create_dataset_state(3); // Compr. #3
XYItemRenderer rend3 = new VerticalXYBarRenderer(0.20);
rend3.setToolTipGenerator(new TimeSeriesToolTipGenerator("d-MMM-yyyy","0.00"));
XYPlot plot_c3 = new XYPlot(c3dataset,null, new VerticalNumberAxis("C.3"), rend3);
plot.add(plot_c3,1);
//
c4dataset = create_dataset_state(4); // Compr. #4
XYItemRenderer rend4 = new VerticalXYBarRenderer(0.20);
rend4.setToolTipGenerator(new TimeSeriesToolTipGenerator("d-MMM-yyyy","0.00"));
XYPlot plot_c4 = new XYPlot(c4dataset,null, new VerticalNumberAxis("C.4"), rend4);
plot.add(plot_c4,1);
//
c5dataset = create_dataset_state(5); // Compr. #5
XYItemRenderer rend5 = new VerticalXYBarRenderer(0.20);
rend5.setToolTipGenerator(new TimeSeriesToolTipGenerator("d-MMM-yyyy","0.00"));
XYPlot plot_c5 = new XYPlot(c5dataset,null, new VerticalNumberAxis("C.5"), rend5);
plot.add(plot_c5,1);
//
c6dataset = create_dataset_state(6); // Compr. #6
XYItemRenderer rend6 = new VerticalXYBarRenderer(0.20);
rend6.setToolTipGenerator(new TimeSeriesToolTipGenerator("d-MMM-yyyy","0.00"));
XYPlot plot_c6 = new XYPlot(c6dataset,null, new VerticalNumberAxis("C.6"), rend6);
plot.add(plot_c6,1);
combined_chart = new JFreeChart(lan.history_form, new Font("SansSerif", 1, 12), plot, true);
Problem with combined plots
Re: Problem with combined plots
Eureka
i solved the problem. My error was not using the .setDataset method to update every sub plot. I have a source code clarifying the solution. If everyone is interested please contact me on my e-mail
regards
neri alamanni
i solved the problem. My error was not using the .setDataset method to update every sub plot. I have a source code clarifying the solution. If everyone is interested please contact me on my e-mail
regards
neri alamanni