Closed GoogleCodeExporter closed 8 years ago
Also I've tried to use something like:
plot.getPlotOptions().addYAxisOptions( new
AxisOptions().setMaximum(12).setMinimum(5));
plot.redraw()
and it doesn't work after an event. Only works at initWidget.
Original comment by jordiv...@gmail.com
on 3 Jul 2012 at 3:50
What you need is a way to reset the zoom and pan actions, right ?
After a few test, I noticed that the zoom and pan action only modify the min
and max option of the x and y axis. So you have to reset those values to null.
Your idea to do :
plot.getPlotOptions().addYAxisOptions( new
AxisOptions().setMaximum(12).setMinimum(5));
cannot work because you are adding options to a 2nd y axis. You have to modify
the current options of the axis with :
plot.getPlotOptions().getYAxisOptions();
But there is one problem, actually you can't reset an option :s There is no
clearMin() or clearMax() methods and the access to the underlying json object
is protected.
If it's not a problem for you to modify the source and use a custom jar, you
can add the methods like :
public T clearMax(){
getWrappedObj().put( MAX_KEY, JSONNull.getInstance() );
return (T) this;
}
And call :
plot.getPlotOptions().getXAxisOptions().clearMinimum().clearMax();
plot.getPlotOptions().getYAxisOptions().clearMinimum().clearMax();
plot.redraw();
If you can't, there is a 2nd option. Add a class in the same package as
JSONObjectWrapper (ca.nanometrics.gflot.client.util) that will give you access
to the json object :
public class JSONObjectWrapperAccess
{
public static void clearKey( String key, JSONObjectWrapper wrapper )
{
wrapper.getWrappedObj().put( key, JSONNull.getInstance() );
}
}
And call :
AbstractAxisOptions<?> xaxis = plot.getPlotOptions().getXAxisOptions();
JSONObjectWrapperAccess.clearKey( "min", xaxis );
JSONObjectWrapperAccess.clearKey( "max", xaxis );
AbstractAxisOptions<?> yaxis = plot.getPlotOptions().getYAxisOptions();
JSONObjectWrapperAccess.clearKey( "min", yaxis );
JSONObjectWrapperAccess.clearKey( "max", yaxis );
plot.redraw();
And of course there is a 3rd option, you can wait for a release with the clear
methods :p
Original comment by nmr.morel
on 3 Jul 2012 at 9:06
I know that this is not proper place to contact you guys (couldn't get your
emails neither) - but I see nobody responds to issue:
http://code.google.com/p/gflot/issues/detail?id=53
Could somebody give at least hint weather it could be done or is it maybe
future request or something? Any feedback is better than nothing.
Best regards.
Original comment by klemenzi...@gmail.com
on 5 Jul 2012 at 11:03
added the methods to clear options
Original comment by nmr.morel
on 28 Jul 2012 at 9:58
Original comment by nmr.morel
on 28 Jul 2012 at 10:00
I've seen the new clear methods in 2.4.3 release. Thank you very much :)
Original comment by jordiv...@gmail.com
on 9 Aug 2012 at 1:29
Original issue reported on code.google.com by
jordiv...@gmail.com
on 3 Jul 2012 at 3:10