From be936c5896045794b251a63ab1175ac06a36eee5 Mon Sep 17 00:00:00 2001 From: Tünde Tóth Date: Thu, 30 Jan 2020 14:22:51 +0100 Subject: tdf#130242 chart: default center label placement in stacked area charts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit instead of top label placement, like MSO does (or LO has already done in stacked bar charts) for readability. Change-Id: Icac6e8703d0d04122f9cc28254b053ee9fd434ec Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87846 Reviewed-by: László Németh Tested-by: László Németh --- chart2/source/tools/ChartTypeHelper.cxx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'chart2/source/tools') diff --git a/chart2/source/tools/ChartTypeHelper.cxx b/chart2/source/tools/ChartTypeHelper.cxx index b7b3e889e1a1..b54e410bcb73 100644 --- a/chart2/source/tools/ChartTypeHelper.cxx +++ b/chart2/source/tools/ChartTypeHelper.cxx @@ -314,10 +314,26 @@ uno::Sequence < sal_Int32 > ChartTypeHelper::getSupportedLabelPlacements( const } else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_AREA) ) { + bool bStacked = false; + { + uno::Reference xSeriesProp(xSeries, uno::UNO_QUERY); + chart2::StackingDirection eStacking = chart2::StackingDirection_NO_STACKING; + xSeriesProp->getPropertyValue("StackingDirection") >>= eStacking; + bStacked = (eStacking == chart2::StackingDirection_Y_STACKING); + } + aRet.realloc(2); sal_Int32* pSeq = aRet.getArray(); - *pSeq++ = css::chart::DataLabelPlacement::TOP; - *pSeq++ = css::chart::DataLabelPlacement::CENTER; + if (bStacked) + { + *pSeq++ = css::chart::DataLabelPlacement::CENTER; + *pSeq++ = css::chart::DataLabelPlacement::TOP; + } + else + { + *pSeq++ = css::chart::DataLabelPlacement::TOP; + *pSeq++ = css::chart::DataLabelPlacement::CENTER; + } } else if( aChartTypeName.match(CHART2_SERVICE_NAME_CHARTTYPE_NET) ) { -- cgit v1.2.3