diff options
author | Tünde Tóth <tundeth@gmail.com> | 2020-01-30 14:22:51 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-02-04 11:22:30 +0100 |
commit | be936c5896045794b251a63ab1175ac06a36eee5 (patch) | |
tree | ac242b1a15260538cf38f06399ffbdcea817b85a /chart2/source | |
parent | faeeef2e6ce378a9e8572b5034edc612dc6beabf (diff) |
tdf#130242 chart: default center label placement in stacked area charts
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 <nemeth@numbertext.org>
Tested-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2/source')
-rw-r--r-- | chart2/source/tools/ChartTypeHelper.cxx | 20 |
1 files changed, 18 insertions, 2 deletions
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<beans::XPropertySet> 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) ) { |