I have similar problem.

On Dec 23 2011, 6:14 am, Vikas Yadav <[email protected]> wrote:
> Any one facing similar problem?
>
> On Dec 21, 1:19 pm, Vikas Yadav <[email protected]> wrote:
>
>
>
>
>
>
>
> > Hi all,
> > When I update ATL chart, it swaps legend items.
> > This problem is observed when we fixed chart flicker problem.
> > i.e. when we set following properties:
> > options.setDisplayAnnotations(false);
> > options.setAllowRedraw(true);
>
> > Attached sample code:
> > import java.util.Date;
> > import com.google.gwt.core.client.EntryPoint;
> > import com.google.gwt.event.dom.client.ClickEvent;
> > import com.google.gwt.event.dom.client.ClickHandler;
> > import com.google.gwt.user.client.Random;
> > import com.google.gwt.user.client.Timer;
> > import com.google.gwt.user.client.ui.Button;
> > import com.google.gwt.user.client.ui.RootPanel;
> > import com.google.gwt.user.client.ui.VerticalPanel;
> > import com.google.gwt.visualization.client.AbstractDataTable;
> > import com.google.gwt.visualization.client.DataTable;
> > import com.google.gwt.visualization.client.VisualizationUtils;
> > import
> > com.google.gwt.visualization.client.visualizations.AnnotatedTimeLine;
>
> > public class GxtSample implements EntryPoint
> > {
> >         private VerticalPanel chartPanel;
> >         private Timer timer;
> >         private DataTable chartData;
> >         private AnnotatedTimeLine.Options options;
> >         private AnnotatedTimeLine chart;
> >         private int count = 0;
> >         public void onModuleLoad()
> >         {
> >                 Runnable onLoadCallback = new Runnable()
> >                 {
> >                         public void run()
> >                         {
> >                                 chartPanel = new VerticalPanel();
> >                                 chartPanel.add(createChart());
>
> >                                 Button button = new Button("Start", new 
> > ClickHandler() {
> >                                         public void onClick(ClickEvent 
> > event) {
> >                                                 timer = new Timer() {
> >                                                         @Override
> >                                                         public void run() {
> >                                                                 
> > updateChart();
> >                                                         }
> >                                                 };
> >                                                 
> > timer.scheduleRepeating(1000);
> >                                         }
> >                     });
>
> >                                 VerticalPanel vPanel = new VerticalPanel();
> >                                 vPanel.add(button);
> >                                 vPanel.add(chartPanel);
> >                                 RootPanel.get().add(vPanel);
> >                         }
> >                 };
> >                 VisualizationUtils.loadVisualizationApi(onLoadCallback,
> > AnnotatedTimeLine.PACKAGE);
> >         }
>
> >         private void updateChart() {
> >                 chartData.insertRows(count, 1);
> >                 chartData.setValue(count, 0, new Date());
> >                 chartData.setValue(count, 1, Random.nextInt());
> >                 chartData.setValue(count, 2, Random.nextInt());
> >                 chart.draw(chartData, options);
> >                 count++;
> >         }
>
> >         private AnnotatedTimeLine createChart()
> >         {
> >                 chartData = DataTable.create();
> >                 chartData.addColumn(AbstractDataTable.ColumnType.DATE, 
> > "Date");
> >                 chartData.addColumn(AbstractDataTable.ColumnType.NUMBER, 
> > "column1");
> >                 chartData.addColumn(AbstractDataTable.ColumnType.NUMBER, 
> > "column2");
>
> >                 options = AnnotatedTimeLine.Options.create();
> >                 options.setDisplayAnnotations(false);
> >                 options.setDisplayZoomButtons(true);
> >                 options.setScaleType(AnnotatedTimeLine.ScaleType.ALLFIXED);
>
> > options.setLegendPosition(AnnotatedTimeLine.AnnotatedLegendPosition.SAME_RO 
> > W);
> >                 options.setAllowRedraw(true);
> >                 chart = new AnnotatedTimeLine(chartData, options, "600px", 
> > "200px");
> >                 return chart;
> >         }
>
> > }

-- 
You received this message because you are subscribed to the Google Groups 
"Google Visualization API" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-visualization-api?hl=en.

Reply via email to