Bug 63421 - An XDDFScatterChartData chart with a single series and default formatting has non-uniform formatting
Summary: An XDDFScatterChartData chart with a single series and default formatting has...
Status: RESOLVED WORKSFORME
Alias: None
Product: POI
Classification: Unclassified
Component: XDDF (show other bugs)
Version: 4.0.x-dev
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-10 12:13 UTC by David Gauntt
Modified: 2021-02-02 16:42 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.