I really like this charting package. One thing that
would make it even more useful to me would be to have
the option for each axis to be logarithmic instead of
Logged In: YES
Thanks for your compliment about the package.
What's the specification of such a thing?
The ticks on the axes would must continue to
be equally spaced, because that logic is pretty
deep. However, the labels could be numbered
differently and the data could be plotted
logarithmically to match. Would that work?
Submit some code that finds the logarithmic values
at equally spaced places along an axis beginning at
zero. Also, see if you can then make a function
that can be applied to a datum, that maps it to
its proper location (in pixels) along that same axis.
Example where T are ticks, 5 is the distance between each
tick (but you should generalize to N), the function is
is 2^(pixel/N) ?
T T T T T T
0 2 4 8 16 32
Jason J. Simas
BS Comp Sci & Philo
Logged In: YES
First thing to note is that a logarithmic scale will always
be greater than zero, so there will not be a "zero" tick
mark. Typically the tick marks will be 10^n, where 'n' is
some integer number. If n=-2, -1, 0, 1, 2, 3 then the tick
mark labels would be 0.01, 0.1, 1, 10, 100, 1000. These
tick marks would always be equally spaced.
In order to find a mapping for this scale remember that x' =
log(x) really means 10^x' = x. I'll try to write some code
that shows how this can be done for graphing...
Okay, as long as they are equally spaced. I'd prefer that
the axis could begin at zero, even if that value is
mathematically impossible. 0 is a good poing of reference.
Typically when graphing 10^x, the origin of the graph would
be zero regardless (i.e. in order to show its negative limit
when x goes to negative infinity).
I have attached a java source file demonstrating how to map
logarithmic values to an axis. Compile and run the file to
see how it handles values and then read the source comments
Thanks again for writing this package and considering my
Sample java source code
There are some weird formatting issues in the file I just
attached, but the code is still readible. I am now
attaching a sample graph created in Excel (ugh) that shows
the sample data from LogExample.java graphed on a log axis.
I think you will see in this graph why the zero axis should
not be included.
I ran your example, and if I add the feature, I'll
reference your code. However, I'd rather add the feature of
being able to define the axis by any suitable function
rather than just by logarithmic functions. This would
imply that at least initially (and for simplicity), the
reference value would be zero. I'll have to come up with
some intuitive scheme/property setting for defining the
function. It's a property of the "numbers axis".
Currently labels are calculated by finding the range of the
data and simply dividing the range by the number of
desired labels. Label i = i * (R / n) for i >= 0. That is
the stepping is equal. I guess the logic for logarithmic
axes is that the stepping is not equal. The stepping is
say 10^m * the previous stepping. So, I guess the property
setting could be
I think that I can use your example to help me figure out
how to find the actual stepping.
I know that it will be a function of the "function", the
range, and the desired number of labels. Anyway, there are
two ways to proceed here. You can add the specific feature
you want. For a small fee, I can tell you which code block
that you'll need to modify and describe the contents of the
variables to you such that modifying the code block is as
convenient as possible for you. Or you can sponsor the
development of the more general feature that I have been
describing. The respective costs are $30 and $100.
Thanks for your interest in Chart2D.
I mention a fee for adding this feature mostly because
otherwise I would not be adding this feature for some time.
If the development was sponsored, I probably could complete
it this week.
I am no hurry to get this feature implemented. Indeed I
have my own charting package that I could easily modify to
do log axies. However instead of thousands of separate
charting codes all trying to do the same thing I was hoping
to contribute to the development of a community codebase.
And I picked Chart2D because of the excellent work you have
I agree to the sum of $100, but for that kind of money I
propose the following "contract."
1. In order to facilitate the use of Chart2D in the
scientific community, API changes shall be made to allow
axies to be defined by arbitrary functions (as you discussed
below). Specifically, options will be provided that allow
the user or developer to easily select a logarithmic scale
for either chart axis.
2. Since for some types of axis (logarithmic) it is
impossible to graph the zero point, API changes shall be
made so that axies are defined by a reference value that
does not have to be zero. This would even allow regular
axis to show a range that does not necessarily include zero:
200 to 300, for example.
3. People or institutions who take time to submit code
changes and code examples shall be appropriately credited as
"Contributors" with a description of their contributions.
4. People or institutions who fund development of Chart2D
by contributing money shall be appropriately credited as
"Sponsors" with a description of the features they are
sponsoring and the amount of their contribution.
5. I would like to be listed as a "Contributor" for
submitting example code showing how to map a logarithmic
axis and also as a "Sponsor" for contributing $100 towards
the implementation of Chart2D features useful to the
6. Reasonable effort shall be made to implement these
chages within three months of receipt of payment.
7. The latest revision of Chart2D (source code) shall
always be easily and freely available to everyone under the
terms of the LGPL.
I think those terms for payment are fair and easy, but I'm
willing to hear your comments. It's exciting to think that
a freelance programming might actually get paid for doing
something fun -- I just wish it was me! ;-)
PS. For a logarithmic axis, the step between labels *is*
equal in one sense -- the power of ten changes by an equal
amount each time. For example: 10^0, 10^1, 10^2, 10^3,
etc.; or 10^-4, 10^-2, 10^0, 10^2, 10^4, etc.
Realize that $100 equates to one day of development. I
understand that you are not hurting for the feature, but
that is what I'm offering. It's one day of development to
take Chart2D in a direction that I wouldn't have otherwise
taken it. I don't know what's so amazing about an open
source programmer obtaining some funding for their project.
Half of Chart2D's development has been funded. They did
not wish to be publicly named so I haven't.
To this day, I have not received any contributions of code.
I do not consider your code a contribution. Your code is
not a patch that I can copy and paste into the library. In
fact it only accomplishes a small subset of the problem so
you should feel secure that I definitely will not be copying
it. I am not saying that you couldn't write such a patch,
I am just saying that you haven't.
Also, invested already in Chart2D is about $2000 + about
$2000 of my own time. Although every little bit helps,
your $100 is not incentive for me to guarantee that all
future versions of Chart2D will be open source. I am the
sole copyright owner of Chart2D. I am currently licensing
it for free, your $100 purchases the free Chart2D with the
special axis numbering for you and for everybody else for
the next release. That is a good price. There are no free
comparative packages, and I have yet to find a non-free
package with Chart2D's sizing and customization.
With my viewpoint vocalized, I can say that I am willing to
do 1, 4, 6, and maybe 2. 2 would be a piece of cake since
Chart2D already does this, but doing it in a way that you'd
be happy might take another complete day.
People have different viewpoints, and it appears that so do
we. I hope that you will not flame me for being open and
honest about mine.
Try as I might, the shoe just doesn't fit. Maybe we can try
again sometime under different circumstances.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.