Timeline first and last value

Hi,

When I display the population of Finland between 1900 and 2000 in a line graph, I notice that many people are born on Jan 1st 1900 and all people die on Dec 31st 1999.
How can I change that? I would prefer that the chart starts and ends with a 0 value only when the data source contains it.

Kind regards,
Roland

To me this sounds like a rendering bug, the graph should start at the value of the first point and end at the last point.

What browser are you using? Does it occur on other browsers?

Can you reproduce it with a small test application, if so please create
bug report
at http://dev.vaadin.com and include your test application.


import java.awt.Color;
import java.util.Date;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.vaadin.Application;
import com.vaadin.addon.timeline.Timeline;
import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.ui.Window;

@Component(value = "testApplication")
@Scope(value = "prototype")
@SuppressWarnings("serial")
public class TestApplication extends Application{
	private Window mainWindow = new Window("Tester");
	
	@Override
	public void init() {
		setTheme("reindeer");
    	mainWindow.setSizeFull();
    	mainWindow.getContent().setSizeFull();

        Timeline timeline = new Timeline("Test");
        timeline.setSizeFull();

        BeanItemContainer<TimelineBean> source1 = new BeanItemContainer<TimelineBean>(TimelineBean.class);
        long yesterday = new Date().getTime()-86400000;
        
        source1.addBean(new TimelineBean(new Date(yesterday), 100.0));
        source1.addBean(new TimelineBean(new Date(), 200.0));
 
	    //timeline.setGraphOutlineThickness(2.0);

        timeline.addGraphDataSource(source1, "timestamp", "value");
        timeline.setGraphLegend(source1, "Test");
		timeline.setGraphOutlineColor(source1, Color.GREEN);
	    timeline.setBrowserOutlineColor(source1, Color.GREEN);
        mainWindow.addComponent(timeline);
		setMainWindow(mainWindow);
	}
	
    public class TimelineBean {
        private Date timestamp;
        private Double value;

        public TimelineBean(Date timestamp, Double value) {
            this.timestamp = timestamp;
            this.value = value;
        }

        public Date getTimestamp() {
            return timestamp;
        }

        public Double getValue() {
            return value;
        }
    }

}

Thanks for mentioning other browsers. In IE 9.0 the chart does not show at all, only the dots (small squares)
In Firefox 7.0.1 and Chrome the chart appears as in the attached snapshot
11970.png

I tried to reproduce the problem using your application (without spring) and it renders fine for me at least on Firefox 7 and Chrome 14 using the latest Vaadin Timeline version. Didn’t try on IE yet, since I don’t currently have a Windows machine handy.

The IE9 issue indicates that you could be using an old version of the Vaadin Timeline that does not yet support IE9? What version of the Timeline are you using? Also could you make sure you have an up-to-date widgetset.

Thank you, John!

I had an old widgetset. Now everything works just fine

Good it solved it.

One thing you should look out for is that currently the Vaadin Timeline has problems with pre-epoch dates (see ticket
#6712
) since it currently uses the epoch time to render the graphs properly. So until that is fixed you might run into trouble implementing a date range from 1900->.