Bug 63421

Summary: An XDDFScatterChartData chart with a single series and default formatting has non-uniform formatting
Product: POI Reporter: David Gauntt <dmgauntt>
Component: XDDFAssignee: POI Developers List <dev>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P2    
Version: 4.0.x-dev   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description David Gauntt 2019-05-10 12:13:15 UTC
If an XDDFScatterChartData object is added to a worksheet, two data series are added to the scatter chart, and then one is removed using the new method "removeSeries", the appearance of the remaining series is different than if the removed series had never been added.

The JUnit test class attached to bug 63153 illustrates this bug.  When neither data series is removed, each series is displayed with a uniform line color, marker color, and marker shape.  When one data series is removed, the remaining series is displayed with multiple line colors, marker colors, and marker shapes.
Comment 1 David Gauntt 2019-05-11 13:26:08 UTC
You do not need to remove a series from a scatter chart to get the appearance described.  It appears that any single-series scatter chart with default formatting will be drawn with different line colors, marker colors, and marker shapes for each point.

If a second series is added, then the default formatting is what one would expect.  All of the points in a single series have the same line color, marker color, and line shape, and the colors and shapes of the two series are different.
Comment 2 David 2021-01-15 11:55:19 UTC
This problem can be solved disabling a color property: 

((XSSFChart)objChart).getCTChart().getPlotArea().getScatterChartArray(0)
	            .addNewVaryColors().setVal(false);
Comment 3 Alain Fagot Bearez 2021-01-19 04:12:27 UTC
Rather than using the low-level API calls as suggested in comment #2, the XDDFScatterChartData object also offers direct access to the method setVaryColors where you can disable the default behaviour.

Could you try in your code?

XDDFScatterChartData data = (XDDFScatterChartData) chart.createData(ChartTypes.SCATTER

data.setVaryColors(false)
Comment 4 David 2021-02-02 14:25:49 UTC
data.setVaryColors(false) also works fine.
Comment 5 Alain Fagot Bearez 2021-02-02 16:42:05 UTC
I will close this issue as the correct way to use the API is to define as false the attribute to vary colors.