summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorKurt Nordback <kurt.nordback@protonmail.com>2023-11-18 19:43:52 -0700
committerNoel Grandin <noel.grandin@collabora.co.uk>2024-02-17 18:00:49 +0100
commit5d0093e8c3a862172ca96081d68e7757dfdf6067 (patch)
treed37202ed655c097195fe6a6cdfde753be27a4034 /chart2
parentb065496b23f249d9c08a6267d2aaa2fd1c81e56a (diff)
tdf#50934: Improvements to fill color for of-pie composite wedge
Change-Id: Ib9f7e3b135bb86e1817edf97b963e3620af7fdf2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/160730 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/view/charttypes/PieChart.cxx19
1 files changed, 12 insertions, 7 deletions
diff --git a/chart2/source/view/charttypes/PieChart.cxx b/chart2/source/view/charttypes/PieChart.cxx
index c3d36cd186fb..a946616ea5fe 100644
--- a/chart2/source/view/charttypes/PieChart.cxx
+++ b/chart2/source/view/charttypes/PieChart.cxx
@@ -227,7 +227,6 @@ PieChart::~PieChart()
void PieChart::setScales( std::vector< ExplicitScaleData >&& rScales, bool /* bSwapXAndYAxis */ )
{
OSL_ENSURE(m_nDimension<=static_cast<sal_Int32>(rScales.size()),"Dimension of Plotter does not fit two dimension of given scale sequence");
- m_aCartesianScales = m_pPosHelper->getScales();
m_aPosHelper.setScales( std::move(rScales), true );
}
@@ -1104,17 +1103,23 @@ void PieChart::createOneRing([[maybe_unused]]enum SubPieType eType,
xPointProperties, aParam, nRingPtCnt,
bConcentricExplosion);
+ // Handle coloring of the composite wedge
+ sal_Int32 nEnd = pDataSrc->getNPoints(pSeries, eType);
+ const sal_Int32 nPropIdx = (
+ eType == SubPieType::LEFT && nPointIndex == nEnd - 1 ?
+ pSeries->getTotalPointCount() :
+ nPointIndex);
///point color:
if (!pSeries->hasPointOwnColor(nPointIndex) && m_xColorScheme.is())
{
xPointShape->setPropertyValue("FillColor",
- uno::Any(m_xColorScheme->getColorByIndex( nPointIndex )));
+ uno::Any(m_xColorScheme->getColorByIndex( nPropIdx )));
}
if(bHasFillColorMapping)
{
- double nPropVal = pSeries->getValueByProperty(nPointIndex, "FillColor");
+ double nPropVal = pSeries->getValueByProperty(nPropIdx, "FillColor");
if(!std::isnan(nPropVal))
{
xPointShape->setPropertyValue("FillColor", uno::Any(static_cast<sal_Int32>( nPropVal)));
@@ -2106,16 +2111,16 @@ uno::Reference< beans::XPropertySet > OfPieDataSrc::getProps(
const VDataSeries* pSeries, sal_Int32 nPtIdx,
enum SubPieType eType) const
{
- const sal_Int32 n = pSeries->getTotalPointCount() - 3;
+ const sal_Int32 nPts = pSeries->getTotalPointCount();
+ const sal_Int32 n = nPts - 3;
if (eType == SubPieType::LEFT) {
// nPtIdx should be in [0, n]
if (nPtIdx < n) {
return pSeries->getPropertiesOfPoint( nPtIdx );
} else {
- assert(nPtIdx == n);
// The aggregated wedge
- // Not sure what to do here, but this isn't right. TODO
- return pSeries->getPropertiesOfPoint(n);
+ assert(nPtIdx == n);
+ return pSeries->getPropertiesOfPoint(nPts);
}
} else {
assert(eType == SubPieType::RIGHT);