|
|
@ -27,7 +27,7 @@ from pygal.util import ( |
|
|
|
get_text_box, get_texts_box, cut, rad, humanize, truncate, split_title) |
|
|
|
get_text_box, get_texts_box, cut, rad, humanize, truncate, split_title) |
|
|
|
from pygal.svg import Svg |
|
|
|
from pygal.svg import Svg |
|
|
|
from pygal.util import cached_property, majorize |
|
|
|
from pygal.util import cached_property, majorize |
|
|
|
from math import sin, cos, sqrt |
|
|
|
from math import sin, cos, sqrt, ceil |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class BaseGraph(object): |
|
|
|
class BaseGraph(object): |
|
|
@ -93,8 +93,11 @@ class BaseGraph(object): |
|
|
|
self.legend_font_size) |
|
|
|
self.legend_font_size) |
|
|
|
if self.legend_at_bottom: |
|
|
|
if self.legend_at_bottom: |
|
|
|
h_max = max(h, self.legend_box_size) |
|
|
|
h_max = max(h, self.legend_box_size) |
|
|
|
|
|
|
|
cols = (self._order // self.legend_at_bottom_columns |
|
|
|
|
|
|
|
if self.legend_at_bottom_columns |
|
|
|
|
|
|
|
else ceil(sqrt(self._order)) or 1) |
|
|
|
self.margin.bottom += self.spacing + h_max * round( |
|
|
|
self.margin.bottom += self.spacing + h_max * round( |
|
|
|
sqrt(self._order) - 1) * 1.5 + h_max |
|
|
|
cols - 1) * 1.5 + h_max |
|
|
|
else: |
|
|
|
else: |
|
|
|
if series_group is self.series: |
|
|
|
if series_group is self.series: |
|
|
|
legend_width = self.spacing + w + self.legend_box_size |
|
|
|
legend_width = self.spacing + w + self.legend_box_size |
|
|
|