PlotWithOverview reset zoom during redraw.

12 views
Skip to first unread message

Андрій Карп'як

unread,
Nov 18, 2015, 4:41:44 AM11/18/15
to GFlot General Discussion
Hello.

I have problem with PlotWithOverview  class when zooming.

Actually zooming work fine but after i call redraw zooming is lost.

My code is:

        PlotWithOverview plot;


        ... plot options:

        PlotWithOverviewModel plotModel = new PlotWithOverviewModel();

        final PlotOptions plotOptions = PlotOptions.create();
plotOptions.setGlobalSeriesOptions(GlobalSeriesOptions.create());
plotOptions.setLegendOptions(LegendOptions.create().setShow(false));

plot = new PlotWithOverview(plotModel, plotOptions);

plot.getOverviewOptions().getGlobalSeriesOptions().setShadowSize(0).getLineSeriesOptions().setFill(false);
plot.setWidth(800);
plot.setHeight(600);



        ... code responsible for zooming

private void zommYAxis(int delta) {
if (delta > 0) {
plot.getWindowPlot().zoom(Zoom.create().setAmount(delta));
plot.getOverviewPlot().zoom(Zoom.create().setAmount(delta));
} else {
plot.getWindowPlot().zoomOut(Zoom.create().setAmount(delta));
plot.getOverviewPlot().zoomOut(Zoom.create().setAmount(delta));
}
}



        ... some where later 
       
        plot.redraw();

I'm not sure if this is my fault and i forget call some hing or this is library issue.

Nicolas Morel

unread,
Nov 21, 2015, 9:23:59 AM11/21/15
to GFlot General Discussion
flot does not really have a redraw function. gflot tries to make one by recreating the plot entirely when calling the redraw method.
The calls to zoom or pan are made directly to flot and I have no idea where it stores the result.
So when you call redraw(), the plot is recreated with your base options.

You can try to call : 
plot.setupGrid();
plot.draw();
instead of redraw(). 

If you changed the datas, try :
plot.getPlot().setData( getSeries() );
plot.setupGrid();
plot.draw();

Or you can save all the calls to your method and replay them after a redraw...

Андрій Карп'як

unread,
Nov 23, 2015, 2:51:08 AM11/23/15
to GFlot General Discussion
Thx. For Your quick response.

--
You received this message because you are subscribed to a topic in the Google Groups "GFlot General Discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gflot/IFuYU4fL1f8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gflot+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages