diff --git a/DataPlotly/core/plot_settings.py b/DataPlotly/core/plot_settings.py index 064ddd70..e056e3fd 100644 --- a/DataPlotly/core/plot_settings.py +++ b/DataPlotly/core/plot_settings.py @@ -147,6 +147,9 @@ def __init__(self, plot_type: str = 'scatter', properties: dict = None, layout: 'pie_hole': 0, 'fill': False, 'line_combo_threshold': 'Dot Line', + 'font_plot_family': 'Arial', + 'font_plot_size': 10, + 'font_plot_color': '#000000', # Be consistent with the value of line_combo_threshold # since the value of 'line_dash_threshold is set from # the combo value diff --git a/DataPlotly/core/plot_types/pie.py b/DataPlotly/core/plot_types/pie.py index 88a04f74..3d29716b 100644 --- a/DataPlotly/core/plot_types/pie.py +++ b/DataPlotly/core/plot_types/pie.py @@ -39,7 +39,12 @@ def create_trace(settings): 'colors': settings.data_defined_colors if settings.data_defined_colors else [settings.properties['in_color']] }, name=settings.properties['custom'][0], - hole=settings.properties.get('pie_hole', 0) + hole=settings.properties.get('pie_hole', 0), + textfont={ + 'size': settings.properties.get('font_plot_size', 30), + 'color': settings.properties.get('font_plot_color', '#000000'), + 'family': settings.properties.get('font_plot_family', 'Arial') + } )] @staticmethod diff --git a/DataPlotly/gui/plot_settings_widget.py b/DataPlotly/gui/plot_settings_widget.py index 9fe83137..89d9ada0 100644 --- a/DataPlotly/gui/plot_settings_widget.py +++ b/DataPlotly/gui/plot_settings_widget.py @@ -58,7 +58,8 @@ QgsExpressionContextGenerator, QgsPropertyCollection, QgsLayoutItemRegistry, - QgsPropertyDefinition + QgsPropertyDefinition, + QgsTextFormat ) from qgis.gui import ( QgsPanelWidget, @@ -378,6 +379,9 @@ def __init__(self, mode=MODE_CANVAS, parent=None, override_iface=None, message_b self.font_ylabel_style.setCurrentFont(QFont('Arial', 10)) self.font_yticks_style.setCurrentFont(QFont('Arial', 10)) self.font_legend_style.setCurrentFont(QFont('Arial', 10)) + default_text_format = QgsTextFormat() + default_text_format.setFont(QFont('Arial', 10)) + self.font_plot_style.setTextFormat(default_text_format) # set range of axis min/max spin boxes self.x_axis_min.setRange(sys.float_info.max * -1, sys.float_info.max) @@ -1069,6 +1073,8 @@ def refreshWidgets(self): # pylint: disable=too-many-statements,too-many-branch self.violinBox: ['violin'], self.pie_hole_label : ['pie'], self.pie_hole : ['pie'], + self.font_plot_label: ['pie'], + self.font_plot_style: ['pie'], self.fill : ['radar'], self.threshold: ['radar'], self.threshold_value: ['radar'], @@ -1245,7 +1251,10 @@ def get_settings(self) -> PlotSettings: # pylint: disable=R0915 'threshold_value': self.threshold_value.value(), 'y_fields_combo': ', '.join(self.y_fields_combo.checkedItems()), 'connect_gaps': self.scatterline_gaps_check.isChecked(), - 'interpolation_shape': self.scatterline_interpolation_combo.currentData() + 'interpolation_shape': self.scatterline_interpolation_combo.currentData(), + 'font_plot_size': self.font_plot_style.textFormat().size(), + 'font_plot_family': self.font_plot_style.textFormat().font().family(), + 'font_plot_color': self.font_plot_style.textFormat().color().name() } if self.in_color_defined_button.isActive(): diff --git a/DataPlotly/ui/dataplotly_dockwidget_base.ui b/DataPlotly/ui/dataplotly_dockwidget_base.ui index c8f26fc6..50c551fb 100644 --- a/DataPlotly/ui/dataplotly_dockwidget_base.ui +++ b/DataPlotly/ui/dataplotly_dockwidget_base.ui @@ -321,8 +321,8 @@ QListWidget::item::selected { 0 0 - 666 - 1666 + 673 + 1493 @@ -358,7 +358,7 @@ QListWidget::item::selected { - + @@ -371,7 +371,7 @@ QListWidget::item::selected { - + @@ -381,7 +381,7 @@ QListWidget::item::selected { - + @@ -425,7 +425,7 @@ QListWidget::item::selected { - + @@ -800,7 +800,7 @@ QListWidget::item::selected { - + Qt::StrongFocus @@ -889,7 +889,7 @@ QListWidget::item::selected { 0 - + true @@ -955,7 +955,7 @@ QListWidget::item::selected { 0.000000000000000 - + false @@ -1012,8 +1012,8 @@ QListWidget::item::selected { 0 0 - 477 - 1043 + 488 + 951 @@ -1040,14 +1040,38 @@ QListWidget::item::selected { Layout Options - + false - - - - true + + + + Plot title + + + + + + + Y label + + + + + + + + + + ... + + + + + + + Plot label @@ -1100,148 +1124,6 @@ QListWidget::item::selected { - - - - Set Y Axis Bounds - - - true - - - false - - - - - - Minimum - - - - - - - - - - ... - - - - - - - Maximum - - - - - - - - - - ... - - - - - - - - - - X label - - - - - - - - - - - - - ... - - - - - - - Y label - - - - - - - ... - - - - - - - Invert Y axis - - - - - - - - - Y axis mode - - - - - - - - 0 - 0 - - - - - - - - - - - - - - - X axis mode - - - - - - - - 0 - 0 - - - - - - - - - - ... - - - @@ -1270,61 +1152,38 @@ QListWidget::item::selected { - - - - Bar mode - - - - - - - - - - 1.000000000000000 - - - 0.100000000000000 - - - - - - - - + + - Grid color + Invert Y axis - - - - Invert X axis + + + + true - - + + - Bar gap + Additional hover label - - + + - Plot title + Grid color - - + + - Additional hover label + Bar mode @@ -1336,8 +1195,8 @@ QListWidget::item::selected { false - - true + + false @@ -1386,39 +1245,19 @@ QListWidget::item::selected { - - - QgsFontButton::ModeQFont - - + - - - QgsFontButton::ModeQFont - - + - - - QgsFontButton::ModeQFont - - + - - - QgsFontButton::ModeQFont - - + - - - QgsFontButton::ModeQFont - - + @@ -1427,11 +1266,7 @@ QListWidget::item::selected { - - - QgsFontButton::ModeQFont - - + @@ -1445,6 +1280,116 @@ QListWidget::item::selected { + + + + + + + + + + + + + Bar gap + + + + + + + + + Y axis mode + + + + + + + + 0 + 0 + + + + + + + + + + Set Y Axis Bounds + + + true + + + false + + + + + + Minimum + + + + + + + + + + ... + + + + + + + Maximum + + + + + + + + + + ... + + + + + + + + + + Z label + + + + + + + + + + Invert X axis + + + + + + + X label + + + @@ -1455,13 +1400,54 @@ QListWidget::item::selected { - - + + - Z label + ... + + + + + + + + + X axis mode + + + + + + + + 0 + 0 + + + + + + + + + + ... + + + + + + + 1.000000000000000 + + + 0.100000000000000 + + +