After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 588516 - SI/engineering prefixes in plots and formatting
SI/engineering prefixes in plots and formatting
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: General
1.9.x
Other All
: Normal enhancement
: ---
Assigned To: Jody Goldberg
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2009-07-14 06:48 UTC by Jason Heeris
Modified: 2011-09-01 06:11 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Goffice patch (8.17 KB, patch)
2011-02-10 18:23 UTC, Morten Welinder
none Details | Review

Description Jason Heeris 2009-07-14 06:48:00 UTC
It would be good if there were the ability to format numbers with engineering/SI prefixes + units for powers of ten (eg. 1e3 = k, 1e6 = M, 1e-3 = m) etc. This would be useful as both a spreadsheet formatting option and a chart axis marker option (similar to the scientific + engineering option).

More explicitly, if I have measurements of voltage vs. frequency, I would like the x-axis markers to be Hz, kHz, MHz, etc on a logarithmic plot.

See http://mail.gnome.org/archives/gnumeric-list/2009-July/msg00010.html
Comment 1 Morten Welinder 2011-02-08 21:20:56 UTC
This is an interesting concept and the format engine can probably be
goaded into doing this.  The plot axis would follow with no additional
work.  I think.

What should be done for weight?  The SI unit is "kg", i.e., it already
contains a prefix.  That is quite inconvenient as we generally have no
idea what unit we're dealing with.
Comment 2 Andreas J. Guelzow 2011-02-08 23:03:30 UTC
I am pretty sure that the SI unit for weight is "g" (gram).
Comment 3 Andreas J. Guelzow 2011-02-08 23:06:07 UTC
I guess I was mistaken:
"It is important to note that the kilogram is the only SI unit with a prefix as part of its name and symbol. Because multiple prefixes may not be used, in the case of the kilogram the prefix names of Table 5 are used with the unit name "gram" and the prefix symbols are used with the unit symbol "g." With this exception, any SI prefix may be used with any SI unit, including the degree Celsius and its symbol °C."

But of course that should not be an issue. We can behave as if "g" is the unit for mass.
Comment 4 Jason Heeris 2011-02-09 01:01:04 UTC
> But of course that should not be an issue. We can behave as if "g" is the
> unit for mass.

That's what I'd suggest.

I ended up implementing a similar thing in Matplotlib, and this post might have some details that help (in Python, but still):

http://www.mail-archive.com/matplotlib-users@lists.sourceforge.net/msg14433.html

Note that it was tweaked a bit by others before ending up in their code base.
Comment 5 Morten Welinder 2011-02-09 13:55:41 UTC
> But of course that should not be an issue. We can behave as if "g" is the unit
> for mass.

I strongly disagree.

One of the major points of the SI *system* is that the units are scaled
properly with respect to each other.  Example: what is the force needed
to accelerate 5kg by 4m/s^2?  Answer: 20N (aka 20 kg m/s^2).

We need the number 5 to show as "5 kg" and the 4 to show as "4 m/s^2"
so the cell with the product can show as "20 N".  If we need to have
5000 in order to get "5 kg", the whole benefit goes out the window.
Comment 6 Morten Welinder 2011-02-10 18:23:00 UTC
Created attachment 180611 [details] [review]
Goffice patch

This patch introduces a new format syntax.  There is no GUI support at
the moment (and getting to that point will require goffice branching).

For values like length, a format of ##0.00EEE+00"m" can be used.
It'll produce 123.45nm or 12.35km

The tripple-E is an extension of Excel's format.

For values like weight, a format of ##0.00'EEE+00"g" can be used.
A value of 1 will produce "1.00kg".

The single quote is an extension that scales the input number up by 1000 in
the same way that the existing (but buggy and locale dependent) comma scales
it down by 1000.  Multiple quotes or commas may be used as appropriate for
units involving powers of "kg".

The format ignores SI prefixes that are not a power of 10^3, e.g., "c".

For exponents outside -24 to 24, this reverts to regular engineering
notation.  Slightly surprising is that this means that 1e50 will show
as "100.00E50g" in the weight case.  Most people would probably have
preferred "100.00E48kg".

This still leaves the open question of whether all this is a good idea.
Comment 7 Andreas J. Guelzow 2011-08-31 17:40:24 UTC
I think we really should have the possibility to select markup and SI separately. While in the range of SI prefixes (and assuming engineering notation) they are indistinguishable, they differ for values outside the range.

So I propose ESI and EESI respectively.
Comment 8 Andreas J. Guelzow 2011-09-01 06:11:10 UTC
This problem has been fixed in the development version. The fix will be available in the next major software release. Thank you for your bug report.