How can I reset data source for AnnotatedTimeLine Chart?

Hi,

I am working on report which shows AnnotatedTimeLine chart (VisualizationForVaadin addon).

Report details :-

  1. First user enter start date and End date then press submit button.
  2. Now on submit I’m displaying an AnnotatedTimeLine chart for above given period.
    By range selector at the bottom of chart and zoom options user can also go through chart in detail.

Problem :- Now when user enter new start date and end date same AnnotatedTimeLine chart appear again

My Implementation :-

aTimeLineChart = new AnnotatedTimeLine();
//atl.setOption(“displayAnnotations”, true);

    aTimeLineChart.setWidth("800px");
    
    aTimeLineChart.addLineLabel("Line1");
    aTimeLineChart.addLineLabel("Line2");
    aTimeLineChart.addLineLabel("Line3");
    aTimeLineChart.addLineLabel("Line4");
    
	aTimeLineChart.setOption("legendPosition", "newRow");

for (MyBean bean : reportList) {

                    timeLineEntries.add(new AnnotatedTimeLineEntry(bean.getValue1(), "", ""));// Addressed
		timeLineEntries.add(new AnnotatedTimeLineEntry(bean.getValue2(), "", "")); // No Further Action
		timeLineEntries.add(new AnnotatedTimeLineEntry(bean.getValue3(), "", "")); // Viewed, No Response
		timeLineEntries.add(new AnnotatedTimeLineEntry(bean.getValue4(), "", "")); // Not Viewed
		
		GregorianCalendar gc =  new GregorianCalendar();
		gc.setTime(bean.getDate());

		aTimeLineChart.add(gc, timeLineEntries);

}

Could anybody suggest how can remove all data from AnnotatedTimeLine chart Indstance.

I’m searching google but no solution. google visulization has data table for all these purpose.

I have debugged AnnotatedTimeLine object it has table element which take care of all the data on the AnnotatedTimeLine chart.

But don’t know how can get it.

getData on AnnotatedTimeLine chart instance returned null.

Thanks
-Shyam

By spending some more time on it I found two solutions :-

  1. Create a custom AnnotatedTimeLine class (assume MyAnnotatedTimeLine) which will extends AnnotatedTimeLine.

class MyAnnotatedTimeLine extends AnnotatedTimeLine {
private ArrayList data;

public void setData(List data) {

this.data = data;

}

public void clear() {
if(data != null) {
for(AnnotatedTimeLineEntry entry : data) {
removeMatching(entry.getTitle(), 2)
}

}
}

  1. I’m adding AnnotatedTimeLine first on VerticalLayout then on main container.

If I take VerticalLayout instance at class object level then I can remove previous AnnotatedTimeLine component and add new AnnotatedTimeLine component with new data.

What you guys think which one is better 1) or 2). I think 2) as this required minimum efforts.

Thanks
-Shyam

then I can remove previous AnnotatedTimeLine component and add new AnnotatedTimeLine component with new data.

Dear, Shyam

Does your Chart blinks like no tomorrow when you add new AnnotatedTimeLine to panel? Your solution is a fun, but not applicable for real application usage other than a high-school summer break project.

Thanks.