summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2022-08-13 23:29:01 +0200
committerTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2022-08-13 23:29:01 +0200
commit931b08e1de16fce0f01cc1177f6dd549cf230c5e (patch)
treecd9c9ee30e32cc193593585586be3cdc18bfd3b7
parenta7f001a09062b603012949ec6a191380f6ede726 (diff)
chart2: for a data table we need to force shift category positionfeature/chartdatatable
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
-rw-r--r--chart2/source/view/main/SeriesPlotterContainer.cxx6
-rw-r--r--chart2/source/view/main/SeriesPlotterContainer.hxx1
2 files changed, 7 insertions, 0 deletions
diff --git a/chart2/source/view/main/SeriesPlotterContainer.cxx b/chart2/source/view/main/SeriesPlotterContainer.cxx
index 1eb6a64a42c5..9f2e4fbaacfa 100644
--- a/chart2/source/view/main/SeriesPlotterContainer.cxx
+++ b/chart2/source/view/main/SeriesPlotterContainer.cxx
@@ -170,6 +170,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)
@@ -335,6 +338,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 e34d07a962ff..578f2ba2760c 100644
--- a/chart2/source/view/main/SeriesPlotterContainer.hxx
+++ b/chart2/source/view/main/SeriesPlotterContainer.hxx
@@ -151,6 +151,7 @@ private:
sal_Int32 m_nMaxAxisIndex;
bool m_bChartTypeUsesShiftedCategoryPositionPerDefault;
+ bool m_bForceShiftPosition = false;
sal_Int32 m_nDefaultDateNumberFormat;
};