Skip to content

Commit 90f78ac

Browse files
committed
Add plot_title_font_family and plot_title_font_size.
1 parent b7c8f2a commit 90f78ac

4 files changed

Lines changed: 10 additions & 1 deletion

File tree

docs/documentation/custom_styles.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Properties Description
5151
``value_label_font_family`` The ``print_labels`` font family
5252
``tooltip_font_family`` The tooltip font family
5353
``title_font_family`` The title font family
54+
``plot_title_font_family`` The main title font family
5455
``legend_font_family`` The legend font family
5556
``no_data_font_family`` The no data text font family
5657
``guide_stroke_dasharray`` The dasharray for guide line
@@ -61,6 +62,7 @@ Properties Description
6162
``value_label_font_size`` The ``print_labels`` font size
6263
``tooltip_font_size`` The tooltip font size
6364
``title_font_size`` The title font size
65+
``plot_title_font_size`` The main title font size
6466
``legend_font_size`` The legend font size
6567
``no_data_font_size`` The no data font size
6668
``opacity`` The opacity of chart element

pygal/css/base.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@
3333
font-size: {{ style.title_font_size }}px;
3434
}
3535

36+
{{ id }}.plot_title {
37+
font-family: {{ style.plot_title_font_family }};
38+
font-size: {{ style.plot_title_font_size }}px;
39+
}
40+
3641
{{ id }}.legends .legend text {
3742
font-family: {{ style.legend_font_family }};
3843
font-size: {{ style.legend_font_size }}px;

pygal/graph/graph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ def _make_title(self):
485485
'text',
486486
class_='title plot_title',
487487
x=self.width / 2,
488-
y=i * (self.style.title_font_size + self.spacing)
488+
y=i * (self.style.plot_title_font_size + self.spacing)
489489
).text = title_line
490490

491491
def _make_x_title(self):

pygal/style.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class Style(object):
4545
value_label_font_family = None
4646
tooltip_font_family = None
4747
title_font_family = None
48+
plot_title_font_family = None
4849
legend_font_family = None
4950
no_data_font_family = None
5051

@@ -54,6 +55,7 @@ class Style(object):
5455
value_label_font_size = 10
5556
tooltip_font_size = 14
5657
title_font_size = 16
58+
plot_title_font_size = 18
5759
legend_font_size = 14
5860
no_data_font_size = 64
5961

0 commit comments

Comments
 (0)