diff options
author | Balazs Varga <balazs.varga991@gmail.com> | 2021-06-11 12:22:53 +0200 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2021-06-24 15:12:49 +0200 |
commit | 3af7001d0a04fdbcb38a35d0841d7d186beeb57f (patch) | |
tree | 7fd64fa1988503bb1a563ae89548cd323f9e1600 /chart2/source | |
parent | 8042e4f910bd9686f74e069e9978bfd47460c96f (diff) |
tdf#142793 chart UI: fix option "Secondary Y Axis" on sidebar
Attaching a data series to the secondary axis didn't enable
the secondary axis at the right side of the chart using the
sidebar (unlike in data series local menu -> Format Data
Series... -> Options).
Test: Click on the chart, select one of the data series, and
enable Data Series -> Align Series to Axis -> Secondary Y Axis.
Change-Id: I2cb99458af724471d4d04cac8c2c9013f41634fe
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117048
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'chart2/source')
-rw-r--r-- | chart2/source/controller/sidebar/ChartSeriesPanel.cxx | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx index 0550463e4d3c..4e48afa4ac41 100644 --- a/chart2/source/controller/sidebar/ChartSeriesPanel.cxx +++ b/chart2/source/controller/sidebar/ChartSeriesPanel.cxx @@ -34,9 +34,12 @@ #include <ChartController.hxx> #include <DataSeriesHelper.hxx> +#include <DiagramHelper.hxx> #include <RegressionCurveHelper.hxx> #include <StatisticsHelper.hxx> +#include <comphelper/processfactory.hxx> + using namespace css; using namespace css::uno; @@ -212,14 +215,14 @@ bool isPrimaryAxis(const css::uno::Reference<css::frame::XModel>& void setAttachedAxisType(const css::uno::Reference<css::frame::XModel>& xModel, const OUString& rCID, bool bPrimary) { - css::uno::Reference< css::beans::XPropertySet > xSeries( - ObjectIdentifier::getDataSeriesForCID(rCID, xModel), uno::UNO_QUERY ); + const uno::Reference<chart2::XDataSeries>& xDataSeries = ObjectIdentifier::getDataSeriesForCID(rCID, xModel); - if (!xSeries.is()) + if (!xDataSeries.is()) return; - sal_Int32 nIndex = bPrimary ? 0 : 1; - xSeries->setPropertyValue("AttachedAxisIndex", css::uno::Any(nIndex)); + uno::Reference<chart2::XChartDocument> xChartDoc(xModel, css::uno::UNO_QUERY); + uno::Reference<chart2::XDiagram> xDiagram = xChartDoc->getFirstDiagram(); + DiagramHelper::attachSeriesToAxis(bPrimary, xDataSeries, xDiagram, comphelper::getProcessComponentContext()); } css::uno::Reference<css::chart2::XChartType> getChartType( |