Barchart plots only even values with Timeseries

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
jid1
Posts: 2
Joined: Fri Mar 02, 2012 11:51 am
antibot: No, of course not.

Barchart plots only even values with Timeseries

Post by jid1 » Fri Mar 02, 2012 7:49 pm

Hi,

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()));
		}
So when I call add with Dates that are 1 hour apart, it only shows 1,3,5....instead of 1,2,3. When I debug, the charts 'moves' on the first value and then a bar appears on the second add. Same goes for the rest add operations. Any ideas what's wrong?

Many thanks in advance
ID

Locked