simplecharts

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

commit
9c8d342abc0d76c0555e747ab27fbf202b342cc2
parent
0a58c4cb6a54a1c42423040152bf8c5416d2a7a1
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2019-02-20 07:02
add tests

Diffstat

A test.py 44 ++++++++++++++++++++++++++++++++++++++++++++
A tests/no-legend.json 15 +++++++++++++++
A tests/no-legend_ColumnRenderer.svg 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
A tests/no-legend_LineRenderer.svg 14 ++++++++++++++
A tests/no-legend_StackedAreaRenderer.svg 14 ++++++++++++++
A tests/no-legend_StackedColumnRenderer.svg 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
A tests/simple.json 16 ++++++++++++++++
A tests/simple_ColumnRenderer.svg 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A tests/simple_LineRenderer.svg 23 +++++++++++++++++++++++
A tests/simple_StackedAreaRenderer.svg 23 +++++++++++++++++++++++
A tests/simple_StackedColumnRenderer.svg 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A tests/single.json 15 +++++++++++++++
A tests/single_ColumnRenderer.svg 31 +++++++++++++++++++++++++++++++
A tests/single_LineRenderer.svg 12 ++++++++++++
A tests/single_StackedAreaRenderer.svg 12 ++++++++++++
A tests/single_StackedColumnRenderer.svg 31 +++++++++++++++++++++++++++++++

16 files changed, 488 insertions, 0 deletions


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

@@ -0,0 +1,44 @@
   -1     1 import os
   -1     2 import sys
   -1     3 import json
   -1     4 import difflib
   -1     5 
   -1     6 import simplecharts
   -1     7 
   -1     8 DIR = 'tests'
   -1     9 
   -1    10 
   -1    11 def render_error(actual, expected, name):
   -1    12     actual_lines = [line + '\n' for line in actual.split('\n')]
   -1    13     expected_lines = [line + '\n' for line in expected.split('\n')]
   -1    14     diff = difflib.unified_diff(
   -1    15         actual_lines, expected_lines, 'actual', name)
   -1    16     sys.stdout.writelines(diff)
   -1    17 
   -1    18 
   -1    19 def run_test(key, renderer):
   -1    20     with open(os.path.join(DIR, key + '.json')) as fh:
   -1    21         data = json.load(fh)
   -1    22         actual = renderer.render(data)
   -1    23 
   -1    24     svg = '{}_{}.svg'.format(key, renderer.__class__.__name__)
   -1    25     path = os.path.join(DIR, svg)
   -1    26 
   -1    27     if os.path.exists(path):
   -1    28         with open(path) as fh:
   -1    29             expected = fh.read()
   -1    30         if renderer.render(data) != expected:
   -1    31             render_error(actual, expected, svg)
   -1    32     else:
   -1    33         with open(path, 'w') as fh:
   -1    34             fh.write(actual)
   -1    35             print('generated', svg)
   -1    36 
   -1    37 
   -1    38 for fn in os.listdir(DIR):
   -1    39     if fn.endswith('.json'):
   -1    40         key = fn[:-5]
   -1    41         run_test(key, simplecharts.ColumnRenderer())
   -1    42         run_test(key, simplecharts.StackedColumnRenderer())
   -1    43         run_test(key, simplecharts.LineRenderer())
   -1    44         run_test(key, simplecharts.StackedAreaRenderer())

diff --git a/tests/no-legend.json b/tests/no-legend.json

@@ -0,0 +1,15 @@
   -1     1 {
   -1     2     "rows": [{
   -1     3         "label": "Apples",
   -1     4         "values": [3, 2, 5]
   -1     5     }, {
   -1     6         "label": "Oranges",
   -1     7         "values": [4, 2, 3]
   -1     8     }, {
   -1     9         "label": "Pears",
   -1    10         "values": [4, 3, 4]
   -1    11     }, {
   -1    12         "label": "Bananas",
   -1    13         "values": [5, 1, 2]
   -1    14     }]
   -1    15 }

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

