Bug 72514

Summary: VaryColorsbyPoint changes legend colors, not point colors
Product: LibreOffice Reporter: Dorien James <bugzilla>
Component: ChartAssignee: Not Assigned <libreoffice-bugs>
Status: NEW --- QA Contact:
Severity: normal    
Priority: medium    
Version: 3.5.7.2 release   
Hardware: Other   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Simple scatter chart and macro to change value of VaryColorsbyPoint
Screenshot of the Basic macros dialog: only AttachLabelsToPoints and CreateChart.
VaryColors macro
Chart appearance before macro: VaryColorsbyPoint = FALSE
Chart appearance after macro: VaryColorsbyPoint = TRUE
Chart appearance after save, reopen and rerun
Finally: Chart appearance after reswitching VaryColorsbyPoint = FALSE
Updated version of VaryColorsbyPoint (includes VaryColors macro).

Description Dorien James 2013-12-09 11:18:37 UTC
Created attachment 90504 [details]
Simple scatter chart and macro to change value of VaryColorsbyPoint

The LibreOffice Calc spreadsheet contains a Scatter chart.  The BASIC macro VaryColors is used to turn the attribute DataSeries.VaryColorsbyPoint to TRUE.  This creates a legend where each point has a different color.  However, the points in the scatterchart are not recolored:  each retains the default color.

The expected behavior would be vary point colors so as to match the data points to the colors given in the legend.

UPDATE while recreating:  behavior is inconsistent.  Sometimes, cycling the VaryColorsbyPoints flag (edit VaryColors macro and rerun) will set the legend to a single color and the points to multiple colors; sometimes it will create the "correct" behavior of multiple matching colors for both legend and points.  I cannot isolate anything different between the different attempts.
Comment 1 Owen Genat 2013-12-10 00:21:27 UTC
Created attachment 90544 [details]
Screenshot of the Basic macros dialog: only AttachLabelsToPoints and CreateChart.

(In reply to comment #0)
> The BASIC macro VaryColors is used to turn the attribute 
> DataSeries.VaryColorsbyPoint to TRUE.

There does not appear to be a macro with this name or containing this string in the original attachment (refer screenshot). Can this please be confirmed? Was the correct example attached? 

Related information from ODF v1.2, Part 1, 11.13:

> The <chart:data-point> element specifies a style for a single data point in a data series. Note: This element can be used if a single data point has a special or distinct appearance.

To me, that implies the ability to edit data points individually. Currently the GUI facility only supports editing characteristics that apply to all data points. This may be a restriction based on the UNO API implementation, although this comment in:

http://opengrok.libreoffice.org/xref/core/offapi/com/sun/star/chart2/DataSeries.idl#159

> /** If `TRUE`, the data points of this series get different
>     colors by default, like in a pie chart.
>     */
> [optional, property] boolean                    VaryColorsByPoint;

... would seem to imply that each point in a series should receive a different colour.
Comment 2 Dorien James 2013-12-10 13:48:27 UTC
Created attachment 90578 [details]
VaryColors macro

Apologies, poor understanding/discipline on where to store macros.  I have (I hope) moved the macro from my Standard template into the .ods where it can be found in Standard\Modules\DorienCode.  I have also pasted separately pasted the code as a text attachment.
Comment 3 Dorien James 2013-12-10 13:53:17 UTC
Created attachment 90579 [details]
Chart appearance before macro: VaryColorsbyPoint = FALSE
Comment 4 Dorien James 2013-12-10 13:53:55 UTC
Created attachment 90580 [details]
Chart appearance after macro: VaryColorsbyPoint = TRUE
Comment 5 Dorien James 2013-12-10 14:03:05 UTC
Comment on attachment 90580 [details]
Chart appearance after macro: VaryColorsbyPoint = TRUE

Legend points show correct behaviour:  "different colors by default, like in a pie chart."
Chart points do not.
Comment 6 Dorien James 2013-12-10 14:24:51 UTC
Created attachment 90581 [details]
Chart appearance after save, reopen and rerun

I've now been able to reproduce further behaviour as follows:
1.  Open VaryPointsbyColor.ods
2.  Run VaryColors macro: chart appearance changes as shown in 90580
3.  Save and close the VaryPointsbyColor.ods
4.  Reopen VaryPointsbyColor.ods
5.  Run VaryColors macro:  chart displays correct appearance as shown here, with both legend and points showing various colors
Comment 7 Dorien James 2013-12-10 14:38:43 UTC
Created attachment 90584 [details]
Finally: Chart appearance after reswitching VaryColorsbyPoint = FALSE

Finally, edit the macro so that the final line reads:
'	Switch VaryColorsbyPoint flag
      oObj_5.VaryColorsbyPoint = False
and rerun.  Changes the chart appearance so that points are varied but legend is single-colour!

So in summary:
Action                Flag value       Point colours    Legend colours
------                ----------       -------------    --------------
Create chart          Presume false    Single           Single
Switch flag to True   True             Single           Multiple
Save doc and reload   Presume true     Single           Multiple
Rerun macro           True             Multiple         Multiple
Switch flag to False  False            Multiple         Single

Once the point colours have gone to "multiple", I cannot find any combination of saving, reopening and switching the flag which will revert them to single.  On the other hand, the legend colours reliably behave as expected.
Comment 8 Owen Genat 2014-07-28 14:34:18 UTC
Created attachment 103594 [details]
Updated version of VaryColorsbyPoint (includes VaryColors macro).

(In reply to comment #2)
> Apologies, poor understanding/discipline on where to store macros.  I have
> (I hope) moved the macro from my Standard template into the .ods where it
> can be found in Standard\Modules\DorienCode.  I have also pasted separately
> pasted the code as a text attachment.

Dorian, sorry I have not looked at this before now. I have edited a couple of the attachments to this report as the text of the macro attached in comment 2 did not replace the original document. I am now attaching a version of the original ODS with the VaryColors macro saved under Standard > Modules > Module1.

(In reply to comment #6)
> 1.  Open VaryPointsbyColor.ods
> 2.  Run VaryColors macro: chart appearance changes as shown in 90580
> 3.  Save and close the VaryPointsbyColor.ods
> 4.  Reopen VaryPointsbyColor.ods
> 5.  Run VaryColors macro:  chart displays correct appearance as shown here,
> with both legend and points showing various colors

Thanks for these helpful instructions. I can now confirm this result with the attached version of the file.
Comment 9 Owen Genat 2014-07-28 14:38:01 UTC
As per comment 8 confirmed. Status set to NEW.

(In reply to comment #8)
> Dorian, 

"Dorien" (sorry).

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.