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 657908 - how to create personal palette for multicolors charts ?
how to create personal palette for multicolors charts ?
Status: RESOLVED FIXED
Product: libgoffice
Classification: Other
Component: Graphing / Charting
unspecified
Other All
: Normal enhancement
: ---
Assigned To: Jean Bréfort
Jody Goldberg
: 657910 657912 668342 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2011-09-01 09:22 UTC by olivir
Modified: 2012-11-05 14:00 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description olivir 2011-09-01 09:22:22 UTC
I know that I can use a personal default palette with a theme... but how to create a theme ?
Comment 1 Andreas J. Guelzow 2011-09-01 09:28:08 UTC
*** Bug 657910 has been marked as a duplicate of this bug. ***
Comment 2 Jean Bréfort 2011-09-01 11:09:10 UTC
Olivir, you'll find some documentation in the API documentation in this page: http://developer.gnome.org/goffice/unstable/GogTheme.html

Not sure anybody ever tried to write a theme (except me when I wrote the API). If I had some available time, I'd write a theme editor, but it's clearly not the case.
Comment 3 Morten Welinder 2011-09-01 12:49:30 UTC
*** Bug 657912 has been marked as a duplicate of this bug. ***
Comment 4 Andreas J. Guelzow 2011-10-04 17:54:20 UTC
This really belongs in goffice.
Comment 5 Andreas J. Guelzow 2012-10-03 18:40:06 UTC
*** Bug 668342 has been marked as a duplicate of this bug. ***
Comment 6 Frédéric Parrenin 2012-10-15 15:46:53 UTC
Regarding comment #11 of #668342, why ContourPlots do not use a continuous color scheme, as is done for XYColor plots?
I have never seen ContourPlots use a discrete color scheme in scientific publications, as is done in gnumeric.
(actually I got comments by my colleagues that my contour plots were not looking good...)
Comment 7 Jean Bréfort 2012-10-15 18:54:56 UTC
Contour plots were developed to be compatible with Excel. I intend to develop contour plots with continuous colors, but this is not that easy and will take some time.
Comment 8 Jean Bréfort 2012-10-28 17:04:42 UTC
Just introduced GogAxisColorMap to map a value to a color. Used by both XYColor plots and contour plots. Next step is custom color maps.
Comment 9 Frédéric Parrenin 2012-10-30 15:02:33 UTC
Dear Jean,
Thank you very much for your work on this.
3 additional comments:
- Currently, for XYColor plots, the color scale is not displayed anywhere, as it is done in XYZContour plots.
- I would suggest NOT to display the color scale in the legend (for both Contour and Color plots) since it is a plot-wide information which applies to all series. Instead, it should be plotted somewhere else.
- Actually, why XYColor and XYZContour plots are not the same plot? Both are 3D plots, and contours is just a kind of interpolation of the data, as lines are an interpolation of the data in XY plots. This way, it would be easy to move from a XYColor plot to an XYZContour plot and vice-versa.
Comment 10 Jean Bréfort 2012-10-30 20:02:32 UTC
Frédéric,

about the two first comments, I intend to display the color scale as a separate object (GogColorScale, already in the code, but not implemented yet). The legend might contain the colors or not, I'll add an option, mainly for compatibility (the default should be show the color if no other color scale is present, but not sure how this can be implemented).

XYColor and XYZContour are implemented in two different plugins, and that's why they are not in the same family. May be this will change in the future, since having a family with just one plot type is not ideal.
Comment 11 Jean Bréfort 2012-11-01 14:21:25 UTC
Color maps can be now changed for both XYColor and contour plots. For contour plots, the default map used in XYColor can now be used, the framework will interpolate colors as needed.

It is also possible to create a personal palette as an xml file in $HOME/.goffice/colormaps/. The file name has no importance. A simple map would be:

<?xml version="1.0" encoding="UTF-8"?>
<GogAxisColorMap>
  <name>G-Y-R</name>
  <color-stop bin="0" color="green"/>
  <color-stop bin="1" color="yellow"/>
  <color-stop bin="2" color="red"/>
</GogAxisColorMap>

You need a unique name, the bin values must be positive integers, and the first one must be 0. This is actually much easier than writing a theme by hand.

Next step is to save the map in the document so that the plot will have the same appearance everywhere even if the map is not installed locally. Next, I'll implement an user interface to edit maps for those who don't love text editors.
Comment 12 Frédéric Parrenin 2012-11-01 17:26:14 UTC
Hi Jean,
Thank you very much, this looks brilliant!
For the legend, after more thoughts it now seems to me that everything (both the series appearence and the color scale) should be plotted in the same box, otherwise the layout will be complicated.
Of course the color scale should appear only once (and not be attached to a particular serie), either before the series or after them.
Comment 13 Jean Bréfort 2012-11-01 17:48:56 UTC
Putting the color scale inside the legend is not possible. The layout would not be more simple actually because legend entries and a color scale (the rectangle with the colors and an attached axis) will have very different sizes. I think that the correct layout might be to have one displayed horizontally and the other one vertically.
Comment 14 Jean Bréfort 2012-11-03 16:30:50 UTC
I changed my mind a bit when playing with serialization. The GogAxisColorMap should have a unique Id, something like what the uuid command generates, or any string that has chances to be unique.
The sample should look like:

<?xml version="1.0" encoding="UTF-8"?>
<GogAxisColorMap id="9bdcd70a-25d3-11e2-9bd9-f741a006ff2a">
  <name>G-Y-R</name>
  <color-stop bin="0" color="green"/>
  <color-stop bin="1" color="yellow"/>
  <color-stop bin="2" color="red"/>
</GogAxisColorMap>
Comment 15 Jean Bréfort 2012-11-03 17:25:48 UTC
Color maps are now serialized.
Comment 16 Jean Bréfort 2012-11-04 17:32:49 UTC
It is now possible to create a new color map. I'll add a button to duplicate an existing color map, and, may be, one to modify a color map, but this seems a bit dangerous: if the id changes, the old one version might still be used in files, and if the id does not change, we have no API to update all graphs using it, so the change will only be taken into account after the graph is explicitly updated. Of course, it is possible to add a signal if really needed. The same will apply to themes.
Comment 17 Jean Bréfort 2012-11-05 14:00:22 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.

The only missing thing is edition of existing color maps. This has to be done using a text editor for now. I'll write a resource editor later for both color maps and themes.