germaintanon / flot

Automatically exported from code.google.com/p/flot
MIT License
0 stars 0 forks source link

Resize canvas management #227

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Flot does not handle resize. 
It's interesting to add a function which take width and height as arguments
and resize the canvas.

Then we only need to catch a resize event, resizing the canvas.

Original issue reported on code.google.com by bernarde...@gmail.com on 29 Sep 2009 at 9:55

GoogleCodeExporter commented 8 years ago
I'm not at this point convinced it's necessary, but if you could supply a 
patch/some
thoughts/experiments, I could have a look.

Original comment by olau%iol...@gtempaccount.com on 21 Oct 2009 at 7:22

GoogleCodeExporter commented 8 years ago
I, too, would like to see support for resizing -- when I resize my pages in the 
browser (Safari, Firefox), all 
elements except the flot charts resize; the flot charts stay the same size.

Original comment by john%mai...@gtempaccount.com on 5 Nov 2009 at 5:07

GoogleCodeExporter commented 8 years ago
+1 We have an implementation where the flot graph is resized when other panels 
on the
page are opened or closed and this causes flot to misalign it's axis labels. 
Users
also tend to resize their browser windows when studying a graph and this again 
causes
strange behaviours in flot.

Original comment by rthijs...@gmail.com on 10 Nov 2009 at 3:57

GoogleCodeExporter commented 8 years ago
I am trying to add flot graphs to dhtmlx.com windows which are resizeable but 
as of
now I guess will have to make the graphs fixed sizes :(

Original comment by webadmi...@lineagepower.com on 16 Dec 2009 at 1:56

GoogleCodeExporter commented 8 years ago
We need chart resizing functionality as well.

Original comment by evge...@gmail.com on 27 Apr 2010 at 2:38

GoogleCodeExporter commented 8 years ago
It could be great differentiating feature!
Need this to eliminate error prone custom hooks.

Original comment by kleyme...@gmail.com on 11 May 2010 at 8:42

GoogleCodeExporter commented 8 years ago
i need resizing flot on a div
please, help me

Original comment by dpa...@gmail.com on 8 Jun 2010 at 6:29

GoogleCodeExporter commented 8 years ago
We need this for multiple projects. Right now we are having to alter the source 
code to account for this, but it would be nice to have it rolled into the 
release. Thanks.

Original comment by robertln...@gmail.com on 11 Jun 2010 at 4:25

GoogleCodeExporter commented 8 years ago
I've got resizing working 90% working by redraw the plot object during a window 
resize event. It works on a delay before redraw, which I don't like.... with 
out the delay the brower would crash from trying to redraw the plot graph too 
offen.

$(window).resize(function() {

            if(this.resizeTO) clearTimeout(this.resizeTO);
            this.resizeTO = setTimeout(function() {
                $(this).trigger('resizeEnd');
            }, 100);
        });
        $(window).bind('resizeEnd', function() {

             $(".Your plotLocation").trigger("redrawFlot")
             //your plot should have a .bind("redrawFlot") to listen to this trigger

        });

Original comment by GTheDest...@gmail.com on 18 Sep 2010 at 1:33

GoogleCodeExporter commented 8 years ago
Hi, there's actually a resize plugin in SVN now, it uses the same trick in 
comment #9. With that in mind, I'm going to close this bug now.

Regarding a function to set the canvas size, it turns out you can't easily do 
that without a replot because the whole state is whacked when you resize the 
canvas. So I don't think it would be terribly useful compared to what the 
resize plugin is doing - if you want more control over the size, you can just 
set the size of the placeholder anyway.

Original comment by olau%iol...@gtempaccount.com on 15 Mar 2011 at 7:38

GoogleCodeExporter commented 8 years ago
I have memory leak on resize plugin. (just use chrome to watch resize example 
you'll see)
So I use the method in #9 like this:

  $(window).resize(function() {
    if(this.resizeTO) clearTimeout(this.resizeTO);
    this.resizeTO = setTimeout(function() {
      $(this).trigger('resizeEnd');
    }, 100);
  });

  $(window).bind('resizeEnd', function() {
    if (plot) {
      plot.resize();
      plot.setupGrid();
      plot.draw();
    }
  });

Original comment by sot...@gmail.com on 8 Apr 2012 at 7:06