diff options
author | Tünde Tóth <tundeth@gmail.com> | 2020-06-23 13:52:39 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2020-06-29 12:04:52 +0200 |
commit | b3057b7944dc52cc2ee3c57f44d4265c625e8dad (patch) | |
tree | 4cc03bf04f0cd9188cababd3aafd8913334553bf /chart2/source/view/charttypes | |
parent | 9294b76982ef9d80c387afe109a3ec1c6c4da661 (diff) |
tdf#134247 Chart OOXML import: fix order of legend entries
The order of legend entries was reversed in stacked column,
line and area charts.
Change-Id: Ia4a439aa6cee0619ad323c3fb728ff358cf28537
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96941
Tested-by: Jenkins
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2/source/view/charttypes')
-rw-r--r-- | chart2/source/view/charttypes/VSeriesPlotter.cxx | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/chart2/source/view/charttypes/VSeriesPlotter.cxx b/chart2/source/view/charttypes/VSeriesPlotter.cxx index 19b43ae3d964..75a0ea173aba 100644 --- a/chart2/source/view/charttypes/VSeriesPlotter.cxx +++ b/chart2/source/view/charttypes/VSeriesPlotter.cxx @@ -2394,7 +2394,7 @@ bool VSeriesPlotter::shouldSnapRectToUsedArea() std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries( const awt::Size& rEntryKeyAspectRatio - , css::chart::ChartLegendExpansion eLegendExpansion + , LegendPosition eLegendPosition , const Reference< beans::XPropertySet >& xTextProperties , const Reference< drawing::XShapes >& xTarget , const Reference< lang::XMultiServiceFactory >& xShapeFactory @@ -2450,24 +2450,19 @@ std::vector< ViewLegendEntry > VSeriesPlotter::createLegendEntries( bBreak = true; bFirstSeries = false; - // add entries reverse if chart is stacked in y-direction and the legend is not wide. - // If the legend is wide and we have a stacked bar-chart the normal order + // add entries reverse if chart is stacked in y-direction and the legend position is right or left. + // If the legend is top or bottom and we have a stacked bar-chart the normal order // is the correct one, unless the chart type is horizontal bar-chart. bool bReverse = false; - if( eLegendExpansion != css::chart::ChartLegendExpansion_WIDE ) + if ( bSwapXAndY ) { StackingDirection eStackingDirection( pSeries->getStackingDirection() ); - bReverse = ( eStackingDirection == StackingDirection_Y_STACKING ); - - if( bSwapXAndY ) - { - bReverse = !bReverse; - } + bReverse = ( eStackingDirection != StackingDirection_Y_STACKING ); } - else if( bSwapXAndY ) + else if ( eLegendPosition == LegendPosition_LINE_START || eLegendPosition == LegendPosition_LINE_END ) { StackingDirection eStackingDirection( pSeries->getStackingDirection() ); - bReverse = ( eStackingDirection != StackingDirection_Y_STACKING ); + bReverse = ( eStackingDirection == StackingDirection_Y_STACKING ); } if (bReverse) |