simplecharts

SVG charts without dependencies
git clone https://git.ce9e.org/simplecharts.git

commit
611ceb70ce069567de5d94381584390b4b924d1d
parent
a9eb4705bf26f1a717a080325d3ef7eb39941fc4
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2020-02-20 09:23
rm trailing .0

Diffstat

M simplecharts.py 4 ++--
M tests/no-legend_LineRenderer.svg 6 +++---
M tests/no-legend_StackedAreaRenderer.svg 6 +++---
M tests/simple_LineRenderer.svg 6 +++---
M tests/simple_StackedAreaRenderer.svg 6 +++---
M tests/single_LineRenderer.svg 2 +-
M tests/single_StackedAreaRenderer.svg 2 +-

7 files changed, 16 insertions, 16 deletions


diff --git a/simplecharts.py b/simplecharts.py

@@ -80,7 +80,7 @@ class BaseRenderer:
   80    80         return self.element('circle', content, cx=x, cy=y, r=radius, **kwargs)
   81    81 
   82    82     def polyline(self, points, **kwargs):
   83    -1         d = ' '.join('{},{}'.format(*p) for p in points)
   -1    83         d = ' '.join('{:g},{:g}'.format(*p) for p in points)
   84    84         return self.element('polyline', points=d, **kwargs)
   85    85 
   86    86     def get_title(self, rows, legend, i, j):
@@ -163,7 +163,7 @@ class BaseRenderer:
  163   163         y = -(self.padding + self.y_legend)
  164   164         width = self.width + p + self.x_labels
  165   165         height = self.height + p + self.y_legend + self.y_legend
  166    -1         return '{} {} {} {}'.format(x, y, width, height)
   -1   166         return '{:g} {:g} {:g} {:g}'.format(x, y, width, height)
  167   167 
  168   168     def render(self, data):
  169   169         if self.stacked:

diff --git a/tests/no-legend_LineRenderer.svg b/tests/no-legend_LineRenderer.svg

@@ -13,9 +13,9 @@
   13    13 			<text dominant-baseline="middle" fill="#333" role="columnheader" text-anchor="middle" x="400.0" y="490.0">Pears</text>
   14    14 			<text dominant-baseline="middle" fill="#333" role="columnheader" text-anchor="middle" x="560.0" y="490.0">Bananas</text>
   15    15 		</g>
   16    -1 		<polyline fill="none" points="80.0,240.0 240.0,160.0 400.0,160.0 560.0,80.0" stroke="#e41a1c" />
   17    -1 		<polyline fill="none" points="80.0,320.0 240.0,320.0 400.0,240.0 560.0,400.0" stroke="#377eb8" />
   18    -1 		<polyline fill="none" points="80.0,80.0 240.0,240.0 400.0,160.0 560.0,320.0" stroke="#4daf4a" />
   -1    16 		<polyline fill="none" points="80,240 240,160 400,160 560,80" stroke="#e41a1c" />
   -1    17 		<polyline fill="none" points="80,320 240,320 400,240 560,400" stroke="#377eb8" />
   -1    18 		<polyline fill="none" points="80,80 240,240 400,160 560,320" stroke="#4daf4a" />
   19    19 		<g fill="#e41a1c" role="row" stroke="white">
   20    20 			<circle cx="80.0" cy="240.0" r="3" role="cell">
   21    21 				<title>3</title>

diff --git a/tests/no-legend_StackedAreaRenderer.svg b/tests/no-legend_StackedAreaRenderer.svg

@@ -13,9 +13,9 @@
   13    13 			<text dominant-baseline="middle" fill="#333" role="columnheader" text-anchor="middle" x="400.0" y="490.0">Pears</text>
   14    14 			<text dominant-baseline="middle" fill="#333" role="columnheader" text-anchor="middle" x="560.0" y="490.0">Bananas</text>
   15    15 		</g>
   16    -1 		<polyline fill="#e41a1c" points="80.0,407.0 240.0,383.0 400.0,383.0 560.0,359.0 560.0,479 400.0,479 240.0,479 80.0,479" stroke="white" />
   17    -1 		<polyline fill="#377eb8" points="80.0,359.0 240.0,335.0 400.0,311.0 560.0,335.0 560.0,359.0 400.0,383.0 240.0,383.0 80.0,407.0" stroke="white" />
   18    -1 		<polyline fill="#4daf4a" points="80.0,239.0 240.0,263.0 400.0,215.0 560.0,287.0 560.0,335.0 400.0,311.0 240.0,335.0 80.0,359.0" stroke="white" />
   -1    16 		<polyline fill="#e41a1c" points="80,407 240,383 400,383 560,359 560,479 400,479 240,479 80,479" stroke="white" />
   -1    17 		<polyline fill="#377eb8" points="80,359 240,335 400,311 560,335 560,359 400,383 240,383 80,407" stroke="white" />
   -1    18 		<polyline fill="#4daf4a" points="80,239 240,263 400,215 560,287 560,335 400,311 240,335 80,359" stroke="white" />
   19    19 		<g fill="#e41a1c" role="row" stroke="white">
   20    20 			<circle cx="80.0" cy="407.0" r="3" role="cell">
   21    21 				<title>3</title>

