Merge lp:~mrooney/cairoplot/label-formatters into lp:cairoplot
Proposed by
Michael Rooney
Status: | Needs review |
---|---|
Proposed branch: | lp:~mrooney/cairoplot/label-formatters |
Merge into: | lp:cairoplot |
Diff against target: |
303 lines (+94/-34) 4 files modified
trunk/cairoplot.py (+48/-27) trunk/seriestests.py (+21/-7) trunk/testscripts/compare.sh (+22/-0) trunk/testscripts/timeit.sh (+3/-0) |
To merge this branch: | bzr merge lp:~mrooney/cairoplot/label-formatters |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Rodrigo Moreira Araújo | Pending | ||
Review via email: mp+30192@code.launchpad.net |
Description of the change
Add value/label formatters for displaying axis/values as any kind of string such as date, currency, et cetera.
To post a comment you must log in.
Unmerged revisions
- 50. By Michael Rooney
-
make sure value is defined for stacked vertical bar plots
- 49. By Michael Rooney
-
fix centering of formatted values in a vertical bar plot
- 48. By Michael Rooney
-
add support for value formatters to a vertical bar plot
- 47. By Michael Rooney
-
add support for x/y label formatters for a scatter plot
Hello there,
As I wasn't too busy, i just reviewed the code. The only thing I didn't get
was the use of this compare.sh script. Why would you like to compare png
files?
Great code btw, merging it soon.
Cheers,
Rodrigo Araujo
2010/7/17 Michael Rooney <email address hidden>
> Michael Rooney has proposed merging lp:~mrooney/cairoplot/label-formatters /code.launchpad .net/~mrooney/ cairoplot/ label-formatter s/+merge/ 30192 cairoplot. py' formatters = {} formatters[ HORZ] = x_formatter formatters[ VERT] = y_formatter HORZ][1] - self.bounds[ HORZ][0] self.bounds[ HORZ][0] bounds[ HORZ][0] + VERT][1] - self.bounds[ VERT][0] self.bounds[ VERT][0] bounds[ VERT][0] + key][0] + (amplitude * i / 10.0) for formatters[ key]: formatters[ key](label)
> into lp:cairoplot.
>
> Requested reviews:
> Rodrigo Moreira Araújo (alf-rodrigo)
>
>
> Add value/label formatters for displaying axis/values as any kind of string
> such as date, currency, et cetera.
> --
> https:/
> You are requested to review the proposed merge of
> lp:~mrooney/cairoplot/label-formatters into lp:cairoplot.
>
> === modified file 'trunk/
> --- trunk/cairoplot.py 2009-07-09 21:57:24 +0000
> +++ trunk/cairoplot.py 2010-07-17 21:38:38 +0000
> @@ -1,4 +1,4 @@
> -#!/usr/bin/env python
> +#!/usr/bin/env python
> # -*- coding: utf-8 -*-
>
> # CairoPlot.py
> @@ -288,6 +288,8 @@
> series_legend = False,
> x_labels = None,
> y_labels = None,
> + x_formatter = None,
> + y_formatter = None,
> x_bounds = None,
> y_bounds = None,
> z_bounds = None,
> @@ -303,6 +305,9 @@
> self.titles = {}
> self.titles[HORZ] = x_title
> self.titles[VERT] = y_title
> + self.label_
> + self.label_
> + self.label_
> self.max_value = {}
> self.axis = axis
> self.discrete = discrete
> @@ -396,19 +401,17 @@
> self.errors[VERT] = [errory]
>
> def calc_labels(self):
> - if not self.labels[HORZ]:
> - amplitude = self.bounds[
> - if amplitude % 10: #if horizontal labels need floating points
> - self.labels[HORZ] = ["%.2lf" % (float(
> + (amplitude * i / 10.0))) for i in range(11) ]
> - else:
> - self.labels[HORZ] = ["%d" % (int(self.
> (amplitude * i / 10.0))) for i in range(11) ]
> - if not self.labels[VERT]:
> - amplitude = self.bounds[
> - if amplitude % 10: #if vertical labels need floating points
> - self.labels[VERT] = ["%.2lf" % (float(
> + (amplitude * i / 10.0))) for i in range(11) ]
> - else:
> - self.labels[VERT] = ["%d" % (int(self.
> (amplitude * i / 10.0))) for i in range(11) ]
> -
> + for key in (HORZ, VERT):
> + if not self.labels[key]:
> + amplitude = self.bounds[key][1] - self.bounds[key][0]
> + labels = (self.bounds[
> i in range(11))
> + if self.label_
> + self.labels[key] = [self.label_
> for label in labels]
> + elif amplitude % 10: #if horizontal labels need floating
> points
> + ...