miunsi63 / gflot

Automatically exported from code.google.com/p/gflot
0 stars 0 forks source link

redraw the whole data after zoom or pan #54

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. If I play zooming or panning I cannot find the way to display the whole time 
series as the beginning
2. There is no way to set a value to axes dynamicaly
3. There is no a fitData() or similar method

What is the expected output? What do you see instead?

If I clear the serie and redraw the plot with the same data, the plot doesn't 
fit the whole serie as it would be expected

What version of the product are you using? On what operating system?

gflot 2.4.1, Mac OSX 10.6

Please provide any additional information below.

Original issue reported on code.google.com by jordiv...@gmail.com on 3 Jul 2012 at 3:10

GoogleCodeExporter commented 9 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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
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

GoogleCodeExporter commented 9 years ago
added the methods to clear options

Original comment by nmr.morel on 28 Jul 2012 at 9:58

GoogleCodeExporter commented 9 years ago

Original comment by nmr.morel on 28 Jul 2012 at 10:00

GoogleCodeExporter commented 9 years ago
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