summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2019-04-25 15:00:55 +0200
committerLászló Németh <nemeth@numbertext.org>2019-04-26 08:50:10 +0200
commit2ec293ab590c440fe7e36f5b7fcbef4cbfe5133c (patch)
tree333b6a0ec2ed003a1758113a642a591fa181e246 /chart2
parent92d7f55c1688295677519163cc8f94c6af52dc8e (diff)
tdf#124796 Fix chart primary Y axis scaling
Re-scale the primary Y axis if the secondary axis is deleted and the dataseries still attached to the secondary axis. Change-Id: I6e7958766d23a74569ce8529ddf1bdafa89f1870 Reviewed-on: https://gerrit.libreoffice.org/71302 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/view/main/ChartView.cxx18
1 files changed, 16 insertions, 2 deletions
diff --git a/chart2/source/view/main/ChartView.cxx b/chart2/source/view/main/ChartView.cxx
index 8b0548f909ee..d165ccb05251 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -441,6 +441,7 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
bool bConnectBars = false;
bool bGroupBarsPerAxis = true;
bool bIncludeHiddenCells = true;
+ bool bSecondaryYaxisVisible = true;
sal_Int32 nStartingAngle = 90;
sal_Int32 n3DRelativeHeight = 100;
try
@@ -479,7 +480,19 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
{
uno::Reference< XCoordinateSystem > xCooSys( aCooSysList[nCS] );
VCoordinateSystem* pVCooSys = addCooSysToList(m_rVCooSysList,xCooSys,rChartModel);
-
+ // Let's check whether the secondary Y axis is visible
+ try
+ {
+ Reference< beans::XPropertySet > xAxisProp(xCooSys->getAxisByDimension(1, 1), uno::UNO_QUERY);
+ if (xAxisProp.is())
+ {
+ xAxisProp->getPropertyValue("Show") >>= bSecondaryYaxisVisible;
+ }
+ }
+ catch (const lang::IndexOutOfBoundsException& e)
+ {
+ SAL_WARN("chart2", "Exception caught. " << e);
+ }
//iterate through all chart types in the current coordinate system
uno::Reference< XChartTypeContainer > xChartTypeContainer( xCooSys, uno::UNO_QUERY );
OSL_ASSERT( xChartTypeContainer.is());
@@ -563,7 +576,8 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(
//ignore secondary axis for charttypes that do not support them
if( pSeries->getAttachedAxisIndex() != MAIN_AXIS_INDEX &&
- !ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount ) )
+ ( !ChartTypeHelper::isSupportingSecondaryAxis( xChartType, nDimensionCount ) ||
+ !bSecondaryYaxisVisible ) )
{
pSeries->setAttachedAxisIndex(MAIN_AXIS_INDEX);
}