@@ -0,0 +1,55 @@
   -1     1 <svg viewBox="-55 -25 700 530" xmlns="http://www.w3.org/2000/svg">
   -1     2 	<line stroke="#333" x1="0" x2="0" y1="0" y2="480" />
   -1     3 	<line stroke="#333" x1="0" x2="640" y1="480" y2="480" />
   -1     4 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="480">0</text>
   -1     5 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240.0">3</text>
   -1     6 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">6</text>
   -1     7 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="80.0" y="490.0">Apples</text>
   -1     8 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="240.0" y="490.0">Oranges</text>
   -1     9 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="400.0" y="490.0">Pears</text>
   -1    10 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="560.0" y="490.0">Bananas</text>
   -1    11 	<g>
   -1    12 		<rect fill="#e41a1c" height="240.0" stroke="white" width="32.0" x="32.0" y="239.0">
   -1    13 			<title>Apples: 3</title>
   -1    14 		</rect>
   -1    15 		<rect fill="#377eb8" height="160.0" stroke="white" width="32.0" x="64.0" y="319.0">
   -1    16 			<title>Apples: 2</title>
   -1    17 		</rect>
   -1    18 		<rect fill="#4daf4a" height="400.0" stroke="white" width="32.0" x="96.0" y="79.0">
   -1    19 			<title>Apples: 5</title>
   -1    20 		</rect>
   -1    21 	</g>
   -1    22 	<g>
   -1    23 		<rect fill="#e41a1c" height="320.0" stroke="white" width="32.0" x="192.0" y="159.0">
   -1    24 			<title>Oranges: 4</title>
   -1    25 		</rect>
   -1    26 		<rect fill="#377eb8" height="160.0" stroke="white" width="32.0" x="224.0" y="319.0">
   -1    27 			<title>Oranges: 2</title>
   -1    28 		</rect>
   -1    29 		<rect fill="#4daf4a" height="240.0" stroke="white" width="32.0" x="256.0" y="239.0">
   -1    30 			<title>Oranges: 3</title>
   -1    31 		</rect>
   -1    32 	</g>
   -1    33 	<g>
   -1    34 		<rect fill="#e41a1c" height="320.0" stroke="white" width="32.0" x="352.0" y="159.0">
   -1    35 			<title>Pears: 4</title>
   -1    36 		</rect>
   -1    37 		<rect fill="#377eb8" height="240.0" stroke="white" width="32.0" x="384.0" y="239.0">
   -1    38 			<title>Pears: 3</title>
   -1    39 		</rect>
   -1    40 		<rect fill="#4daf4a" height="320.0" stroke="white" width="32.0" x="416.0" y="159.0">
   -1    41 			<title>Pears: 4</title>
   -1    42 		</rect>
   -1    43 	</g>
   -1    44 	<g>
   -1    45 		<rect fill="#e41a1c" height="400.0" stroke="white" width="32.0" x="512.0" y="79.0">
   -1    46 			<title>Bananas: 5</title>
   -1    47 		</rect>
   -1    48 		<rect fill="#377eb8" height="80.0" stroke="white" width="32.0" x="544.0" y="399.0">
   -1    49 			<title>Bananas: 1</title>
   -1    50 		</rect>
   -1    51 		<rect fill="#4daf4a" height="160.0" stroke="white" width="32.0" x="576.0" y="319.0">
   -1    52 			<title>Bananas: 2</title>
   -1    53 		</rect>
   -1    54 	</g>
   -1    55 </svg>

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

@@ -0,0 +1,14 @@
   -1     1 <svg viewBox="-55 -25 700 530" xmlns="http://www.w3.org/2000/svg">
   -1     2 	<line stroke="#333" x1="0" x2="0" y1="0" y2="480" />
   -1     3 	<line stroke="#333" x1="0" x2="640" y1="480" y2="480" />
   -1     4 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="480">0</text>
   -1     5 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240.0">3</text>
   -1     6 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">6</text>
   -1     7 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="80.0" y="490.0">Apples</text>
   -1     8 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="240.0" y="490.0">Oranges</text>
   -1     9 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="400.0" y="490.0">Pears</text>
   -1    10 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="560.0" y="490.0">Bananas</text>
   -1    11 	<path d="M 80.0,240.0 L 240.0,160.0 400.0,160.0 560.0,80.0" fill="none" stroke="#e41a1c" />
   -1    12 	<path d="M 80.0,320.0 L 240.0,320.0 400.0,240.0 560.0,400.0" fill="none" stroke="#377eb8" />
   -1    13 	<path d="M 80.0,80.0 L 240.0,240.0 400.0,160.0 560.0,320.0" fill="none" stroke="#4daf4a" />
   -1    14 </svg>

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

