simplecharts

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

commit
5d533f793a725a77fba02a1a9b092f5df2e275e4
parent
7b5e2b849230ae9f8e87332b8a72978c8f8b33e9
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2019-02-19 12:55
add README

Diffstat

A README.md 30 ++++++++++++++++++++++++++++++
A example.svg 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

2 files changed, 95 insertions, 0 deletions


diff --git a/README.md b/README.md

@@ -0,0 +1,30 @@
   -1     1 # Features
   -1     2 
   -1     3 -   no big dependencies
   -1     4 -   produces clean SVG
   -1     5 -   available charts: grouped columns, stacked columns, lines, stacked areas
   -1     6 
   -1     7 # Usage
   -1     8 
   -1     9 ```python
   -1    10 renderer = StackedColumnRenderer()
   -1    11 data = {
   -1    12     'rows': [{
   -1    13         'label': 'Apples',
   -1    14         'values': [3, 2, 5],
   -1    15     }, {
   -1    16         'label': 'Oranges',
   -1    17         'values': [4, 2, 3],
   -1    18     }, {
   -1    19         'label': 'Pears',
   -1    20         'values': [4, 3, 4],
   -1    21     }, {
   -1    22         'label': 'Bananas',
   -1    23         'values': [5, 1, 2],
   -1    24     }],
   -1    25     'legend': ['John', 'Jane', 'Joe'],
   -1    26 }
   -1    27 svg = renderer.render(data)
   -1    28 ```
   -1    29 
   -1    30 ![example](https://github.com/xi/simplecharts/blob/master/example.svg)

diff --git a/example.svg b/example.svg

@@ -0,0 +1,65 @@
   -1     1 <svg xmlns="http://www.w3.org/2000/svg" viewBox="-55 -25 700 530">
   -1     2 	<line y1="0" x2="0" stroke="#333" y2="480" x1="0" />
   -1     3 	<line y1="480" x2="640" stroke="#333" y2="480" x1="0" />
   -1     4 	<text y="480" x="-4" dominant-baseline="middle" text-anchor="end" fill="#333">0</text>
   -1     5 	<text y="240" x="-4" dominant-baseline="middle" text-anchor="end" fill="#333">10</text>
   -1     6 	<text y="0" x="-4" dominant-baseline="middle" text-anchor="end" fill="#333">20</text>
   -1     7 	<text y="490" x="80.0" dominant-baseline="middle" text-anchor="middle" fill="#333">Apples</text>
   -1     8 	<text y="490" x="240.0" dominant-baseline="middle" text-anchor="middle" fill="#333">Oranges</text>
   -1     9 	<text y="490" x="400.0" dominant-baseline="middle" text-anchor="middle" fill="#333">Pears</text>
   -1    10 	<text y="490" x="560.0" dominant-baseline="middle" text-anchor="middle" fill="#333">Bananas</text>
   -1    11 	<g>
   -1    12 		<rect height="20" width="180" stroke="#333" y="-20" x="460" fill="none" />
   -1    13 		<rect y="-15" width="10" height="10" x="464" fill="#e41a1c" />
   -1    14 		<text y="-10" x="478" dominant-baseline="middle" fill="#333">John</text>
   -1    15 		<rect y="-15" width="10" height="10" x="528" fill="#377eb8" />
   -1    16 		<text y="-10" x="542" dominant-baseline="middle" fill="#333">Jane</text>
   -1    17 		<rect y="-15" width="10" height="10" x="592" fill="#4daf4a" />
   -1    18 		<text y="-10" x="606" dominant-baseline="middle" fill="#333">Joe</text>
   -1    19 	</g>
   -1    20 	<g>
   -1    21 		<rect height="72" width="53" stroke="white" y="407" x="54.0" fill="#e41a1c">
   -1    22 			<title>Apples - John: 3</title>
   -1    23 		</rect>
   -1    24 		<rect height="48" width="53" stroke="white" y="359" x="54.0" fill="#377eb8">
   -1    25 			<title>Apples - Jane: 2</title>
   -1    26 		</rect>
   -1    27 		<rect height="120" width="53" stroke="white" y="239" x="54.0" fill="#4daf4a">
   -1    28 			<title>Apples - Joe: 5</title>
   -1    29 		</rect>
   -1    30 	</g>
   -1    31 	<g>
   -1    32 		<rect height="96" width="53" stroke="white" y="383" x="214.0" fill="#e41a1c">
   -1    33 			<title>Oranges - John: 4</title>
   -1    34 		</rect>
   -1    35 		<rect height="48" width="53" stroke="white" y="335" x="214.0" fill="#377eb8">
   -1    36 			<title>Oranges - Jane: 2</title>
   -1    37 		</rect>
   -1    38 		<rect height="72" width="53" stroke="white" y="263" x="214.0" fill="#4daf4a">
   -1    39 			<title>Oranges - Joe: 3</title>
   -1    40 		</rect>
   -1    41 	</g>
   -1    42 	<g>
   -1    43 		<rect height="96" width="53" stroke="white" y="383" x="374.0" fill="#e41a1c">
   -1    44 			<title>Pears - John: 4</title>
   -1    45 		</rect>
   -1    46 		<rect height="72" width="53" stroke="white" y="311" x="374.0" fill="#377eb8">
   -1    47 			<title>Pears - Jane: 3</title>
   -1    48 		</rect>
   -1    49 		<rect height="96" width="53" stroke="white" y="215" x="374.0" fill="#4daf4a">
   -1    50 			<title>Pears - Joe: 4</title>
   -1    51 		</rect>
   -1    52 	</g>
   -1    53 	<g>
   -1    54 		<rect height="120" width="53" stroke="white" y="359" x="534.0" fill="#e41a1c">
   -1    55 			<title>Bananas - John: 5</title>
   -1    56 		</rect>
   -1    57 		<rect height="24" width="53" stroke="white" y="335" x="534.0" fill="#377eb8">
   -1    58 			<title>Bananas - Jane: 1</title>
   -1    59 		</rect>
   -1    60 		<rect height="48" width="53" stroke="white" y="287" x="534.0" fill="#4daf4a">
   -1    61 			<title>Bananas - Joe: 2</title>
   -1    62 		</rect>
   -1    63 	</g>
   -1    64 </svg>
   -1    65