Resetting zoomed chart

56 views
Skip to first unread message

michelem

unread,
Jan 8, 2008, 11:05:52 AM1/8/08
to Flot graphs
Hi,
is there a way to reset a zoomed chart without refreshing the page?

Ole Laursen

unread,
Jan 9, 2008, 5:38:35 AM1/9/08
to flot-...@googlegroups.com
On 1/8/08, michelem <miche...@gmail.com> wrote:
> is there a way to reset a zoomed chart without refreshing the page?

Did you try replotting it? You can call $.plot again on the same div
and with the same parameters, and it should wipe the old plot and put
in the new. I didn't put this in the example, but it's easy to do.

If you want zoom out functionality, you can maintain a stack of the
latest axis ranges and replot with the previous range settings each
time the user wants to zoom out. Or you could always zoom out by a
certain percentage.

There's no built-in helpers for this. Mostly because I haven't
experimented much with zooming out yet, so I'm not sure what's the
best approach. Busy schedule. :-)

--
Ole Laursen
http://www.iola.dk/

Iker

unread,
Jan 12, 2008, 10:12:27 AM1/12/08
to Flot graphs
Hi. I put a button in my page called 'Zoom 100%' and its
ID='zoomAllOut' in order to put the plot right how it was before with
this function:

$("#zoomAllOut").click(function () {
plot.setSelection({ y1: 0, y2: {y_max} });
});

where {y_max} it's the value of mine y-axix max 'cause I know the
value but if you don't know it, you can try just as OLE LAURSEN said
putting the plot function again in the Click function.

On Jan 9, 6:38 am, "Ole Laursen" <o...@iola.dk> wrote:
Reply all
Reply to author
Forward
0 new messages