diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2022-08-13 23:29:01 +0200 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2022-08-25 07:28:50 +0200 |
commit | 073df6cd47f14f8401c158336b8440187008a9e6 (patch) | |
tree | 9b1853a8e000a8d2b61974b583ea86fa1c6dfbda /chart2 | |
parent | 387e01bb088c958a4dbc3eec5bb98bf655b48ccb (diff) |
chart2: for a data table we need to force shift category position
To be able to show the data table correctly we need to always
show the categories "between tick marks" as otherwise the table
columns wouldn't align correctly. This forces that the shift
position is always enabled.
Change-Id: Ia6a627931fcaba64f0f974faf1d8763405ad410d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138337
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
(cherry picked from commit d50bfb406900ddea3a4b2e0c59e0b983798780d4)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138784
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/view/main/SeriesPlotterContainer.cxx | 6 | ||||
-rw-r--r-- | chart2/source/view/main/SeriesPlotterContainer.hxx | 1 |
2 files changed, 7 insertions, 0 deletions
diff --git a/chart2/source/view/main/SeriesPlotterContainer.cxx b/chart2/source/view/main/SeriesPlotterContainer.cxx index b72d2f1bba42..ca1044d11046 100644 --- a/chart2/source/view/main/SeriesPlotterContainer.cxx +++ b/chart2/source/view/main/SeriesPlotterContainer.cxx @@ -167,6 +167,9 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(ChartModel& rChart DBG_UNHANDLED_EXCEPTION("chart2"); } + if (xDiagram->getDataTable().is()) + m_bForceShiftPosition = true; + //prepare for autoscaling and shape creation // - create plotter for charttypes (for each first scale group at each plotter, as they are independent) // - add series to plotter (thus each charttype can provide minimum and maximum values for autoscaling) @@ -354,6 +357,9 @@ void SeriesPlotterContainer::initializeCooSysAndSeriesPlotter(ChartModel& rChart bool SeriesPlotterContainer::isCategoryPositionShifted(const chart2::ScaleData& rSourceScale, bool bHasComplexCategories) { + if (m_bForceShiftPosition) + return true; + if (rSourceScale.AxisType == AxisType::CATEGORY) return bHasComplexCategories || rSourceScale.ShiftedCategoryPosition || m_bChartTypeUsesShiftedCategoryPositionPerDefault; diff --git a/chart2/source/view/main/SeriesPlotterContainer.hxx b/chart2/source/view/main/SeriesPlotterContainer.hxx index ccecac059027..64ab89583aee 100644 --- a/chart2/source/view/main/SeriesPlotterContainer.hxx +++ b/chart2/source/view/main/SeriesPlotterContainer.hxx @@ -156,6 +156,7 @@ private: sal_Int32 m_nMaxAxisIndex; bool m_bChartTypeUsesShiftedCategoryPositionPerDefault; + bool m_bForceShiftPosition = false; sal_Int32 m_nDefaultDateNumberFormat; }; |