summaryrefslogtreecommitdiff
path: root/chart2
diff options
context:
space:
mode:
authorBalazs Varga <balazs.varga991@gmail.com>2021-06-11 12:22:53 +0200
committerXisco Fauli <xiscofauli@libreoffice.org>2021-06-29 09:24:28 +0200
commit768acbf0e74dd93714a7e5421f3cff69a45de632 (patch)
tree677aff62c46e63981b5bcb3c2b8414cfce980e70 /chart2
parent06fc7bf582814be3529228cca340c40cf372792b (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> (cherry picked from commit 3af7001d0a04fdbcb38a35d0841d7d186beeb57f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117729 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'chart2')
-rw-r--r--chart2/source/controller/sidebar/ChartSeriesPanel.cxx13
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(