try {this.pieFrameList.remove(event.getChartName());} catch (Exception e) {}
}
private void addDataToHistogramChart(ChartEvent event, ParCollection params) {
// Histogram.
HistogramDataset dataset = this.histogramDataSet.get(event.getChartName());
JFreeChart chart = this.chartList.get(event.getChartName());
if (dataset == null) {
dataset = new HistogramDataset();
dataset.setType(event.getHistType());
dataset.addSeries(
event.getSeriesName(),
event.getHistogramValues(),
event.getHistogramBins(),
event.getHistogramMin(),
event.getHistogramMax());
chart = ChartFactory.createHistogram(
event.getChartName(),
event.getxAxisLabel(),
event.getyAxisLabel(),
dataset,
PlotOrientation.VERTICAL,
true,
true,
true);
createFrame(event.getChartName(), event.getChartType(), params, chart);
this.histogramDataSet.put(event.getChartName(), dataset);
this.chartList.put(event.getChartName(), chart);
}
if (!dataset.getType().equals(event.getHistType())) {
dataset.setType(event.getHistType());
}
if (this.containsSeriesHistogram(dataset, event.getSeriesName()) >= 0) {
/* Change existing series. This is done by awful reflections.
*/
try {
Field f = dataset.getClass().getDeclaredField("list"); //NoSuchFieldException
f.setAccessible(true);
@SuppressWarnings("unchecked")
List<Map<String, Object>> list = (List<Map<String, Object>>) f.get(dataset);
List<Map<String, Object>> list2 = new LinkedList<Map<String,Object>>();
Map<String, Object> removeMap = null;
for (Map<String, Object> map : list) {
String key = (String) map.get("key");
if (key != null && key.equals(event.getSeriesName())) {
removeMap = map;
}
}
list2.addAll(list);
list2.remove(removeMap);
this.addSeries(
list2,
event.getSeriesName(),
event.getHistogramValues(),
event.getHistogramBins(),
event.getHistogramMin(),
event.getHistogramMax());
f.set(dataset, list2);
} catch (Exception e) {
} finally {
dataset.setType(event.getHistType());
}
} else {
// Add new series.
dataset.addSeries(
event.getSeriesName(),
event.getHistogramValues(),
event.getHistogramBins(),
event.getHistogramMin(),
event.getHistogramMax());
dataset.setType(event.getHistType());
}
}