chart2: say on the Data Range page which columns hold the dimensions

A correlation circle plot reads the ends of its range differently from every
other chart type: the last two columns are the dimensions its points are placed
against and the columns before them are the features. One range holds the lot,
so nothing about the entry gives that away, and a reader who does not already
know it has no way to work it out.

Display a information label under the range input saying the last two
columns of it are component dimensions and the columns before that are
features.

Change-Id: Ib7d27aad189f12be188f61b1fc317dd1e718b803
Signed-off-by: Dennis Francis <dennis.francis@collabora.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/8105
Tested-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
Reviewed-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com>
(cherry picked from commit 2cbf62e18df956ed23c77932cd5e38424e7baa1f)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/210470
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
This commit is contained in:
Dennis Francis
2026-09-04 15:05:11 +02:00
committed by Xisco Fauli
parent 4f8e7af1d8
commit ce823e1cc7
10 changed files with 59 additions and 0 deletions
+1
View File
@@ -27,6 +27,7 @@
#define STR_DLG_REMOVE_DATA_TABLE NC_("STR_DLG_REMOVE_DATA_TABLE", "This chart currently contains an internal data table. Do you want to proceed, deleting the internal data table, and set a new data range?")
#define STR_PAGE_CHARTTYPE NC_("STR_PAGE_CHARTTYPE", "Chart Type")
#define STR_PAGE_DATA_RANGE NC_("STR_PAGE_DATA_RANGE", "Data Range")
#define STR_RANGE_NOTE_DIMENSIONS NC_("STR_RANGE_NOTE_DIMENSIONS", "The last two columns hold the dimensions; the columns before them are the features.")
#define STR_PAGE_CHART_ELEMENTS NC_("STR_PAGE_CHART_ELEMENTS", "Chart Elements")
#define STR_OBJECT_AVERAGE_LINE_WITH_PARAMETERS NC_("STR_OBJECT_AVERAGE_LINE_WITH_PARAMETERS", "Mean value line with value %AVERAGE_VALUE and standard deviation %STD_DEVIATION")
#define STR_OBJECT_AXIS NC_("STR_OBJECT_AXIS", "Axis")
@@ -19,6 +19,8 @@
#include "tp_RangeChooser.hxx"
#include <DataSourceHelper.hxx>
#include <ResId.hxx>
#include <strings.hrc>
#include <ChartTypeTemplateProvider.hxx>
#include <ChartTypeTemplate.hxx>
#include "DialogModel.hxx"
@@ -63,6 +65,7 @@ RangeChooserTabPage::RangeChooserTabPage(weld::Container* pPage, weld::DialogCon
, m_xFT_Caption(m_xBuilder->weld_label(u"FT_CAPTION_FOR_WIZARD"_ustr))
, m_xED_Range(m_xBuilder->weld_entry(u"ED_RANGE"_ustr))
, m_xIB_Range(m_xBuilder->weld_button(u"IB_RANGE"_ustr))
, m_xFT_RangeNote(m_xBuilder->weld_label(u"FT_RANGE_NOTE"_ustr))
, m_xRB_Rows(m_xBuilder->weld_radio_button(u"RB_DATAROWS"_ustr))
, m_xRB_Columns(m_xBuilder->weld_radio_button(u"RB_DATACOLS"_ustr))
, m_xCB_FirstRowAsLabel(m_xBuilder->weld_check_button(u"CB_FIRST_ROW_ASLABELS"_ustr))
@@ -76,6 +79,7 @@ RangeChooserTabPage::RangeChooserTabPage(weld::Container* pPage, weld::DialogCon
, m_xEd_TimeEnd(m_xBuilder->weld_entry(u"ED_TIME_BASED_END"_ustr))
{
m_xFT_Caption->set_visible(!bHideDescription);
m_xFT_RangeNote->set_label(SchResId(STR_RANGE_NOTE_DIMENSIONS));
SetPageTitle(m_xFTTitle->get_label());// OH:remove later with dialog
@@ -141,6 +145,11 @@ void RangeChooserTabPage::initControlsFromModel()
m_xED_Range->set_text( m_aLastValidRangeString );
// Only a chart type that reads the ends of its range differently needs the
// note under the entry.
m_xFT_RangeNote->set_visible( m_xCurrentChartTypeTemplate.is()
&& m_xCurrentChartTypeTemplate->usesLastTwoColumnsAsDimensions() );
m_xRB_Rows->set_active( !bUseColumns );
m_xRB_Columns->set_active( bUseColumns );
@@ -85,6 +85,7 @@ private:
std::unique_ptr<weld::Label> m_xFT_Caption;
std::unique_ptr<weld::Entry> m_xED_Range;
std::unique_ptr<weld::Button> m_xIB_Range;
std::unique_ptr<weld::Label> m_xFT_RangeNote;
std::unique_ptr<weld::RadioButton> m_xRB_Rows;
std::unique_ptr<weld::RadioButton> m_xRB_Columns;
std::unique_ptr<weld::CheckButton> m_xCB_FirstRowAsLabel;
+7
View File
@@ -159,6 +159,13 @@ public:
virtual bool isSwapXAndY() const;
/** True for a template that reads the last two columns of its range as the
two dimensions its points are placed against, and every column before
them as one of the features. False for a template whose range reads the
way a reader expects without being told.
*/
virtual bool usesLastTwoColumnsAsDimensions() const;
// Methods for creating the diagram piecewise
/** Allows derived classes to manipulate the diagrams whole, like changing
@@ -489,6 +489,11 @@ bool ChartTypeTemplate::isSwapXAndY() const
return false;
}
bool ChartTypeTemplate::usesLastTwoColumnsAsDimensions() const
{
return false;
}
void ChartTypeTemplate::createCoordinateSystems(
const rtl::Reference< ::chart::Diagram > & xDiagram )
{
@@ -110,6 +110,8 @@ void CorrelationCircleChartTypeTemplate::adaptAxes(
sal_Bool CorrelationCircleChartTypeTemplate::supportsCategories() { return false; }
bool CorrelationCircleChartTypeTemplate::usesLastTwoColumnsAsDimensions() const { return true; }
void CorrelationCircleChartTypeTemplate::applyStyle2(const rtl::Reference<DataSeries>& xSeries,
::sal_Int32 nChartTypeIndex,
::sal_Int32 nSeriesIndex,
@@ -40,6 +40,7 @@ protected:
// ____ ChartTypeTemplate ____
virtual sal_Bool SAL_CALL supportsCategories() override;
virtual bool usesLastTwoColumnsAsDimensions() const override;
virtual rtl::Reference<::chart::ChartType>
getChartTypeForIndex(sal_Int32 nChartTypeIndex) override;
virtual rtl::Reference<::chart::ChartType> getChartTypeForNewSeries2(
+12
View File
@@ -94,6 +94,18 @@
<property name="top-attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="FT_RANGE_NOTE">
<property name="can_focus">False</property>
<property name="wrap">True</property>
<property name="xalign">0</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">2</property>
</packing>
</child>
</object>
<packing>
<property name="left-attach">0</property>
+20
View File
@@ -102,4 +102,24 @@ class correlationCircle(UITestCase):
# after any other edit.
xChartWindow.executeAction("TYPE", mkPropertyValues({"KEYCODE": "ESC"}))
# The note about the last two columns belongs to this chart type alone.
def test_the_note_is_shown_only_for_this_type(self):
with self.ui_test.create_doc_in_start_center("calc") as document:
self.fill_sheet(document)
with self.ui_test.execute_dialog_through_command(
".uno:InsertObjectChart", close_button="cancel") as xChartDlg:
select_chart_type(self, xChartDlg, "Bar")
xChartDlg.getChild("next").executeAction("CLICK", tuple())
self.assertEqual(
"false",
get_state_as_dict(xChartDlg.getChild("FT_RANGE_NOTE"))["Visible"])
xChartDlg.getChild("previous").executeAction("CLICK", tuple())
select_chart_type(self, xChartDlg, "Correlation Circle")
xChartDlg.getChild("next").executeAction("CLICK", tuple())
self.assertEqual(
"true",
get_state_as_dict(xChartDlg.getChild("FT_RANGE_NOTE"))["Visible"])
# vim: set shiftwidth=4 softtabstop=4 expandtab:
@@ -35,6 +35,7 @@ chart2/uiconfig/ui/tp_ErrorBars.ui://GtkLabel[@id='STR_DATA_SELECT_RANGE_FOR_NEG
chart2/uiconfig/ui/tp_ErrorBars.ui://GtkLabel[@id='STR_CONTROLTEXT_ERROR_BARS_FROM_DATA'] orphan-label
chart2/uiconfig/ui/tp_LegendPosition.ui://GtkLabel[@id='FT_LEGEND_TEXTDIR'] orphan-label
chart2/uiconfig/ui/tp_RangeChooser.ui://GtkLabel[@id='FT_CAPTION_FOR_WIZARD'] orphan-label
chart2/uiconfig/ui/tp_RangeChooser.ui://GtkLabel[@id='FT_RANGE_NOTE'] orphan-label
chart2/uiconfig/ui/tp_RangeChooser.ui://GtkLabel[@id='STR_PAGE_DATA_RANGE'] orphan-label
chart2/uiconfig/ui/tp_SeriesToAxis.ui://GtkLabel[@id='FT_MISSING_VALUES'] orphan-label
chart2/uiconfig/ui/tp_Scale.ui://GtkLabel[@id='TXT_STEP_MAIN'] orphan-label