@@ -0,0 +1,14 @@
   -1     1 <svg viewBox="-55 -25 700 530" xmlns="http://www.w3.org/2000/svg">
   -1     2 	<line stroke="#333" x1="0" x2="0" y1="0" y2="480" />
   -1     3 	<line stroke="#333" x1="0" x2="640" y1="480" y2="480" />
   -1     4 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="480">0</text>
   -1     5 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240.0">10</text>
   -1     6 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">20</text>
   -1     7 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="80.0" y="490.0">Apples</text>
   -1     8 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="240.0" y="490.0">Oranges</text>
   -1     9 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="400.0" y="490.0">Pears</text>
   -1    10 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="560.0" y="490.0">Bananas</text>
   -1    11 	<path d="M 80.0,407.0 L 240.0,383.0 400.0,383.0 560.0,359.0 560.0,479 400.0,479 240.0,479 80.0,479" fill="#e41a1c" stroke="white" />
   -1    12 	<path d="M 80.0,359.0 L 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" fill="#377eb8" stroke="white" />
   -1    13 	<path d="M 80.0,239.0 L 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" fill="#4daf4a" stroke="white" />
   -1    14 </svg>

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

@@ -0,0 +1,55 @@
   -1     1 <svg viewBox="-55 -25 700 530" xmlns="http://www.w3.org/2000/svg">
   -1     2 	<line stroke="#333" x1="0" x2="0" y1="0" y2="480" />
   -1     3 	<line stroke="#333" x1="0" x2="640" y1="480" y2="480" />
   -1     4 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="480">0</text>
   -1     5 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240.0">10</text>
   -1     6 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">20</text>
   -1     7 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="80.0" y="490.0">Apples</text>
   -1     8 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="240.0" y="490.0">Oranges</text>
   -1     9 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="400.0" y="490.0">Pears</text>
   -1    10 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="560.0" y="490.0">Bananas</text>
   -1    11 	<g>
   -1    12 		<rect fill="#e41a1c" height="72.0" stroke="white" width="53.333333333333336" x="53.33333333333333" y="407.0">
   -1    13 			<title>Apples: 3</title>
   -1    14 		</rect>
   -1    15 		<rect fill="#377eb8" height="48.0" stroke="white" width="53.333333333333336" x="53.33333333333333" y="359.0">
   -1    16 			<title>Apples: 2</title>
   -1    17 		</rect>
   -1    18 		<rect fill="#4daf4a" height="120.0" stroke="white" width="53.333333333333336" x="53.33333333333333" y="239.0">
   -1    19 			<title>Apples: 5</title>
   -1    20 		</rect>
   -1    21 	</g>
   -1    22 	<g>
   -1    23 		<rect fill="#e41a1c" height="96.0" stroke="white" width="53.333333333333336" x="213.33333333333334" y="383.0">
   -1    24 			<title>Oranges: 4</title>
   -1    25 		</rect>
   -1    26 		<rect fill="#377eb8" height="48.0" stroke="white" width="53.333333333333336" x="213.33333333333334" y="335.0">
   -1    27 			<title>Oranges: 2</title>
   -1    28 		</rect>
   -1    29 		<rect fill="#4daf4a" height="72.0" stroke="white" width="53.333333333333336" x="213.33333333333334" y="263.0">
   -1    30 			<title>Oranges: 3</title>
   -1    31 		</rect>
   -1    32 	</g>
   -1    33 	<g>
   -1    34 		<rect fill="#e41a1c" height="96.0" stroke="white" width="53.333333333333336" x="373.3333333333333" y="383.0">
   -1    35 			<title>Pears: 4</title>
   -1    36 		</rect>
   -1    37 		<rect fill="#377eb8" height="72.0" stroke="white" width="53.333333333333336" x="373.3333333333333" y="311.0">
   -1    38 			<title>Pears: 3</title>
   -1    39 		</rect>
   -1    40 		<rect fill="#4daf4a" height="96.0" stroke="white" width="53.333333333333336" x="373.3333333333333" y="215.0">
   -1    41 			<title>Pears: 4</title>
   -1    42 		</rect>
   -1    43 	</g>
   -1    44 	<g>
   -1    45 		<rect fill="#e41a1c" height="120.0" stroke="white" width="53.333333333333336" x="533.3333333333334" y="359.0">
   -1    46 			<title>Bananas: 5</title>
   -1    47 		</rect>
   -1    48 		<rect fill="#377eb8" height="24.0" stroke="white" width="53.333333333333336" x="533.3333333333334" y="335.0">
   -1    49 			<title>Bananas: 1</title>
   -1    50 		</rect>
   -1    51 		<rect fill="#4daf4a" height="48.0" stroke="white" width="53.333333333333336" x="533.3333333333334" y="287.0">
   -1    52 			<title>Bananas: 2</title>
   -1    53 		</rect>
   -1    54 	</g>
   -1    55 </svg>

