Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add plot_title_font_family and plot_title_font_size. #475

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions docs/documentation/custom_styles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Properties Description
``value_label_font_family`` The ``print_labels`` font family
``tooltip_font_family`` The tooltip font family
``title_font_family`` The title font family
``plot_title_font_family`` The main title font family
``legend_font_family`` The legend font family
``no_data_font_family`` The no data text font family
``guide_stroke_dasharray`` The dasharray for guide line
Expand All @@ -61,6 +62,7 @@ Properties Description
``value_label_font_size`` The ``print_labels`` font size
``tooltip_font_size`` The tooltip font size
``title_font_size`` The title font size
``plot_title_font_size`` The main title font size
``legend_font_size`` The legend font size
``no_data_font_size`` The no data font size
``opacity`` The opacity of chart element
Expand Down
5 changes: 5 additions & 0 deletions pygal/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@
font-size: {{ style.title_font_size }}px;
}

{{ id }}.plot_title {
font-family: {{ style.plot_title_font_family }};
font-size: {{ style.plot_title_font_size }}px;
}

{{ id }}.legends .legend text {
font-family: {{ style.legend_font_family }};
font-size: {{ style.legend_font_size }}px;
Expand Down
2 changes: 1 addition & 1 deletion pygal/graph/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ def _make_title(self):
'text',
class_='title plot_title',
x=self.width / 2,
y=i * (self.style.title_font_size + self.spacing)
y=i * (self.style.plot_title_font_size + self.spacing)
).text = title_line

def _make_x_title(self):
Expand Down
2 changes: 2 additions & 0 deletions pygal/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Style(object):
value_label_font_family = None
tooltip_font_family = None
title_font_family = None
plot_title_font_family = None
legend_font_family = None
no_data_font_family = None

Expand All @@ -54,6 +55,7 @@ class Style(object):
value_label_font_size = 10
tooltip_font_size = 14
title_font_size = 16
plot_title_font_size = 18
legend_font_size = 14
no_data_font_size = 64

Expand Down