Open GoogleCodeExporter opened 8 years ago
Are we talking about logarithmic scales here? The automatic stuff in Flot can't
do it
at the moment, but it shouldn't be too hard to prescale the values and provide
ticks
yourself.
Original comment by olau%iol...@gtempaccount.com
on 11 Feb 2008 at 11:11
i've made a quick implementation of logarithmic scales on y axis
I'think that this match the requirements
I'm working on modified flot version downloaded from Issue #5
you can see the code in attach
to use logarithmic scale set yaxis:{logarithmicScale:true} in options
questions are welcome
Original comment by simonebe...@gmail.com
on 20 Aug 2008 at 3:34
Attachments:
Something happened with the attachment. Would you mind creating a patch against
SVN?
I'm curious as to how many lines of code this requires.
Original comment by olau%iol...@gtempaccount.com
on 10 Sep 2008 at 8:09
I cannot access SVN here, and in this moment it's hard to make a patch from a
very
modified version ..
btw logarithmic Yscale require 6 lines of code
first define option default value (line 47)
yaxis: {
autoscaleMargin: 0.02, logarithmicScale: false
},
then in processData (insert after line 262) prescale all values to log scale
if (options.yaxis.logarithmicScale&& y!=0)
data[j][1]=(y=Math.log(y)/Math.log(10));
finally as you said, provide a custom yaxis.tickFormatter (in parseOptions
before
line 150)
if (options.yaxis.logarithmicScale)
options.yaxis.tickFormatter=function(n, axis)
{return Math.pow(10,n).toFixed(axis.tickDecimals);}
Original comment by simonebe...@gmail.com
on 12 Sep 2008 at 2:03
I've just released version 0.5 so it should be easier now.
I think it makes sense to have logarithmic: null or number instead of just
true/false, otherwise I'm going to get spammed by people wanting to use log
base 2 or
log base e.
Note that the patch must be general enough to work with all four axes (actually
I
think this is pretty easy to do.
Original comment by olau%iol...@gtempaccount.com
on 25 Sep 2008 at 12:59
This is very good idea.
I'm looking forward to be included this patch into the main stream.
Original comment by tsuchimo...@gmail.com
on 29 Sep 2008 at 2:26
Hello,
I have added preliminary support for arbitrary bases in axes, you can find it
on my gitweb:
http://www.leto.net/gitweb/?p=flot.git;a=shortlog;h=refs/heads/leto
Or you can grab it on the command line with:
git clone http://leto.net/code/flot.git
Here is the example page that I added to the examples/ directory:
http://leto.net/plot/examples/logarithms.html
Any suggestions for improvement are welcome.
Cheers
Original comment by jal...@gmail.com
on 26 Nov 2008 at 8:57
Here is a patch for logarithmic bases against svn rev 131. Any comments for
refactoring and improvements are welcome.
Cheers
Original comment by jal...@gmail.com
on 22 Jan 2009 at 6:14
Attachments:
Hi, Correct me if I'm wrong, but I've been messing around with your examples
and
noticed that this doesn't account for zooming. Also, if using any type of
tooltip you
have to Math.pow(n, value) to get the actual value (which may lead to values
being
off). Is there any way around this? Specifically the zooming part.
Thanks
Ben
Original comment by ben.chy...@gmail.com
on 23 Jan 2009 at 3:58
Hi jaleto,
I've been using your mods from your git for weeks now and found them incredibly
useful. I did find one bug. A logarithmic data value <= 0 passes through the
code unscaled and is plotted at it's unscaled position. This
is a bug, since negative values will show up as some sort of positive value.
I've fixed so these values are
nulled out and attached a patch file. The patch file is diffed against the
already patched r131 version of
jquery.flot.js
Thanks!
Chris
Original comment by chris.le...@gmail.com
on 31 Jan 2009 at 1:18
Attachments:
Ben is totally correct, the way the patch works is to change the rendering of
the
ticks on each axis, but tooltips and zooming don't play nice yet. I am thinking
about
how to best deal with this.
Chris: Thanks for squashing that bug, I really need to write some tests! I will
incorporate your patch and submit a new patch to Ole.
Cheers
Original comment by jal...@gmail.com
on 31 Jan 2009 at 6:41
there's much more required to implement log scaling.
1. data has to be transformed in processData, but original data has to be
retained to
pass back when events are fired (plothover, plotclick, etc.) Just converting
to log
and then taking the exponent later is lossy so should not be done.
2. The axes have to be logscaled as well, however the ticks have to be
displayed in
the units of the original data
3. options.?axis.min and max have to be transformed
4. any ticks passed in by the caller have to be transformed
5. custom grid markers have to be transformed
I've done all of the above in a version of flot that I ported to YUI,
unfortunately,
I cannot provide a diff against the jQuery version because I don't use that
version,
but in general the changes are identical to the code above, just that you have
to
apply them to many more places.
Original comment by philip.t...@gmail.com
on 21 Feb 2009 at 3:45
FYI, the transform callback in Flot 0.6 should make this much, much easier. I
think
it would make sense to make a little plugin that wraps it up. We just need a
transform function, intelligent ticks and some error checking. Probably just a
question of porting the above patch.
Original comment by olau%iol...@gtempaccount.com
on 27 Oct 2009 at 3:06
pillip, can you pretty please port your log thing to jquery flot? It'll make
webnumbr.com that much cooler :)
Original comment by ptar...@gmail.com
on 3 Apr 2010 at 6:48
Sorry, my ignorance maybe, but I don't seem to get the transform callback
option to
work properly because I pass *all* my data in JSON. I mean, I can't explicitely
pass
xaxis: {
transform: function (v) { return Math.log(v); },
inverseTransform: function (v) { return Math.exp(v); }
}
but all I can pass to flot is
xaxis: {
transform: "function (v) { return Math.log(v); }",
inverseTransform: "function (v) { return Math.exp(v); }"
}
(unless I would add a layer when I import my JSON to "revive" the functions in
the
JSON, if any)
Or is there a logarithmic scale plugin available? (didn't find one under the
plugins
page).
[[and by the way I'm a huge fan of flot -- thanks for a very nice app]]
Original comment by paul.p...@gmail.com
on 7 Jun 2010 at 3:31
It it correct that zooming and tooltips are still problematic when using the
transform/inverseTransform functions?
I'm using a transform in order to display stock data over multiple weeks
(hiding the weekend days), but anything past the first weekend fails to render
when zoomed, and won't show tooltips on the datapoints.
Original comment by dmcoo...@gmail.com
on 30 Jun 2010 at 2:54
Hi,
One piece of data that I charted recently showed all the points on a Y scale of
about 0 to 50, but there is one point which hits 3000. Because of this, when I
look at the chart I cant really see the trends of most data because it gets
scaled down. Is there any way to have dynamic Y axis, where it would conform
evenly to 90% (or variable percentage) of data, and the rest to be shown out of
proportion. And the grid lines could change to reflect it.
Something like this:
http://www.jqplot.com/tests/logAxisTests.php
Your help much appreciated
Original comment by dusan.si...@gmail.com
on 7 Jan 2011 at 1:29
hi!
I've been struggling with log scales as well!
Actually, I'm really not an expert in javascript, I'm not even a professional
programmer, but I found flot as been so useful for my needs!
Would you please help me in fixing the crosshair/tooltip with log scale? I
think the visualization now is correct, but I can get the tooltip to catch the
points in the plot! What should I do?
PS: any other comment on my crappy code is expected :D
Thanks
Original comment by maurizio...@gmail.com
on 10 Feb 2011 at 10:56
Attachments:
The instructions on comment #15 works correctly (at least for y axis),
including zoom and pan using the navigation plugin, and with correct
informations form plothover/click events.
I haven't tested it on xaxis, cause i don't need a log-log plot, but only a
vertical log scale.
However, pay attention if your yaxis goes to 0, since log(0) is negative
infinity, it causes errors inside flot (it would be nice if flot could report
this errors, like invalid values returned from the transform function, instead
of simply forwarding the innermost canvas error, which does not say a lot).
I decided to return log(0.0001) for zero (it's more or less -10), and have no
data series that goes negative, so I don't handle them.
So, this works for me :
options.yaxis = {
transform: function (v) {
if (v == 0) v = 0.0001;
return Math.log(v);
},
inverseTransform: function (v) { return Math.exp(v); }
};
Original comment by simonegi...@gmail.com
on 14 Feb 2011 at 12:22
I read all the comments in this issue and i still cant draw log-log graph can
you provide me by example
why the transform functions wont be {
transform: function (v) {
Math.pow(10,v);
},
inverseTransform: function (v) { return Math.log(v)/Math.log(10); }
};
Original comment by Mostafa.Shokrof
on 9 Aug 2011 at 12:08
Wanted to follow up on this Enhancement request.
So far I've found that the modified code provided in the 2nd comment does it's
job well and have modified it myself a bit more in order to allow for both axis
to use the logarithmic scale as I need for both axis to use said scale.
Any chance this enhancement can be ported to the latest version?
The graph I'm working on can be found here http://irken.codebeta.net/plot.php
Original comment by lmuri...@codebeta.net
on 11 Mar 2012 at 9:00
Attachments:
Original comment by dnsch...@gmail.com
on 7 May 2012 at 5:52
The recent move of time-axis support into its own plugin is an excellent
example for a log-axis plugin.
Original comment by dnsch...@gmail.com
on 11 Jul 2012 at 1:29
Original issue reported on code.google.com by
ketan.kh...@gmail.com
on 10 Feb 2008 at 5:53