diff --git a/tests/simple.json b/tests/simple.json

@@ -0,0 +1,16 @@
   -1     1 {
   -1     2     "rows": [{
   -1     3         "label": "Apples",
   -1     4         "values": [3, 2, 5]
   -1     5     }, {
   -1     6         "label": "Oranges",
   -1     7         "values": [4, 2, 3]
   -1     8     }, {
   -1     9         "label": "Pears",
   -1    10         "values": [4, 3, 4]
   -1    11     }, {
   -1    12         "label": "Bananas",
   -1    13         "values": [5, 1, 2]
   -1    14     }],
   -1    15     "legend": ["John", "Jane", "Joe"]
   -1    16 }

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

@@ -0,0 +1,64 @@
   -1     1 <svg viewBox="-55 -25 700 530" xmlns="http://www.w3.org/2000/svg">
   -1     2 	<line stroke="#333" x1="0" x2="0" y1="0" y2="480" />
   -1     3 	<line stroke="#333" x1="0" x2="640" y1="480" y2="480" />
   -1     4 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="480">0</text>
   -1     5 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240.0">3</text>
   -1     6 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">6</text>
   -1     7 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="80.0" y="490.0">Apples</text>
   -1     8 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="240.0" y="490.0">Oranges</text>
   -1     9 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="400.0" y="490.0">Pears</text>
   -1    10 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="560.0" y="490.0">Bananas</text>
   -1    11 	<g>
   -1    12 		<rect fill="none" height="20" stroke="#333" width="180" x="460" y="-20" />
   -1    13 		<rect fill="#e41a1c" height="10" width="10" x="464" y="-15.0" />
   -1    14 		<text dominant-baseline="middle" fill="#333" x="478" y="-10.0">John</text>
   -1    15 		<rect fill="#377eb8" height="10" width="10" x="528" y="-15.0" />
   -1    16 		<text dominant-baseline="middle" fill="#333" x="542" y="-10.0">Jane</text>
   -1    17 		<rect fill="#4daf4a" height="10" width="10" x="592" y="-15.0" />
   -1    18 		<text dominant-baseline="middle" fill="#333" x="606" y="-10.0">Joe</text>
   -1    19 	</g>
   -1    20 	<g>
   -1    21 		<rect fill="#e41a1c" height="240.0" stroke="white" width="32.0" x="32.0" y="239.0">
   -1    22 			<title>Apples - John: 3</title>
   -1    23 		</rect>
   -1    24 		<rect fill="#377eb8" height="160.0" stroke="white" width="32.0" x="64.0" y="319.0">
   -1    25 			<title>Apples - Jane: 2</title>
   -1    26 		</rect>
   -1    27 		<rect fill="#4daf4a" height="400.0" stroke="white" width="32.0" x="96.0" y="79.0">
   -1    28 			<title>Apples - Joe: 5</title>
   -1    29 		</rect>
   -1    30 	</g>
   -1    31 	<g>
   -1    32 		<rect fill="#e41a1c" height="320.0" stroke="white" width="32.0" x="192.0" y="159.0">
   -1    33 			<title>Oranges - John: 4</title>
   -1    34 		</rect>
   -1    35 		<rect fill="#377eb8" height="160.0" stroke="white" width="32.0" x="224.0" y="319.0">
   -1    36 			<title>Oranges - Jane: 2</title>
   -1    37 		</rect>
   -1    38 		<rect fill="#4daf4a" height="240.0" stroke="white" width="32.0" x="256.0" y="239.0">
   -1    39 			<title>Oranges - Joe: 3</title>
   -1    40 		</rect>
   -1    41 	</g>
   -1    42 	<g>
   -1    43 		<rect fill="#e41a1c" height="320.0" stroke="white" width="32.0" x="352.0" y="159.0">
   -1    44 			<title>Pears - John: 4</title>
   -1    45 		</rect>
   -1    46 		<rect fill="#377eb8" height="240.0" stroke="white" width="32.0" x="384.0" y="239.0">
   -1    47 			<title>Pears - Jane: 3</title>
   -1    48 		</rect>
   -1    49 		<rect fill="#4daf4a" height="320.0" stroke="white" width="32.0" x="416.0" y="159.0">
   -1    50 			<title>Pears - Joe: 4</title>
   -1    51 		</rect>
   -1    52 	</g>
   -1    53 	<g>
   -1    54 		<rect fill="#e41a1c" height="400.0" stroke="white" width="32.0" x="512.0" y="79.0">
   -1    55 			<title>Bananas - John: 5</title>
   -1    56 		</rect>
   -1    57 		<rect fill="#377eb8" height="80.0" stroke="white" width="32.0" x="544.0" y="399.0">
   -1    58 			<title>Bananas - Jane: 1</title>
   -1    59 		</rect>
   -1    60 		<rect fill="#4daf4a" height="160.0" stroke="white" width="32.0" x="576.0" y="319.0">
   -1    61 			<title>Bananas - Joe: 2</title>
   -1    62 		</rect>
   -1    63 	</g>
   -1    64 </svg>

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

