Reputation: 1898
I want to dynamically update two separate series in a jfree chart histogram. When i look at HistogramDataset it doesn't seem like there is a method for that. Is this possible? I know it can be done in SimpleHistogramDataset but I need to have two series on this chart.
Upvotes: 0
Views: 493
Reputation: 205855
Some alternatives:
Replace the HistogramDataset
with each update:
chart.getXYPlot().setDataset(newDataset);
Add a second SimpleHistogramDataset
and XYItemRenderer
to the plot:
SimpleHistogramDataset newDataset = createDataset();
chart.getXYPlot().setDataset(1, newDataset);
XYItemRenderer renderer = new XYBarRenderer();
renderer.setBasePaint(Color.blue);
chart.getXYPlot().setRenderer(1, renderer);
Create a custom AbstractIntervalXYDataset
that supports mutation.
Upvotes: 2