devanshukumar / flot

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

Invert Axis #23

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Could you add in a value to invert whatever axis eg:

xaxis, yaxis: {
    invert: true
}

Original issue reported on code.google.com by chalk...@gmail.com on 22 Jan 2008 at 12:20

GoogleCodeExporter commented 8 years ago
I agree this would be very useful

Original comment by andrew.c...@gmail.com on 24 Feb 2008 at 10:25

GoogleCodeExporter commented 8 years ago
If anyone's up for a patch, I'm up for reviewing it.

Original comment by olau%iol...@gtempaccount.com on 18 Sep 2008 at 9:44

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
This patch allows to invert xaxis by defining xaxis { invert: true }

Original comment by eug...@gmail.com on 18 May 2009 at 10:19

Attachments:

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
This patch allows to invert axes by defining xaxis: { invert: true } or yaxis: {
invert: true }

Original comment by eug...@gmail.com on 20 May 2009 at 10:55

Attachments:

GoogleCodeExporter commented 8 years ago
Awesome!

Original comment by chalk...@gmail.com on 20 May 2009 at 11:04

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
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 smfmodd...@googlemail.com on 29 May 2009 at 4:53

GoogleCodeExporter commented 8 years ago
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 eug...@gmail.com on 29 May 2009 at 6:11

GoogleCodeExporter commented 8 years ago
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 smfmodd...@googlemail.com on 30 May 2009 at 1:17

GoogleCodeExporter commented 8 years ago
>> 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 eug...@gmail.com on 30 May 2009 at 9:51

GoogleCodeExporter commented 8 years ago
Works perfectly, thanks!

Original comment by smfmodd...@googlemail.com on 1 Jun 2009 at 12:56

GoogleCodeExporter commented 8 years ago
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%iol...@gtempaccount.com on 7 Oct 2009 at 4:45

GoogleCodeExporter commented 8 years ago
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 kari...@gmail.com on 16 Oct 2009 at 8:54

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
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 oska...@gmail.com on 9 Dec 2009 at 8:12

GoogleCodeExporter commented 8 years ago
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 acurt...@gmail.com on 11 Dec 2009 at 6:56

GoogleCodeExporter commented 8 years ago
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 guero....@gmail.com on 29 Jan 2010 at 10:05

GoogleCodeExporter commented 8 years ago
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 chage.j...@gmail.com on 23 Feb 2010 at 6:41

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Thanks chage.juan, patch workd nice

Original comment by dost...@gmail.com on 29 Apr 2010 at 11:35

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
@chage.juan > by applying your patch on 0.6, I get" $.plot is not a function" in
firebug. 
Any ideas?

Original comment by manny42@gmail.com on 5 May 2010 at 10:16

GoogleCodeExporter commented 8 years ago
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 chage.j...@gmail.com on 6 May 2010 at 3:54

Attachments:

GoogleCodeExporter commented 8 years ago
Yes, it works now with the new patch (sorry for the late confirmation :p)

Original comment by manny42@gmail.com on 9 Aug 2010 at 8:25

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
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 eazimo...@gmail.com on 28 Aug 2010 at 4:10

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
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 myc...@gmail.com on 29 Oct 2010 at 2:13

GoogleCodeExporter commented 8 years ago
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 omarci...@gmail.com on 5 Nov 2010 at 1:09

GoogleCodeExporter commented 8 years ago
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 myc...@gmail.com on 10 Nov 2010 at 10:55

Attachments:

GoogleCodeExporter commented 8 years ago
just genius....worked perfectly fine file attached on comment 25

thanks
ash at http://whitelogicsolutions.com

Original comment by urs.ash...@gmail.com on 3 Dec 2010 at 3:21

GoogleCodeExporter commented 8 years ago
@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 Kenneth....@gmail.com on 10 Mar 2011 at 3:24

GoogleCodeExporter commented 8 years ago
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%iol...@gtempaccount.com on 11 Mar 2011 at 9:27

GoogleCodeExporter commented 8 years ago

Original comment by dnsch...@gmail.com on 4 Jun 2012 at 2:52