@@ -0,0 +1,23 @@
   -1     1 <svg viewBox="-55 -25 700 530" xmlns="http://www.w3.org/2000/svg">
   -1     2 	<line stroke="#333" x1="0" x2="0" y1="0" y2="480" />
   -1     3 	<line stroke="#333" x1="0" x2="640" y1="480" y2="480" />
   -1     4 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="480">0</text>
   -1     5 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240.0">3</text>
   -1     6 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">6</text>
   -1     7 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="80.0" y="490.0">Apples</text>
   -1     8 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="240.0" y="490.0">Oranges</text>
   -1     9 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="400.0" y="490.0">Pears</text>
   -1    10 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="560.0" y="490.0">Bananas</text>
   -1    11 	<g>
   -1    12 		<rect fill="none" height="20" stroke="#333" width="180" x="460" y="-20" />
   -1    13 		<rect fill="#e41a1c" height="10" width="10" x="464" y="-15.0" />
   -1    14 		<text dominant-baseline="middle" fill="#333" x="478" y="-10.0">John</text>
   -1    15 		<rect fill="#377eb8" height="10" width="10" x="528" y="-15.0" />
   -1    16 		<text dominant-baseline="middle" fill="#333" x="542" y="-10.0">Jane</text>
   -1    17 		<rect fill="#4daf4a" height="10" width="10" x="592" y="-15.0" />
   -1    18 		<text dominant-baseline="middle" fill="#333" x="606" y="-10.0">Joe</text>
   -1    19 	</g>
   -1    20 	<path d="M 80.0,240.0 L 240.0,160.0 400.0,160.0 560.0,80.0" fill="none" stroke="#e41a1c" />
   -1    21 	<path d="M 80.0,320.0 L 240.0,320.0 400.0,240.0 560.0,400.0" fill="none" stroke="#377eb8" />
   -1    22 	<path d="M 80.0,80.0 L 240.0,240.0 400.0,160.0 560.0,320.0" fill="none" stroke="#4daf4a" />
   -1    23 </svg>

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

