office-gobmx/chart2
Mike Kaganski 0c35808288 tdf#153706: do not add categories, when source data doesn't have them
lcl_AllOperator is used in XChartDocument::attachData implementation.
When a data without existing categories is passed there, like an XY
scatter, lcl_AllOperator used to force creation of the categories in
the target, by returning 'true' unconditionally from setsCategories.
This meant, that a new sequence of numbers starting from 1 was used
as X values, and the old X data was interpreted as an extra Y series.

This changes lcl_AllOperator::setsCategories to try to check if its
data actually contains categories. Thus, XChartDocument::attachData
will use categories either when the chart already uses categories,
and ChartDataWrapper::applyData detects that using a call to
DataSourceHelper::detectRangeSegmentation; or when the new data has
it; but not when neither had it. When it's not possible to detect if
there were categories in the new data (e.g., with user data), old
behavior is used, setting categories.

It could be an alternative to detect the chart type using
xOldDoc->getDiagram()->getDiagramType() == "com.sun.star.chart.XYDiagram"
in XChartDocument::attachData; and then decide to force the creation
or not. But it seems hackish, and not really universal: other chart
types must be tested (bubble?), no idea how to handle hypothetical
cases when applied data contains categories in case of XY chart, etc.

Change-Id: I86b34f6799c30b103f7fc6b2faf6ec255a9d137b
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164298
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
2024-03-03 17:22:08 +01:00
..
inc tdf#50934: Rudimentary UI images for pie-of-pie and bar-of-pie 2024-02-19 12:31:30 +01:00
qa tdf#153706: do not add categories, when source data doesn't have them 2024-03-03 17:22:08 +01:00
source tdf#153706: do not add categories, when source data doesn't have them 2024-03-03 17:22:08 +01:00
uiconfig
workbench/addin
AllLangMoTarget_chart.mk
CppunitTest_chart2_common_functors.mk
CppunitTest_chart2_dialogs_test.mk
CppunitTest_chart2_dump.mk
CppunitTest_chart2_export.mk
CppunitTest_chart2_export2.mk
CppunitTest_chart2_export3.mk
CppunitTest_chart2_geometry.mk
CppunitTest_chart2_import.mk
CppunitTest_chart2_import2.mk
CppunitTest_chart2_pivot_chart_test.mk
CppunitTest_chart2_trendcalculators.mk
CppunitTest_chart2_uichart.mk
CppunitTest_chart2_xshape.mk
export_setup.mk
import_setup.mk
IwyuFilter_chart2.yaml
JunitTest_chart2_unoapi.mk
Library_chartcontroller.mk
Library_chartcore.mk
Makefile
Module_chart2.mk
README.md
UIConfig_chart2.mk

Chart Implementation for LibreOffice Calc

The chart2 denotes a second generation re-write done to rid us of the foul and twisted legacy chart code.

Debugging

Shortcuts

CTRL + F12 creates a layout dump based on the XShapeDumper based on SAL_WARN("chart2", ...