Coder Social home page Coder Social logo

Invert Axis about flot HOT 38 CLOSED

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
Invert Axis

from flot.

Comments (38)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
I agree this would be very useful

Original comment by [email protected] on 24 Feb 2008 at 10:25

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
If anyone's up for a patch, I'm up for reviewing it.

Original comment by olau%[email protected] on 18 Sep 2008 at 9:44

  • Added labels: Type-Enhancement
  • Removed labels: Type-Defect

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
[deleted comment]

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
This patch allows to invert xaxis by defining xaxis { invert: true }

Original comment by [email protected] on 18 May 2009 at 10:19

Attachments:

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
[deleted comment]

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
This patch allows to invert axes by defining xaxis: { invert: true } or yaxis: {
invert: true }

Original comment by [email protected] on 20 May 2009 at 10:55

Attachments:

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
Awesome!

Original comment by [email protected] on 20 May 2009 at 11:04

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
[deleted comment]

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
I could do with the inversion, how do I go about getting this? I can see a 
patch file
attached, but how would you apply that?

Thanks

Original comment by [email protected] on 29 May 2009 at 4:53

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
There are several ways
1. Manually. 
.patch file is the result of diff (http://en.wikipedia.org/wiki/Diff) utility 
and is
rather intuitive. + means that string after it should be inserted in appropriate
place, - means that string after it should be deleted. 

2. With patch utility
GNU/Linux commonly contains patch utility
(http://en.wikipedia.org/wiki/Patch_%28Unix%29) and it can be downloaded
(http://gnuwin32.sourceforge.net/packages/patch.htm) if you use Windows.
Using: patch originalfile -i patchfile.patch -o updatedfile

3. If you use TortoiseSVN you can use TortoiseSVN -> Apply patch... in the 
explorer's
context menu after clicking directory with flot files. Then appropriate patch  
can be
chosen and Patch all command from context menu can be used.

Original comment by [email protected] on 29 May 2009 at 6:11

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
Thanks. If doing manually, are the changes made to the latest public download? 
Also,
why are there two patch files on this thread? The difference is the second one 
allows
you to invert either axis?

Thanks again

Original comment by [email protected] on 30 May 2009 at 1:17

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
>> If doing manually, are the changes made to the latest public download? 
Yes. 
Anyway you can chose subversion repository item.
http://code.google.com/p/flot/source/browse/trunk/jquery.flot.js

>> Also, why are there two patch files on this thread? The difference is the 
second
one allows you to invert either axis?
Use the second one. It completely solves the problem. 

Original comment by [email protected] on 30 May 2009 at 9:51

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
Works perfectly, thanks!

Original comment by [email protected] on 1 Jun 2009 at 12:56

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
Hi, I would appreciate it if someone tried the new transform callback option on 
the
axes and see if it can do the trick. If so, it might be a question of patching
API.txt with an example.

Original comment by olau%[email protected] on 7 Oct 2009 at 4:45

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
With current flot version, this patch only works correctly if your chart's width
equals its height. Otherwise you need to set the 'SSSSSS' in the following line
according to the axis.
s = axis.scale = SSSSSS / (t(axis.max) - t(axis.min));

Original comment by [email protected] on 16 Oct 2009 at 8:54

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
[deleted comment]

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
Hi!
I want to draw chart with yaxis upside down (eg. 1 is the max value and 50 is 
the min
value). I was trying to use this patch and set
    yaxis: {  invert:true }
but this not working for me - the y axis don't change (only get little 'wider', 
but
nothing change). 
I was trying also option like that:
or setting
    yaxis: {  max:1, min:50 },
but this completely crashing the chart.
What should I do to get this option - I need in result something like that:
http://img691.imageshack.us/img691/4787/examplechart.jpg

Thanks in advance for your help,
Oskar

Original comment by [email protected] on 9 Dec 2009 at 8:12

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
Can someone provide some guidance as to how to make this work when using a 
non-square
chart, ie when height != width? I have hacked away at the scale logic but to no 
avail.

Thank you,
Aaron

Original comment by [email protected] on 11 Dec 2009 at 6:56

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
The path made by eugfed don't works in the new versions. I use on the r157 and 
works 
perfect.

http://flot.googlecode.com/svn-history/r157/trunk/jquery.flot.js

Original comment by [email protected] on 29 Jan 2010 at 10:05

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
I tried to patch the invert-axes.patch (made by eugfed) on the new version 
(0.6) of 
flot but failed. So I modify jquery.flot.js to fit the new version by eugfed's 
method.

Thank you, eugfed, your patch do help.

Here is my patch. (I hope this is correct patch format. ^^;)

Original comment by [email protected] on 23 Feb 2010 at 6:41

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
[deleted comment]

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
Thanks chage.juan, patch workd nice

Original comment by [email protected] on 29 Apr 2010 at 11:35

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
[deleted comment]

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
@chage.juan > by applying your patch on 0.6, I get" $.plot is not a function" in
firebug. 
Any ideas?

Original comment by [email protected] on 5 May 2010 at 10:16

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
Sorry guys. 
The patch file I posted before is wrong format.
This one should be correct.

Mehdi Sidhoum send me a mail to remind me this.
Thank him.

@manny42 > Please try the new one and tell me if this one is worked for you. :)

Original comment by [email protected] on 6 May 2010 at 3:54

Attachments:

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
Yes, it works now with the new patch (sorry for the late confirmation :p)

Original comment by [email protected] on 9 Aug 2010 at 8:25

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
[deleted comment]

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
[deleted comment]

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
last patch on this thread works fine, but it doesn't work well with zooming, 
I'm not sure how to fix this, any ideas?

Original comment by [email protected] on 28 Aug 2010 at 4:10

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
[deleted comment]

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
[deleted comment]

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
If you are binding on plotselected, make sure you switch the assignment for the 
new yaxis min and max (since they are being inverted)


    placeholder.bind("plotselected", function (event, ranges) {
        plot = $.plot(placeholder, data,
            $.extend(true, {}, options, 
                {
                    xaxis: { 
                        min: ranges.xaxis.from,
                        max: ranges.xaxis.to 
                    },
                    yaxis: { 
                        min: ranges.yaxis.to, 
                        max: ranges.yaxis.from 
                    }
                }
            ));

    });

Original comment by [email protected] on 29 Oct 2010 at 2:13

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
Hi. Thank you so much for the patch. It works great!

I would like to know if you're thinking about implement (a new patch..) the 
posibility of changing the width of the axes (x-axe)....

It's just to know...

so, thanks again for this increible library and of course, for the patch.

Greets!

Original comment by [email protected] on 5 Nov 2010 at 1:09

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
Here's a patch on flot0.6 r267
I noticed after migrating to r267, I no longer need to switch the to and from 
in the yaxis per my comment 32 on this issue.


Original comment by [email protected] on 10 Nov 2010 at 10:55

Attachments:

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
just genius....worked perfectly fine file attached on comment 25

thanks
ash at http://whitelogicsolutions.com

Original comment by [email protected] on 3 Dec 2010 at 3:21

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
@comment 34

Thanks worlds for those changes, but it only worked for me if I did NOT 
uncomment the last line (at least I think that's what the changes required). 
But I did get it working and thank you thank you thank you. 

Original comment by [email protected] on 10 Mar 2011 at 3:24

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024
Hi, people. I'm sorry for not responding before. I recently fixed issue 263, so 
that means you should now be able to invert the axis by using function (x) { 
return -x; } as the transform function for the axis. I've just tested it, and 
it seems to work fine. I've added an example to API.txt:

  yaxis: {
    transform: function (v) { return -v; },
    inverseTransform: function (v) { return -v; }
  }

With this in mind, I'm going to close this issue with a big thanks to everybody 
involved.

If you think this way is too much typing, I suggest somebody creates a little 
bundle as a plugin with some common types of transforms (inverse and 
logarithms) and posts it on the mailing list or the issue tracker.

Original comment by olau%[email protected] on 11 Mar 2011 at 9:27

  • Changed state: Done

from flot.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 29, 2024

Original comment by [email protected] on 4 Jun 2012 at 2:52

from flot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.