|
|
@ -86,19 +86,9 @@ class Radar(Line): |
|
|
|
format_ = lambda x: '%f %f' % x |
|
|
|
format_ = lambda x: '%f %f' % x |
|
|
|
center = self.view((0, 0)) |
|
|
|
center = self.view((0, 0)) |
|
|
|
r = self._rmax |
|
|
|
r = self._rmax |
|
|
|
truncation = self.truncate_label |
|
|
|
|
|
|
|
if not truncation: |
|
|
|
# Can't simply determine truncation |
|
|
|
if self.x_label_rotation or len(self._x_labels) <= 1: |
|
|
|
truncation = self.truncate_label or 25 |
|
|
|
truncation = 25 |
|
|
|
|
|
|
|
else: |
|
|
|
|
|
|
|
first_label_position = self.view.x(self._x_labels[0][1]) or 0 |
|
|
|
|
|
|
|
last_label_position = self.view.x(self._x_labels[-1][1]) or 0 |
|
|
|
|
|
|
|
available_space = ( |
|
|
|
|
|
|
|
last_label_position - first_label_position) / ( |
|
|
|
|
|
|
|
len(self._x_labels) - 1) |
|
|
|
|
|
|
|
truncation = reverse_text_len( |
|
|
|
|
|
|
|
available_space, self.style.label_font_size) |
|
|
|
|
|
|
|
truncation = max(truncation, 1) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for label, theta in self._x_labels: |
|
|
|
for label, theta in self._x_labels: |
|
|
|
major = label in self._x_major_labels |
|
|
|
major = label in self._x_major_labels |
|
|
@ -208,15 +198,15 @@ class Radar(Line): |
|
|
|
self._y_labels = [] |
|
|
|
self._y_labels = [] |
|
|
|
for i, y_label in enumerate(self.y_labels): |
|
|
|
for i, y_label in enumerate(self.y_labels): |
|
|
|
if isinstance(y_label, dict): |
|
|
|
if isinstance(y_label, dict): |
|
|
|
pos = float(y_label.get('value')) |
|
|
|
pos = self._adapt(y_label.get('value')) |
|
|
|
title = y_label.get('label', self._format(pos)) |
|
|
|
title = y_label.get('label', self._format(pos)) |
|
|
|
elif is_str(y_label): |
|
|
|
elif is_str(y_label): |
|
|
|
pos = y_pos[i] |
|
|
|
pos = self._adapt(y_pos[i]) |
|
|
|
title = y_label |
|
|
|
title = y_label |
|
|
|
else: |
|
|
|
else: |
|
|
|
pos = float(y_label) |
|
|
|
pos = self._adapt(y_label) |
|
|
|
title = self._format(y_label) |
|
|
|
title = self._format(pos) |
|
|
|
self._y_labels.append((title, self._adapt(pos))) |
|
|
|
self._y_labels.append((title, pos)) |
|
|
|
self._rmin = min(self._rmin, min(cut(self._y_labels, 1))) |
|
|
|
self._rmin = min(self._rmin, min(cut(self._y_labels, 1))) |
|
|
|
self._rmax = max(self._rmax, max(cut(self._y_labels, 1))) |
|
|
|
self._rmax = max(self._rmax, max(cut(self._y_labels, 1))) |
|
|
|
self._box.set_polar_box(self._rmin, self._rmax) |
|
|
|
self._box.set_polar_box(self._rmin, self._rmax) |
|
|
|