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 552721 - barchart labelling problem
barchart labelling problem
Status: RESOLVED FIXED
Product: Gnumeric
Classification: Applications
Component: Charting
git master
Other Linux
: Normal normal
: ---
Assigned To: Emmanuel Pacaud
Jody Goldberg
Depends on:
Blocks:
 
 
Reported: 2008-09-18 03:32 UTC by Andreas J. Guelzow
Modified: 2009-01-09 15:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
sample gnumeric file (27.20 KB, application/octet-stream)
2008-09-18 03:34 UTC, Andreas J. Guelzow
  Details
uses the string as formatted in the cell (499 bytes, patch)
2008-11-22 15:20 UTC, Jean Bréfort
rejected Details | Review
a very simple patch (328 bytes, patch)
2009-01-09 08:02 UTC, Jean Bréfort
rejected Details | Review

Description Andreas J. Guelzow 2008-09-18 03:32:36 UTC
In the attached chart, the labels on the y-axis do not match the labels given by the data.
Comment 1 Andreas J. Guelzow 2008-09-18 03:34:05 UTC
Created attachment 118919 [details]
sample gnumeric file
Comment 2 Jean Bréfort 2008-09-18 08:40:38 UTC
The chart uses the format from the sheet, I also noticed that yesterday while playing with histograms. One way to fix that might be to derive DaoGODataVector from GnmGODataVector and override the preferred_fmt method. Or use GODataVectorVal instead.
Comment 3 Andreas J. Guelzow 2008-09-18 12:43:39 UTC
Jean you are saying that the "chart uses the format from the sheet", but it doesn't! The label on the sheet in E12 is "to below 2.5". In the chart (at least for me) it becomes "to below 2E+00".

In this case I would like it to use the "format from the sheet". (For the histogram chart created by the histogram tool I override the format since it picks a format fromt eh sheet that doesn't work wrll.)
Comment 4 Jean Bréfort 2008-09-18 13:27:02 UTC
Good point. The format used is the one returned by gnm_go_data_preferred_fmt which might be a bit different. That's part of the code I'm not familiar with.
Comment 5 Andreas J. Guelzow 2008-10-27 22:17:53 UTC
What makes this even worse is that it cannot be customized in the graph properties dialog.
Comment 6 Jean Bréfort 2008-11-22 12:50:04 UTC
It does use the cell format, just formating for axis labels is done with col_width=8. Using 12 makes things work apparently, at least with the sample file.
The relevant line is src/graph.c:656
		return format_value (format, v, NULL, 8, date_conv);

The issue is that we might end with too long labels in other cases.

Jody, any comment?
Comment 7 Andreas J. Guelzow 2008-11-22 13:27:56 UTC
I thin kwe shoulod either be using the string as it is formatted in the cells on the spreadsheet or (equivalently) format it using the cell (column) width from the sheet itself. That way the user can control the appearance of those labels. If they are to wide they can simply narrow the respective column.
Comment 8 Jean Bréfort 2008-11-22 15:06:20 UTC
The string as formatted in cell seems to not work (I supposed it should be stored in cell->rendered_value but this appears to be NULL when loading the file).
I was not able to find out how to get the cell width expressed in characters. Looks like it is stored in pixels/points. This is part of the code I'm not familiar with...
Comment 9 Jean Bréfort 2008-11-22 15:20:49 UTC
Created attachment 123215 [details] [review]
uses the string as formatted in the cell

It was not so difficult. I just learned a little more.
Comment 10 Morten Welinder 2008-11-26 14:45:59 UTC
This might cause you to see ##### when you don't want to.
Comment 11 Jean Bréfort 2008-11-26 14:49:00 UTC
I thought that too, but could not see it. Even if the column width is reduced to a few pixels.
Comment 12 Jean Bréfort 2009-01-07 10:14:04 UTC
Morten is right, and the ##### label fills the whole chart.
Comment 13 Jean Bréfort 2009-01-09 08:02:45 UTC
Created attachment 126087 [details] [review]
a very simple patch

Looks that this one works. We might end with some long labels in some rare cases.
Comment 14 Morten Welinder 2009-01-09 14:35:43 UTC
You could use -1 as column width.  That would produce the natural width.
Comment 15 Jean Bréfort 2009-01-09 15:47:06 UTC
Yes, - is better that . Done, fixed.