@@ -0,0 +1,23 @@
   -1     1 <svg viewBox="-55 -25 700 530" xmlns="http://www.w3.org/2000/svg">
   -1     2 	<line stroke="#333" x1="0" x2="0" y1="0" y2="480" />
   -1     3 	<line stroke="#333" x1="0" x2="640" y1="480" y2="480" />
   -1     4 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="480">0</text>
   -1     5 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240.0">10</text>
   -1     6 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">20</text>
   -1     7 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="80.0" y="490.0">Apples</text>
   -1     8 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="240.0" y="490.0">Oranges</text>
   -1     9 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="400.0" y="490.0">Pears</text>
   -1    10 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="560.0" y="490.0">Bananas</text>
   -1    11 	<g>
   -1    12 		<rect fill="none" height="20" stroke="#333" width="180" x="460" y="-20" />
   -1    13 		<rect fill="#e41a1c" height="10" width="10" x="464" y="-15.0" />
   -1    14 		<text dominant-baseline="middle" fill="#333" x="478" y="-10.0">John</text>
   -1    15 		<rect fill="#377eb8" height="10" width="10" x="528" y="-15.0" />
   -1    16 		<text dominant-baseline="middle" fill="#333" x="542" y="-10.0">Jane</text>
   -1    17 		<rect fill="#4daf4a" height="10" width="10" x="592" y="-15.0" />
   -1    18 		<text dominant-baseline="middle" fill="#333" x="606" y="-10.0">Joe</text>
   -1    19 	</g>
   -1    20 	<path d="M 80.0,407.0 L 240.0,383.0 400.0,383.0 560.0,359.0 560.0,479 400.0,479 240.0,479 80.0,479" fill="#e41a1c" stroke="white" />
   -1    21 	<path d="M 80.0,359.0 L 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" fill="#377eb8" stroke="white" />
   -1    22 	<path d="M 80.0,239.0 L 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" fill="#4daf4a" stroke="white" />
   -1    23 </svg>

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

@@ -0,0 +1,64 @@
   -1     1 <svg viewBox="-55 -25 700 530" xmlns="http://www.w3.org/2000/svg">
   -1     2 	<line stroke="#333" x1="0" x2="0" y1="0" y2="480" />
   -1     3 	<line stroke="#333" x1="0" x2="640" y1="480" y2="480" />
   -1     4 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="480">0</text>
   -1     5 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240.0">10</text>
   -1     6 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">20</text>
   -1     7 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="80.0" y="490.0">Apples</text>
   -1     8 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="240.0" y="490.0">Oranges</text>
   -1     9 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="400.0" y="490.0">Pears</text>
   -1    10 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="560.0" y="490.0">Bananas</text>
   -1    11 	<g>
   -1    12 		<rect fill="none" height="20" stroke="#333" width="180" x="460" y="-20" />
   -1    13 		<rect fill="#e41a1c" height="10" width="10" x="464" y="-15.0" />
   -1    14 		<text dominant-baseline="middle" fill="#333" x="478" y="-10.0">John</text>
   -1    15 		<rect fill="#377eb8" height="10" width="10" x="528" y="-15.0" />
   -1    16 		<text dominant-baseline="middle" fill="#333" x="542" y="-10.0">Jane</text>
   -1    17 		<rect fill="#4daf4a" height="10" width="10" x="592" y="-15.0" />
   -1    18 		<text dominant-baseline="middle" fill="#333" x="606" y="-10.0">Joe</text>
   -1    19 	</g>
   -1    20 	<g>
   -1    21 		<rect fill="#e41a1c" height="72.0" stroke="white" width="53.333333333333336" x="53.33333333333333" y="407.0">
   -1    22 			<title>Apples - John: 3</title>
   -1    23 		</rect>
   -1    24 		<rect fill="#377eb8" height="48.0" stroke="white" width="53.333333333333336" x="53.33333333333333" y="359.0">
   -1    25 			<title>Apples - Jane: 2</title>
   -1    26 		</rect>
   -1    27 		<rect fill="#4daf4a" height="120.0" stroke="white" width="53.333333333333336" x="53.33333333333333" y="239.0">
   -1    28 			<title>Apples - Joe: 5</title>
   -1    29 		</rect>
   -1    30 	</g>
   -1    31 	<g>
   -1    32 		<rect fill="#e41a1c" height="96.0" stroke="white" width="53.333333333333336" x="213.33333333333334" y="383.0">
   -1    33 			<title>Oranges - John: 4</title>
   -1    34 		</rect>
   -1    35 		<rect fill="#377eb8" height="48.0" stroke="white" width="53.333333333333336" x="213.33333333333334" y="335.0">
   -1    36 			<title>Oranges - Jane: 2</title>
   -1    37 		</rect>
   -1    38 		<rect fill="#4daf4a" height="72.0" stroke="white" width="53.333333333333336" x="213.33333333333334" y="263.0">
   -1    39 			<title>Oranges - Joe: 3</title>
   -1    40 		</rect>
   -1    41 	</g>
   -1    42 	<g>
   -1    43 		<rect fill="#e41a1c" height="96.0" stroke="white" width="53.333333333333336" x="373.3333333333333" y="383.0">
   -1    44 			<title>Pears - John: 4</title>
   -1    45 		</rect>
   -1    46 		<rect fill="#377eb8" height="72.0" stroke="white" width="53.333333333333336" x="373.3333333333333" y="311.0">
   -1    47 			<title>Pears - Jane: 3</title>
   -1    48 		</rect>
   -1    49 		<rect fill="#4daf4a" height="96.0" stroke="white" width="53.333333333333336" x="373.3333333333333" y="215.0">
   -1    50 			<title>Pears - Joe: 4</title>
   -1    51 		</rect>
   -1    52 	</g>
   -1    53 	<g>
   -1    54 		<rect fill="#e41a1c" height="120.0" stroke="white" width="53.333333333333336" x="533.3333333333334" y="359.0">
   -1    55 			<title>Bananas - John: 5</title>
   -1    56 		</rect>
   -1    57 		<rect fill="#377eb8" height="24.0" stroke="white" width="53.333333333333336" x="533.3333333333334" y="335.0">
   -1    58 			<title>Bananas - Jane: 1</title>
   -1    59 		</rect>
   -1    60 		<rect fill="#4daf4a" height="48.0" stroke="white" width="53.333333333333336" x="533.3333333333334" y="287.0">
   -1    61 			<title>Bananas - Joe: 2</title>
   -1    62 		</rect>
   -1    63 	</g>
   -1    64 </svg>

