I am trying to draw a bar chart that has an underlying time series
Code: Select all
private TimeSeriesCollection tsDataset = new TimeSeriesCollection();
private TimeSeries wv= new TimeSeries("wv");
private JFreeChart createChart() {
JFreeChart c = ChartFactory.createXYBarChart("X!", "Date", true,
"var", tsDataset, PlotOrientation.VERTICAL, true, true, false);
StandardXYToolTipGenerator ttG = new StandardXYToolTipGenerator(
StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
new SimpleDateFormat(), new DecimalFormat("0.00000"));
XYPlot plot = c.getXYPlot();
plot.getRenderer().setBaseToolTipGenerator(ttG);
((DateAxis) plot.getDomainAxis()).setTimeline(SegmentedTimeline
.newMondayThroughFridayTimeline());
tsDataset.addSeries(weekdayVolatility);
return c;
}
public void addAllWeekMap(TreeMap<Date, Double> map) {
for (Entry<Date, Double> e : map.entrySet()) {
Hour h = new Hour(e.getKey());
weekdayVolatility.add(new TimeSeriesDataItem(h,
e.getValue()));
}
Many thanks in advance
ID