GNOME Bugzilla – Bug 552721
barchart labelling problem
Last modified: 2009-01-09 15:47:06 UTC
In the attached chart, the labels on the y-axis do not match the labels given by the data.
Created attachment 118919 [details] sample gnumeric file
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.
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.)
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.
What makes this even worse is that it cannot be customized in the graph properties dialog.
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?
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.
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...
Created attachment 123215 [details] [review] uses the string as formatted in the cell It was not so difficult. I just learned a little more.
This might cause you to see ##### when you don't want to.
I thought that too, but could not see it. Even if the column width is reduced to a few pixels.
Morten is right, and the ##### label fills the whole chart.
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.
You could use -1 as column width. That would produce the natural width.
Yes, - is better that . Done, fixed.