diff --git a/tests/single.json b/tests/single.json

@@ -0,0 +1,15 @@
   -1     1 {
   -1     2     "rows": [{
   -1     3         "label": "Apples",
   -1     4         "values": [3]
   -1     5     }, {
   -1     6         "label": "Oranges",
   -1     7         "values": [4]
   -1     8     }, {
   -1     9         "label": "Pears",
   -1    10         "values": [4]
   -1    11     }, {
   -1    12         "label": "Bananas",
   -1    13         "values": [5]
   -1    14     }]
   -1    15 }

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

@@ -0,0 +1,31 @@
   -1     1 <svg viewBox="-55 -25 700 530" xmlns="http://www.w3.org/2000/svg">
   -1     2 	<line stroke="#333" x1="0" x2="0" y1="0" y2="480" />
   -1     3 	<line stroke="#333" x1="0" x2="640" y1="480" y2="480" />
   -1     4 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="480">0</text>
   -1     5 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240.0">3</text>
   -1     6 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">6</text>
   -1     7 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="80.0" y="490.0">Apples</text>
   -1     8 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="240.0" y="490.0">Oranges</text>
   -1     9 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="400.0" y="490.0">Pears</text>
   -1    10 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="560.0" y="490.0">Bananas</text>
   -1    11 	<g>
   -1    12 		<rect fill="#e41a1c" height="240.0" stroke="white" width="53.333333333333336" x="53.333333333333336" y="239.0">
   -1    13 			<title>Apples: 3</title>
   -1    14 		</rect>
   -1    15 	</g>
   -1    16 	<g>
   -1    17 		<rect fill="#e41a1c" height="320.0" stroke="white" width="53.333333333333336" x="213.33333333333334" y="159.0">
   -1    18 			<title>Oranges: 4</title>
   -1    19 		</rect>
   -1    20 	</g>
   -1    21 	<g>
   -1    22 		<rect fill="#e41a1c" height="320.0" stroke="white" width="53.333333333333336" x="373.33333333333337" y="159.0">
   -1    23 			<title>Pears: 4</title>
   -1    24 		</rect>
   -1    25 	</g>
   -1    26 	<g>
   -1    27 		<rect fill="#e41a1c" height="400.0" stroke="white" width="53.333333333333336" x="533.3333333333334" y="79.0">
   -1    28 			<title>Bananas: 5</title>
   -1    29 		</rect>
   -1    30 	</g>
   -1    31 </svg>

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

