Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions DataPlotly/core/plot_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ class PlotSettings: # pylint: disable=too-many-instance-attributes
PROPERTY_FONT_YTICKS_SIZE = 27
PROPERTY_FONT_YTICKS_FAMILY = 28
PROPERTY_FONT_YTICKS_COLOR = 29
PROPERTY_FONT_LEGEND_SIZE = 30
PROPERTY_FONT_LEGEND_FAMILY = 31
PROPERTY_FONT_LEGEND_COLOR = 32

DYNAMIC_PROPERTIES = {
PROPERTY_FILTER: QgsPropertyDefinition('filter', 'Feature filter', QgsPropertyDefinition.Boolean),
Expand All @@ -77,6 +80,9 @@ class PlotSettings: # pylint: disable=too-many-instance-attributes
PROPERTY_FONT_YTICKS_SIZE: QgsPropertyDefinition('font_yticks_size', 'Font yticks size', QgsPropertyDefinition.String),
PROPERTY_FONT_YTICKS_FAMILY: QgsPropertyDefinition('font_yticks_family', 'Font yticks family', QgsPropertyDefinition.String),
PROPERTY_FONT_YTICKS_COLOR: QgsPropertyDefinition('font_yticks_color', 'Font yticks color', QgsPropertyDefinition.ColorWithAlpha),
PROPERTY_FONT_LEGEND_SIZE: QgsPropertyDefinition('font_legend_size', 'Font yticks size', QgsPropertyDefinition.String),
PROPERTY_FONT_LEGEND_FAMILY: QgsPropertyDefinition('font_legend_family', 'Font yticks family', QgsPropertyDefinition.String),
PROPERTY_FONT_LEGEND_COLOR: QgsPropertyDefinition('font_legend_color', 'Font yticks color', QgsPropertyDefinition.ColorWithAlpha),
PROPERTY_X_TITLE: QgsPropertyDefinition('x_title', 'X title', QgsPropertyDefinition.String),
PROPERTY_Y_TITLE: QgsPropertyDefinition('y_title', 'Y title', QgsPropertyDefinition.String),
PROPERTY_Z_TITLE: QgsPropertyDefinition('z_title', 'Z title', QgsPropertyDefinition.String),
Expand Down Expand Up @@ -169,6 +175,9 @@ def __init__(self, plot_type: str = 'scatter', properties: dict = None, layout:
'font_yticks_size': 10,
'font_yticks_family': "Arial",
'font_yticks_color': "#000000",
'font_legend_size': 10,
'font_legend_family': "Arial",
'font_legend_color': "#000000",
'xaxis': None,
'bar_mode': None,
'x_type': None,
Expand Down
9 changes: 8 additions & 1 deletion DataPlotly/core/plot_types/plot_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,14 @@ def create_layout(settings):

layout = graph_objs.Layout(
showlegend=settings.layout['legend'],
legend={'orientation': settings.layout['legend_orientation']},
legend={'orientation': settings.layout['legend_orientation'],
'font': {
'size': settings.layout.get('font_legend_size', 10),
'color': settings.layout.get('font_legend_color', "#000"),
'family': settings.layout.get('font_legend_family', "Arial"),
}
},

title=title,
xaxis={
'title': {
Expand Down
17 changes: 16 additions & 1 deletion DataPlotly/core/plot_types/polar.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,20 @@ def create_layout(settings):
layout = super(PolarChartFactory, PolarChartFactory).create_layout(settings)

layout['polar'] = settings.layout['polar']

layout['polar'].update({
'radialaxis': {
'tickfont':{
"size": settings.layout.get('font_xticks_size',30),
"color": settings.layout.get('font_xticks_color',"#00000"),
"family": settings.layout.get('font_xticks_family', "Arial"),
}
},
'angularaxis':{
'tickfont':{
"size": settings.layout.get('font_yticks_size',30),
"color": settings.layout.get('font_yticks_color',"#00000"),
"family": settings.layout.get('font_yticks_family', "Arial")
}
}
})
return layout
39 changes: 27 additions & 12 deletions DataPlotly/gui/plot_settings_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,13 +323,15 @@ def __init__(self, mode=MODE_CANVAS, parent=None, override_iface=None, message_b
self.font_xticks_color.setColor(QColor('#000000'))
self.font_ylabel_color.setColor(QColor('#000000'))
self.font_yticks_color.setColor(QColor('#000000'))
self.font_legend_color.setColor(QColor('#000000'))

# default fonts
self.font_title_style.setCurrentFont(QFont('Arial', 10))
self.font_xlabel_style.setCurrentFont(QFont('Arial', 10))
self.font_xticks_style.setCurrentFont(QFont('Arial', 10))
self.font_ylabel_style.setCurrentFont(QFont('Arial', 10))
self.font_yticks_style.setCurrentFont(QFont('Arial', 10))
self.font_legend_style.setCurrentFont(QFont('Arial', 10))

# set range of axis min/max spin boxes
self.x_axis_min.setRange(sys.float_info.max * -1, sys.float_info.max)
Expand Down Expand Up @@ -929,20 +931,23 @@ def refreshWidgets(self): # pylint: disable=too-many-statements,too-many-branch
self.plot_title_line: ['all'],
self.plot_title_defined_button: ['all'],
self.font_title_label: ['all'],
self.font_xlabel_label: ['scatter', 'bar', 'box', 'pie', '2dhistogram','histogram', 'polar','ternary', 'contour', 'violin'],
self.font_xticks_label: ['all'],
self.font_ylabel_label: ['all'],
self.font_yticks_label: ['scatter', 'bar', 'box', 'pie', '2dhistogram','histogram', 'polar','ternary', 'contour', 'violin'],
self.font_xlabel_label: ['scatter', 'bar', 'box', 'histogram', '2dhistogram', 'violin'],
self.font_xticks_label: ['scatter', 'bar', 'box', 'histogram', '2dhistogram', 'polar','radar', 'violin'],
self.font_ylabel_label: ['scatter', 'bar', 'box', 'histogram', '2dhistogram', 'violin'],
self.font_yticks_label: ['scatter', 'bar', 'box', 'histogram', '2dhistogram', 'polar','radar', 'violin'],
self.font_legend_label: ['all'],
self.font_title_style: ['all'],
self.font_xlabel_style: ['scatter', 'bar', 'box', 'pie', '2dhistogram','histogram', 'polar','ternary', 'contour', 'violin'],
self.font_xticks_style: ['all'],
self.font_ylabel_style: ['all'],
self.font_yticks_style: ['scatter', 'bar', 'box', 'pie', '2dhistogram','histogram', 'polar','ternary', 'contour', 'violin'],
self.font_xlabel_style: ['scatter', 'bar', 'box', 'histogram', '2dhistogram', 'violin'],
self.font_xticks_style: ['scatter', 'bar', 'box', 'histogram', '2dhistogram', 'polar', 'radar', 'violin'],
self.font_ylabel_style: ['scatter', 'bar', 'box', 'histogram', '2dhistogram', 'violin'],
self.font_yticks_style: ['scatter', 'bar', 'box', 'histogram', '2dhistogram', 'polar','radar', 'violin'],
self.font_legend_style: ['all'],
self.font_title_color: ['all'],
self.font_xlabel_color: ['scatter', 'bar', 'box', 'pie', '2dhistogram','histogram', 'polar','ternary', 'contour', 'violin'],
self.font_xticks_color: ['all'],
self.font_ylabel_color: ['all'],
self.font_yticks_color: ['scatter', 'bar', 'box', 'pie', '2dhistogram','histogram', 'polar','ternary', 'contour', 'violin'],
self.font_xlabel_color: ['scatter', 'bar', 'box', 'histogram', '2dhistogram', 'violin'],
self.font_xticks_color: ['scatter', 'bar', 'box', 'histogram', '2dhistogram', 'polar','radar', 'violin'],
self.font_legend_color: ['all'],
self.font_ylabel_color: ['scatter', 'bar', 'box', 'histogram', '2dhistogram', 'violin'],
self.font_yticks_color: ['scatter', 'bar', 'box', 'histogram', '2dhistogram', 'polar','radar', 'violin'],
self.x_axis_label: ['scatter', 'bar', 'box', 'histogram', '2dhistogram', 'ternary', 'violin'],
self.x_axis_title: ['scatter', 'bar', 'box', 'histogram', '2dhistogram', 'ternary', 'violin'],
self.x_axis_title_defined_button: ['scatter', 'bar', 'box', 'histogram', '2dhistogram', 'ternary', 'violin'],
Expand Down Expand Up @@ -1197,6 +1202,11 @@ def get_settings(self) -> PlotSettings: # pylint: disable=R0915
self.font_yticks_style.currentFont().pointSize()),
'font_yticks_family': self.font_yticks_style.currentFont().family(),
'font_yticks_color': self.font_yticks_color.color().name(),
'font_legend_size': max(
self.font_legend_style.currentFont().pixelSize(),
self.font_legend_style.currentFont().pointSize()),
'font_legend_family': self.font_legend_style.currentFont().family(),
'font_legend_color': self.font_legend_color.color().name(),
'x_title': self.x_axis_title.text(),
'y_title': self.y_axis_title.text(),
'z_title': self.z_axis_title.text(),
Expand Down Expand Up @@ -1315,6 +1325,11 @@ def set_settings(self, settings: PlotSettings): # pylint: disable=too-many-stat
settings.layout.get('font_yticks_size', 10)))
self.font_yticks_color.setColor(
QColor(settings.layout.get('font_yticks_color', "#000000")))
self.font_legend_style.setCurrentFont(
QFont(settings.layout.get('font_legend_style', "Arial"),
settings.layout.get('font_legend_size', 10)))
self.font_legend_color.setColor(
QColor(settings.layout.get('font_legend_color', "#000000")))
self.font_ylabel_style.setCurrentFont(
QFont(settings.layout.get('font_ylabel_family', "Arial"),
settings.layout.get('font_ylabel_size', 10)))
Expand Down
17 changes: 17 additions & 0 deletions DataPlotly/ui/dataplotly_dockwidget_base.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1319,6 +1319,13 @@ QListWidget::item::selected {
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="font_legend_label">
<property name="text">
<string>Legend font</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="font_title_label">
<property name="text">
Expand Down Expand Up @@ -1350,6 +1357,13 @@ QListWidget::item::selected {
</property>
</widget>
</item>
<item row="7" column="2">
<widget class="QgsFontButton" name="font_legend_style">
<property name="mode">
<enum>QgsFontButton::ModeQFont</enum>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QgsFontButton" name="font_ylabel_style">
<property name="mode">
Expand All @@ -1367,6 +1381,9 @@ QListWidget::item::selected {
<item row="3" column="3">
<widget class="QgsColorButton" name="font_xlabel_color"/>
</item>
<item row="7" column="3">
<widget class="QgsColorButton" name="font_legend_color"/>
</item>
<item row="3" column="2">
<widget class="QgsFontButton" name="font_xlabel_style">
<property name="mode">
Expand Down
Loading