diff --git a/tests/simple_LineRenderer.svg b/tests/simple_LineRenderer.svg

@@ -22,9 +22,9 @@
   22    22 			<rect fill="#4daf4a" height="10" width="10" x="592" y="-15.0" />
   23    23 			<text dominant-baseline="middle" fill="#333" x="606" y="-10.0">Joe</text>
   24    24 		</g>
   25    -1 		<polyline fill="none" points="80.0,240.0 240.0,160.0 400.0,160.0 560.0,80.0" stroke="#e41a1c" />
   26    -1 		<polyline fill="none" points="80.0,320.0 240.0,320.0 400.0,240.0 560.0,400.0" stroke="#377eb8" />
   27    -1 		<polyline fill="none" points="80.0,80.0 240.0,240.0 400.0,160.0 560.0,320.0" stroke="#4daf4a" />
   -1    25 		<polyline fill="none" points="80,240 240,160 400,160 560,80" stroke="#e41a1c" />
   -1    26 		<polyline fill="none" points="80,320 240,320 400,240 560,400" stroke="#377eb8" />
   -1    27 		<polyline fill="none" points="80,80 240,240 400,160 560,320" stroke="#4daf4a" />
   28    28 		<g fill="#e41a1c" role="row" stroke="white">
   29    29 			<circle cx="80.0" cy="240.0" r="3" role="cell">
   30    30 				<title>3</title>

diff --git a/tests/simple_StackedAreaRenderer.svg b/tests/simple_StackedAreaRenderer.svg

@@ -22,9 +22,9 @@
   22    22 			<rect fill="#4daf4a" height="10" width="10" x="592" y="-15.0" />
   23    23 			<text dominant-baseline="middle" fill="#333" x="606" y="-10.0">Joe</text>
   24    24 		</g>
   25    -1 		<polyline fill="#e41a1c" points="80.0,407.0 240.0,383.0 400.0,383.0 560.0,359.0 560.0,479 400.0,479 240.0,479 80.0,479" stroke="white" />
   26    -1 		<polyline fill="#377eb8" points="80.0,359.0 240.0,335.0 400.0,311.0 560.0,335.0 560.0,359.0 400.0,383.0 240.0,383.0 80.0,407.0" stroke="white" />
   27    -1 		<polyline fill="#4daf4a" points="80.0,239.0 240.0,263.0 400.0,215.0 560.0,287.0 560.0,335.0 400.0,311.0 240.0,335.0 80.0,359.0" stroke="white" />
   -1    25 		<polyline fill="#e41a1c" points="80,407 240,383 400,383 560,359 560,479 400,479 240,479 80,479" stroke="white" />
   -1    26 		<polyline fill="#377eb8" points="80,359 240,335 400,311 560,335 560,359 400,383 240,383 80,407" stroke="white" />
   -1    27 		<polyline fill="#4daf4a" points="80,239 240,263 400,215 560,287 560,335 400,311 240,335 80,359" stroke="white" />
   28    28 		<g fill="#e41a1c" role="row" stroke="white">
   29    29 			<circle cx="80.0" cy="407.0" r="3" role="cell">
   30    30 				<title>3</title>

diff --git a/tests/single_LineRenderer.svg b/tests/single_LineRenderer.svg

@@ -13,7 +13,7 @@
   13    13 			<text dominant-baseline="middle" fill="#333" role="columnheader" text-anchor="middle" x="400.0" y="490.0">Pears</text>
   14    14 			<text dominant-baseline="middle" fill="#333" role="columnheader" text-anchor="middle" x="560.0" y="490.0">Bananas</text>
   15    15 		</g>
   16    -1 		<polyline fill="none" points="80.0,240.0 240.0,160.0 400.0,160.0 560.0,80.0" stroke="#e41a1c" />
   -1    16 		<polyline fill="none" points="80,240 240,160 400,160 560,80" stroke="#e41a1c" />
   17    17 		<g fill="#e41a1c" role="row" stroke="white">
   18    18 			<circle cx="80.0" cy="240.0" r="3" role="cell">
   19    19 				<title>3</title>

diff --git a/tests/single_StackedAreaRenderer.svg b/tests/single_StackedAreaRenderer.svg

@@ -13,7 +13,7 @@
   13    13 			<text dominant-baseline="middle" fill="#333" role="columnheader" text-anchor="middle" x="400.0" y="490.0">Pears</text>
   14    14 			<text dominant-baseline="middle" fill="#333" role="columnheader" text-anchor="middle" x="560.0" y="490.0">Bananas</text>
   15    15 		</g>
   16    -1 		<polyline fill="#e41a1c" points="80.0,239.0 240.0,159.0 400.0,159.0 560.0,79.0 560.0,479 400.0,479 240.0,479 80.0,479" stroke="white" />
   -1    16 		<polyline fill="#e41a1c" points="80,239 240,159 400,159 560,79 560,479 400,479 240,479 80,479" stroke="white" />
   17    17 		<g fill="#e41a1c" role="row" stroke="white">
   18    18 			<circle cx="80.0" cy="239.0" r="3" role="cell">
   19    19 				<title>3</title>