@@ -0,0 +1,12 @@
   -1     1 <svg viewBox="-55 -25 700 530" xmlns="http://www.w3.org/2000/svg">
   -1     2 	<line stroke="#333" x1="0" x2="0" y1="0" y2="480" />
   -1     3 	<line stroke="#333" x1="0" x2="640" y1="480" y2="480" />
   -1     4 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="480">0</text>
   -1     5 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240.0">3</text>
   -1     6 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">6</text>
   -1     7 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="80.0" y="490.0">Apples</text>
   -1     8 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="240.0" y="490.0">Oranges</text>
   -1     9 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="400.0" y="490.0">Pears</text>
   -1    10 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="560.0" y="490.0">Bananas</text>
   -1    11 	<path d="M 80.0,240.0 L 240.0,160.0 400.0,160.0 560.0,80.0" fill="none" stroke="#e41a1c" />
   -1    12 </svg>

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

@@ -0,0 +1,12 @@
   -1     1 <svg viewBox="-55 -25 700 530" xmlns="http://www.w3.org/2000/svg">
   -1     2 	<line stroke="#333" x1="0" x2="0" y1="0" y2="480" />
   -1     3 	<line stroke="#333" x1="0" x2="640" y1="480" y2="480" />
   -1     4 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="480">0</text>
   -1     5 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240.0">3</text>
   -1     6 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">6</text>
   -1     7 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="80.0" y="490.0">Apples</text>
   -1     8 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="240.0" y="490.0">Oranges</text>
   -1     9 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="400.0" y="490.0">Pears</text>
   -1    10 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="560.0" y="490.0">Bananas</text>
   -1    11 	<path d="M 80.0,239.0 L 240.0,159.0 400.0,159.0 560.0,79.0 560.0,479 400.0,479 240.0,479 80.0,479" fill="#e41a1c" stroke="white" />
   -1    12 </svg>

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

@@ -0,0 +1,31 @@
   -1     1 <svg viewBox="-55 -25 700 530" xmlns="http://www.w3.org/2000/svg">
   -1     2 	<line stroke="#333" x1="0" x2="0" y1="0" y2="480" />
   -1     3 	<line stroke="#333" x1="0" x2="640" y1="480" y2="480" />
   -1     4 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="480">0</text>
   -1     5 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240.0">3</text>
   -1     6 	<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">6</text>
   -1     7 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="80.0" y="490.0">Apples</text>
   -1     8 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="240.0" y="490.0">Oranges</text>
   -1     9 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="400.0" y="490.0">Pears</text>
   -1    10 	<text dominant-baseline="middle" fill="#333" text-anchor="middle" x="560.0" y="490.0">Bananas</text>
   -1    11 	<g>
   -1    12 		<rect fill="#e41a1c" height="240.0" stroke="white" width="53.333333333333336" x="53.33333333333333" y="239.0">
   -1    13 			<title>Apples: 3</title>
   -1    14 		</rect>
   -1    15 	</g>
   -1    16 	<g>
   -1    17 		<rect fill="#e41a1c" height="320.0" stroke="white" width="53.333333333333336" x="213.33333333333334" y="159.0">
   -1    18 			<title>Oranges: 4</title>
   -1    19 		</rect>
   -1    20 	</g>
   -1    21 	<g>
   -1    22 		<rect fill="#e41a1c" height="320.0" stroke="white" width="53.333333333333336" x="373.3333333333333" y="159.0">
   -1    23 			<title>Pears: 4</title>
   -1    24 		</rect>
   -1    25 	</g>
   -1    26 	<g>
   -1    27 		<rect fill="#e41a1c" height="400.0" stroke="white" width="53.333333333333336" x="533.3333333333334" y="79.0">
   -1    28 			<title>Bananas: 5</title>
   -1    29 		</rect>
   -1    30 	</g>
   -1    31 </svg>