simplecharts

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

commit
278634e9c5d50d19c7578c6f336ddfa0bcddc883
parent
22e222d77e19e3bc6427bbf2798f438eb6005951
Author
Tobias Bengfort <bengfort@mpib-berlin.mpg.de>
Date
2026-04-13 11:40
tweak round_max()

Diffstat

M simplecharts.py 16 ++++++++++------
M test.py 4 ++--
M tests/float_StackedAreaRenderer.svg 22 +++++++++++-----------
M tests/float_StackedColumnRenderer.svg 16 ++++++++--------
M tests/long_StackedAreaRenderer.svg 54 +++++++++++++++++++++++++++---------------------------
M tests/long_StackedColumnRenderer.svg 44 ++++++++++++++++++++++----------------------
M tests/no-legend_StackedAreaRenderer.svg 34 +++++++++++++++++-----------------
M tests/no-legend_StackedColumnRenderer.svg 28 ++++++++++++++--------------
M tests/simple_StackedAreaRenderer.svg 34 +++++++++++++++++-----------------
M tests/simple_StackedColumnRenderer.svg 28 ++++++++++++++--------------

10 files changed, 142 insertions, 138 deletions


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

@@ -7,14 +7,18 @@ from xml.sax.saxutils import escape
    7     7 COLORS = ['#e41a1c', '#377eb8', '#4daf4a', '#984ea3', '#ff7f00', '#ffff33']
    8     8 
    9     9 
   10    -1 def round_max(value):
   -1    10 def round_max(value, headroom=1.1):
   11    11     if value <= 0:
   12    12         return 10
   13    -1     tail = 10 ** math.floor(math.log(value, 10))
   14    -1     head = int(value / tail) + 1
   15    -1     if head & 1:
   16    -1         head += 1
   17    -1     return head * tail
   -1    13     v = value * headroom / 2
   -1    14     tail = 10 ** math.floor(math.log(v, 10))
   -1    15     if v / tail < 1.5:
   -1    16         if tail >= 10:
   -1    17             tail //= 10
   -1    18         else:
   -1    19             tail /= 10
   -1    20     head = math.ceil(v / tail)
   -1    21     return head * tail * 2
   18    22 
   19    23 
   20    24 class BaseRenderer:

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

@@ -48,8 +48,8 @@ for fn in os.listdir(DIR):
   48    48         run_test(key, simplecharts.LineRenderer())
   49    49         run_test(key, simplecharts.StackedAreaRenderer())
   50    50 
   51    -1 test_round_max(10, 20)
   -1    51 test_round_max(10, 12)
   52    52 test_round_max(9, 10)
   53    53 test_round_max(9000, 10000)
   54    -1 test_round_max(0.01, 0.02)
   -1    54 test_round_max(0.01, 0.012)
   55    55 test_round_max(0.003, 0.004)

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

@@ -10,37 +10,37 @@
   10    10 		<line stroke="#333" x1="0" x2="640" y1="480" y2="480" />
   11    11 		<g aria-hidden="true">
   12    12 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="480">0</text>
   13    -1 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240">0.1</text>
   14    -1 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">0.2</text>
   -1    13 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240">0.06</text>
   -1    14 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">0.12</text>
   15    15 		</g>
   16    16 		<g role="row">
   17    17 			<text dominant-baseline="middle" fill="#333" role="columnheader" text-anchor="middle" x="160" y="490">Apples</text>
   18    18 			<text dominant-baseline="middle" fill="#333" role="columnheader" text-anchor="middle" x="480" y="490">Oranges</text>
   19    19 		</g>
   20    -1 		<polygon fill="#e41a1c" points="160,407 480,383 480,479 160,479" stroke="white" />
   21    -1 		<polygon fill="#377eb8" points="160,359 480,335 480,383 160,407" stroke="white" />
   22    -1 		<polygon fill="#4daf4a" points="160,239 480,263 480,335 160,359" stroke="white" />
   -1    20 		<polygon fill="#e41a1c" points="160,359 480,319 480,479 160,479" stroke="white" />
   -1    21 		<polygon fill="#377eb8" points="160,279 480,239 480,319 160,359" stroke="white" />
   -1    22 		<polygon fill="#4daf4a" points="160,79 480,119 480,239 160,279" stroke="white" />
   23    23 		<g fill="#e41a1c" role="row" stroke="white">
   24    -1 			<circle cx="160" cy="407" r="3" role="cell">
   -1    24 			<circle cx="160" cy="359" r="3" role="cell">
   25    25 				<title>0.03</title>
   26    26 			</circle>
   27    -1 			<circle cx="480" cy="383" r="3" role="cell">
   -1    27 			<circle cx="480" cy="319" r="3" role="cell">
   28    28 				<title>0.04</title>
   29    29 			</circle>
   30    30 		</g>
   31    31 		<g fill="#377eb8" role="row" stroke="white">
   32    -1 			<circle cx="160" cy="359" r="3" role="cell">
   -1    32 			<circle cx="160" cy="279" r="3" role="cell">
   33    33 				<title>0.02</title>
   34    34 			</circle>
   35    -1 			<circle cx="480" cy="335" r="3" role="cell">
   -1    35 			<circle cx="480" cy="239" r="3" role="cell">
   36    36 				<title>0.02</title>
   37    37 			</circle>
   38    38 		</g>
   39    39 		<g fill="#4daf4a" role="row" stroke="white">
   40    -1 			<circle cx="160" cy="239" r="3" role="cell">
   -1    40 			<circle cx="160" cy="79" r="3" role="cell">
   41    41 				<title>0.05</title>
   42    42 			</circle>
   43    -1 			<circle cx="480" cy="263" r="3" role="cell">
   -1    43 			<circle cx="480" cy="119" r="3" role="cell">
   44    44 				<title>0.03</title>
   45    45 			</circle>
   46    46 		</g>

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

@@ -10,34 +10,34 @@
   10    10 		<line stroke="#333" x1="0" x2="640" y1="480" y2="480" />
   11    11 		<g aria-hidden="true">
   12    12 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="480">0</text>
   13    -1 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240">0.1</text>
   14    -1 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">0.2</text>
   -1    13 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240">0.06</text>
   -1    14 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">0.12</text>
   15    15 		</g>
   16    16 		<g role="row">
   17    17 			<text dominant-baseline="middle" fill="#333" role="columnheader" text-anchor="middle" x="160" y="490">Apples</text>
   18    18 			<text dominant-baseline="middle" fill="#333" role="columnheader" text-anchor="middle" x="480" y="490">Oranges</text>
   19    19 		</g>
   20    20 		<g fill="#e41a1c" role="row" stroke="white">
   21    -1 			<rect height="72" role="cell" width="106.6667" x="106.6667" y="407">
   -1    21 			<rect height="120" role="cell" width="106.6667" x="106.6667" y="359">
   22    22 				<title>0.03</title>
   23    23 			</rect>
   24    -1 			<rect height="96" role="cell" width="106.6667" x="426.6667" y="383">
   -1    24 			<rect height="160" role="cell" width="106.6667" x="426.6667" y="319">
   25    25 				<title>0.04</title>
   26    26 			</rect>
   27    27 		</g>
   28    28 		<g fill="#377eb8" role="row" stroke="white">
   29    -1 			<rect height="48" role="cell" width="106.6667" x="106.6667" y="359">
   -1    29 			<rect height="80" role="cell" width="106.6667" x="106.6667" y="279">
   30    30 				<title>0.02</title>
   31    31 			</rect>
   32    -1 			<rect height="48" role="cell" width="106.6667" x="426.6667" y="335">
   -1    32 			<rect height="80" role="cell" width="106.6667" x="426.6667" y="239">
   33    33 				<title>0.02</title>
   34    34 			</rect>
   35    35 		</g>
   36    36 		<g fill="#4daf4a" role="row" stroke="white">
   37    -1 			<rect height="120" role="cell" width="106.6667" x="106.6667" y="239">
   -1    37 			<rect height="200" role="cell" width="106.6667" x="106.6667" y="79">
   38    38 				<title>0.05</title>
   39    39 			</rect>
   40    -1 			<rect height="72" role="cell" width="106.6667" x="426.6667" y="263">
   -1    40 			<rect height="120" role="cell" width="106.6667" x="426.6667" y="119">
   41    41 				<title>0.03</title>
   42    42 			</rect>
   43    43 		</g>

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

@@ -10,8 +10,8 @@
   10    10 		<line stroke="#333" x1="0" x2="640" y1="480" y2="480" />
   11    11 		<g aria-hidden="true">
   12    12 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="480">0</text>
   13    -1 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240">20</text>
   14    -1 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">40</text>
   -1    13 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240">11</text>
   -1    14 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">22</text>
   15    15 		</g>
   16    16 		<g role="row">
   17    17 			<text dominant-baseline="middle" fill="#333" role="columnheader" text-anchor="middle" x="80" y="490">Apples</text>
@@ -32,78 +32,78 @@
   32    32 			<rect fill="#ff7f00" height="10" width="10" x="308" y="5" />
   33    33 			<text dominant-baseline="middle" fill="#333" x="322" y="10">Other (82)</text>
   34    34 		</g>
   35    -1 		<polygon fill="#e41a1c" points="80,443 240,431 400,431 560,419 560,479 400,479 240,479 80,479" stroke="white" />
   36    -1 		<polygon fill="#377eb8" points="80,419 240,407 400,395 560,407 560,419 400,431 240,431 80,443" stroke="white" />
   37    -1 		<polygon fill="#4daf4a" points="80,359 240,371 400,347 560,383 560,407 400,395 240,407 80,419" stroke="white" />
   38    -1 		<polygon fill="#984ea3" points="80,311 240,347 400,335 560,335 560,383 400,347 240,371 80,359" stroke="white" />
   39    -1 		<polygon fill="#ff7f00" points="80,239 240,299 400,275 560,311 560,335 400,335 240,347 80,311" stroke="white" />
   -1    35 		<polygon fill="#e41a1c" points="80,413.5455 240,391.7273 400,391.7273 560,369.9091 560,479 400,479 240,479 80,479" stroke="white" />
   -1    36 		<polygon fill="#377eb8" points="80,369.9091 240,348.0909 400,326.2727 560,348.0909 560,369.9091 400,391.7273 240,391.7273 80,413.5455" stroke="white" />
   -1    37 		<polygon fill="#4daf4a" points="80,260.8182 240,282.6364 400,239 560,304.4545 560,348.0909 400,326.2727 240,348.0909 80,369.9091" stroke="white" />
   -1    38 		<polygon fill="#984ea3" points="80,173.5455 240,239 400,217.1818 560,217.1818 560,304.4545 400,239 240,282.6364 80,260.8182" stroke="white" />
   -1    39 		<polygon fill="#ff7f00" points="80,42.6364 240,151.7273 400,108.0909 560,173.5455 560,217.1818 400,217.1818 240,239 80,173.5455" stroke="white" />
   40    40 		<g fill="#e41a1c" role="row" stroke="white">
   41    -1 			<circle cx="80" cy="443" r="3" role="cell">
   -1    41 			<circle cx="80" cy="413.5455" r="3" role="cell">
   42    42 				<title>3</title>
   43    43 			</circle>
   44    -1 			<circle cx="240" cy="431" r="3" role="cell">
   -1    44 			<circle cx="240" cy="391.7273" r="3" role="cell">
   45    45 				<title>4</title>
   46    46 			</circle>
   47    -1 			<circle cx="400" cy="431" r="3" role="cell">
   -1    47 			<circle cx="400" cy="391.7273" r="3" role="cell">
   48    48 				<title>4</title>
   49    49 			</circle>
   50    -1 			<circle cx="560" cy="419" r="3" role="cell">
   -1    50 			<circle cx="560" cy="369.9091" r="3" role="cell">
   51    51 				<title>5</title>
   52    52 			</circle>
   53    53 		</g>
   54    54 		<g fill="#377eb8" role="row" stroke="white">
   55    -1 			<circle cx="80" cy="419" r="3" role="cell">
   -1    55 			<circle cx="80" cy="369.9091" r="3" role="cell">
   56    56 				<title>2</title>
   57    57 			</circle>
   58    -1 			<circle cx="240" cy="407" r="3" role="cell">
   -1    58 			<circle cx="240" cy="348.0909" r="3" role="cell">
   59    59 				<title>2</title>
   60    60 			</circle>
   61    -1 			<circle cx="400" cy="395" r="3" role="cell">
   -1    61 			<circle cx="400" cy="326.2727" r="3" role="cell">
   62    62 				<title>3</title>
   63    63 			</circle>
   64    -1 			<circle cx="560" cy="407" r="3" role="cell">
   -1    64 			<circle cx="560" cy="348.0909" r="3" role="cell">
   65    65 				<title>1</title>
   66    66 			</circle>
   67    67 		</g>
   68    68 		<g fill="#4daf4a" role="row" stroke="white">
   69    -1 			<circle cx="80" cy="359" r="3" role="cell">
   -1    69 			<circle cx="80" cy="260.8182" r="3" role="cell">
   70    70 				<title>5</title>
   71    71 			</circle>
   72    -1 			<circle cx="240" cy="371" r="3" role="cell">
   -1    72 			<circle cx="240" cy="282.6364" r="3" role="cell">
   73    73 				<title>3</title>
   74    74 			</circle>
   75    -1 			<circle cx="400" cy="347" r="3" role="cell">
   -1    75 			<circle cx="400" cy="239" r="3" role="cell">
   76    76 				<title>4</title>
   77    77 			</circle>
   78    -1 			<circle cx="560" cy="383" r="3" role="cell">
   -1    78 			<circle cx="560" cy="304.4545" r="3" role="cell">
   79    79 				<title>2</title>
   80    80 			</circle>
   81    81 		</g>
   82    82 		<g fill="#984ea3" role="row" stroke="white">
   83    -1 			<circle cx="80" cy="311" r="3" role="cell">
   -1    83 			<circle cx="80" cy="173.5455" r="3" role="cell">
   84    84 				<title>4</title>
   85    85 			</circle>
   86    -1 			<circle cx="240" cy="347" r="3" role="cell">
   -1    86 			<circle cx="240" cy="239" r="3" role="cell">
   87    87 				<title>2</title>
   88    88 			</circle>
   89    -1 			<circle cx="400" cy="335" r="3" role="cell">
   -1    89 			<circle cx="400" cy="217.1818" r="3" role="cell">
   90    90 				<title>1</title>
   91    91 			</circle>
   92    -1 			<circle cx="560" cy="335" r="3" role="cell">
   -1    92 			<circle cx="560" cy="217.1818" r="3" role="cell">
   93    93 				<title>4</title>
   94    94 			</circle>
   95    95 		</g>
   96    96 		<g fill="#ff7f00" role="row" stroke="white">
   97    -1 			<circle cx="80" cy="239" r="3" role="cell">
   -1    97 			<circle cx="80" cy="42.6364" r="3" role="cell">
   98    98 				<title>6</title>
   99    99 			</circle>
  100    -1 			<circle cx="240" cy="299" r="3" role="cell">
   -1   100 			<circle cx="240" cy="151.7273" r="3" role="cell">
  101   101 				<title>4</title>
  102   102 			</circle>
  103    -1 			<circle cx="400" cy="275" r="3" role="cell">
   -1   103 			<circle cx="400" cy="108.0909" r="3" role="cell">
  104   104 				<title>5</title>
  105   105 			</circle>
  106    -1 			<circle cx="560" cy="311" r="3" role="cell">
   -1   106 			<circle cx="560" cy="173.5455" r="3" role="cell">
  107   107 				<title>2</title>
  108   108 			</circle>
  109   109 		</g>

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

@@ -10,8 +10,8 @@
   10    10 		<line stroke="#333" x1="0" x2="640" y1="480" y2="480" />
   11    11 		<g aria-hidden="true">
   12    12 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="480">0</text>
   13    -1 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240">20</text>
   14    -1 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">40</text>
   -1    13 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240">11</text>
   -1    14 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">22</text>
   15    15 		</g>
   16    16 		<g role="row">
   17    17 			<text dominant-baseline="middle" fill="#333" role="columnheader" text-anchor="middle" x="80" y="490">Apples</text>
@@ -33,72 +33,72 @@
   33    33 			<text dominant-baseline="middle" fill="#333" x="322" y="10">Other (82)</text>
   34    34 		</g>
   35    35 		<g fill="#e41a1c" role="row" stroke="white">
   36    -1 			<rect height="36" role="cell" width="53.3333" x="53.3333" y="443">
   -1    36 			<rect height="65.4545" role="cell" width="53.3333" x="53.3333" y="413.5455">
   37    37 				<title>3</title>
   38    38 			</rect>
   39    -1 			<rect height="48" role="cell" width="53.3333" x="213.3333" y="431">
   -1    39 			<rect height="87.2727" role="cell" width="53.3333" x="213.3333" y="391.7273">
   40    40 				<title>4</title>
   41    41 			</rect>
   42    -1 			<rect height="48" role="cell" width="53.3333" x="373.3333" y="431">
   -1    42 			<rect height="87.2727" role="cell" width="53.3333" x="373.3333" y="391.7273">
   43    43 				<title>4</title>
   44    44 			</rect>
   45    -1 			<rect height="60" role="cell" width="53.3333" x="533.3333" y="419">
   -1    45 			<rect height="109.0909" role="cell" width="53.3333" x="533.3333" y="369.9091">
   46    46 				<title>5</title>
   47    47 			</rect>
   48    48 		</g>
   49    49 		<g fill="#377eb8" role="row" stroke="white">
   50    -1 			<rect height="24" role="cell" width="53.3333" x="53.3333" y="419">
   -1    50 			<rect height="43.6364" role="cell" width="53.3333" x="53.3333" y="369.9091">
   51    51 				<title>2</title>
   52    52 			</rect>
   53    -1 			<rect height="24" role="cell" width="53.3333" x="213.3333" y="407">
   -1    53 			<rect height="43.6364" role="cell" width="53.3333" x="213.3333" y="348.0909">
   54    54 				<title>2</title>
   55    55 			</rect>
   56    -1 			<rect height="36" role="cell" width="53.3333" x="373.3333" y="395">
   -1    56 			<rect height="65.4545" role="cell" width="53.3333" x="373.3333" y="326.2727">
   57    57 				<title>3</title>
   58    58 			</rect>
   59    -1 			<rect height="12" role="cell" width="53.3333" x="533.3333" y="407">
   -1    59 			<rect height="21.8182" role="cell" width="53.3333" x="533.3333" y="348.0909">
   60    60 				<title>1</title>
   61    61 			</rect>
   62    62 		</g>
   63    63 		<g fill="#4daf4a" role="row" stroke="white">
   64    -1 			<rect height="60" role="cell" width="53.3333" x="53.3333" y="359">
   -1    64 			<rect height="109.0909" role="cell" width="53.3333" x="53.3333" y="260.8182">
   65    65 				<title>5</title>
   66    66 			</rect>
   67    -1 			<rect height="36" role="cell" width="53.3333" x="213.3333" y="371">
   -1    67 			<rect height="65.4545" role="cell" width="53.3333" x="213.3333" y="282.6364">
   68    68 				<title>3</title>
   69    69 			</rect>
   70    -1 			<rect height="48" role="cell" width="53.3333" x="373.3333" y="347">
   -1    70 			<rect height="87.2727" role="cell" width="53.3333" x="373.3333" y="239">
   71    71 				<title>4</title>
   72    72 			</rect>
   73    -1 			<rect height="24" role="cell" width="53.3333" x="533.3333" y="383">
   -1    73 			<rect height="43.6364" role="cell" width="53.3333" x="533.3333" y="304.4545">
   74    74 				<title>2</title>
   75    75 			</rect>
   76    76 		</g>
   77    77 		<g fill="#984ea3" role="row" stroke="white">
   78    -1 			<rect height="48" role="cell" width="53.3333" x="53.3333" y="311">
   -1    78 			<rect height="87.2727" role="cell" width="53.3333" x="53.3333" y="173.5455">
   79    79 				<title>4</title>
   80    80 			</rect>
   81    -1 			<rect height="24" role="cell" width="53.3333" x="213.3333" y="347">
   -1    81 			<rect height="43.6364" role="cell" width="53.3333" x="213.3333" y="239">
   82    82 				<title>2</title>
   83    83 			</rect>
   84    -1 			<rect height="12" role="cell" width="53.3333" x="373.3333" y="335">
   -1    84 			<rect height="21.8182" role="cell" width="53.3333" x="373.3333" y="217.1818">
   85    85 				<title>1</title>
   86    86 			</rect>
   87    -1 			<rect height="48" role="cell" width="53.3333" x="533.3333" y="335">
   -1    87 			<rect height="87.2727" role="cell" width="53.3333" x="533.3333" y="217.1818">
   88    88 				<title>4</title>
   89    89 			</rect>
   90    90 		</g>
   91    91 		<g fill="#ff7f00" role="row" stroke="white">
   92    -1 			<rect height="72" role="cell" width="53.3333" x="53.3333" y="239">
   -1    92 			<rect height="130.9091" role="cell" width="53.3333" x="53.3333" y="42.6364">
   93    93 				<title>6</title>
   94    94 			</rect>
   95    -1 			<rect height="48" role="cell" width="53.3333" x="213.3333" y="299">
   -1    95 			<rect height="87.2727" role="cell" width="53.3333" x="213.3333" y="151.7273">
   96    96 				<title>4</title>
   97    97 			</rect>
   98    -1 			<rect height="60" role="cell" width="53.3333" x="373.3333" y="275">
   -1    98 			<rect height="109.0909" role="cell" width="53.3333" x="373.3333" y="108.0909">
   99    99 				<title>5</title>
  100   100 			</rect>
  101    -1 			<rect height="24" role="cell" width="53.3333" x="533.3333" y="311">
   -1   101 			<rect height="43.6364" role="cell" width="53.3333" x="533.3333" y="173.5455">
  102   102 				<title>2</title>
  103   103 			</rect>
  104   104 		</g>

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

@@ -10,8 +10,8 @@
   10    10 		<line stroke="#333" x1="0" x2="640" y1="480" y2="480" />
   11    11 		<g aria-hidden="true">
   12    12 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="480">0</text>
   13    -1 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240">10</text>
   14    -1 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">20</text>
   -1    13 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240">7</text>
   -1    14 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">14</text>
   15    15 		</g>
   16    16 		<g role="row">
   17    17 			<text dominant-baseline="middle" fill="#333" role="columnheader" text-anchor="middle" x="80" y="490">Apples</text>
@@ -19,48 +19,48 @@
   19    19 			<text dominant-baseline="middle" fill="#333" role="columnheader" text-anchor="middle" x="400" y="490">Pears</text>
   20    20 			<text dominant-baseline="middle" fill="#333" role="columnheader" text-anchor="middle" x="560" y="490">Bananas</text>
   21    21 		</g>
   22    -1 		<polygon fill="#e41a1c" points="80,407 240,383 400,383 560,359 560,479 400,479 240,479 80,479" stroke="white" />
   23    -1 		<polygon fill="#377eb8" points="80,359 240,335 400,311 560,335 560,359 400,383 240,383 80,407" stroke="white" />
   24    -1 		<polygon fill="#4daf4a" points="80,239 240,263 400,215 560,287 560,335 400,311 240,335 80,359" stroke="white" />
   -1    22 		<polygon fill="#e41a1c" points="80,376.1429 240,341.8571 400,341.8571 560,307.5714 560,479 400,479 240,479 80,479" stroke="white" />
   -1    23 		<polygon fill="#377eb8" points="80,307.5714 240,273.2857 400,239 560,273.2857 560,307.5714 400,341.8571 240,341.8571 80,376.1429" stroke="white" />
   -1    24 		<polygon fill="#4daf4a" points="80,136.1429 240,170.4286 400,101.8571 560,204.7143 560,273.2857 400,239 240,273.2857 80,307.5714" stroke="white" />
   25    25 		<g fill="#e41a1c" role="row" stroke="white">
   26    -1 			<circle cx="80" cy="407" r="3" role="cell">
   -1    26 			<circle cx="80" cy="376.1429" r="3" role="cell">
   27    27 				<title>3</title>
   28    28 			</circle>
   29    -1 			<circle cx="240" cy="383" r="3" role="cell">
   -1    29 			<circle cx="240" cy="341.8571" r="3" role="cell">
   30    30 				<title>4</title>
   31    31 			</circle>
   32    -1 			<circle cx="400" cy="383" r="3" role="cell">
   -1    32 			<circle cx="400" cy="341.8571" r="3" role="cell">
   33    33 				<title>4</title>
   34    34 			</circle>
   35    -1 			<circle cx="560" cy="359" r="3" role="cell">
   -1    35 			<circle cx="560" cy="307.5714" r="3" role="cell">
   36    36 				<title>5</title>
   37    37 			</circle>
   38    38 		</g>
   39    39 		<g fill="#377eb8" role="row" stroke="white">
   40    -1 			<circle cx="80" cy="359" r="3" role="cell">
   -1    40 			<circle cx="80" cy="307.5714" r="3" role="cell">
   41    41 				<title>2</title>
   42    42 			</circle>
   43    -1 			<circle cx="240" cy="335" r="3" role="cell">
   -1    43 			<circle cx="240" cy="273.2857" r="3" role="cell">
   44    44 				<title>2</title>
   45    45 			</circle>
   46    -1 			<circle cx="400" cy="311" r="3" role="cell">
   -1    46 			<circle cx="400" cy="239" r="3" role="cell">
   47    47 				<title>3</title>
   48    48 			</circle>
   49    -1 			<circle cx="560" cy="335" r="3" role="cell">
   -1    49 			<circle cx="560" cy="273.2857" r="3" role="cell">
   50    50 				<title>1</title>
   51    51 			</circle>
   52    52 		</g>
   53    53 		<g fill="#4daf4a" role="row" stroke="white">
   54    -1 			<circle cx="80" cy="239" r="3" role="cell">
   -1    54 			<circle cx="80" cy="136.1429" r="3" role="cell">
   55    55 				<title>5</title>
   56    56 			</circle>
   57    -1 			<circle cx="240" cy="263" r="3" role="cell">
   -1    57 			<circle cx="240" cy="170.4286" r="3" role="cell">
   58    58 				<title>3</title>
   59    59 			</circle>
   60    -1 			<circle cx="400" cy="215" r="3" role="cell">
   -1    60 			<circle cx="400" cy="101.8571" r="3" role="cell">
   61    61 				<title>4</title>
   62    62 			</circle>
   63    -1 			<circle cx="560" cy="287" r="3" role="cell">
   -1    63 			<circle cx="560" cy="204.7143" r="3" role="cell">
   64    64 				<title>2</title>
   65    65 			</circle>
   66    66 		</g>

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

@@ -10,8 +10,8 @@
   10    10 		<line stroke="#333" x1="0" x2="640" y1="480" y2="480" />
   11    11 		<g aria-hidden="true">
   12    12 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="480">0</text>
   13    -1 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240">10</text>
   14    -1 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">20</text>
   -1    13 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240">7</text>
   -1    14 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">14</text>
   15    15 		</g>
   16    16 		<g role="row">
   17    17 			<text dominant-baseline="middle" fill="#333" role="columnheader" text-anchor="middle" x="80" y="490">Apples</text>
@@ -20,44 +20,44 @@
   20    20 			<text dominant-baseline="middle" fill="#333" role="columnheader" text-anchor="middle" x="560" y="490">Bananas</text>
   21    21 		</g>
   22    22 		<g fill="#e41a1c" role="row" stroke="white">
   23    -1 			<rect height="72" role="cell" width="53.3333" x="53.3333" y="407">
   -1    23 			<rect height="102.8571" role="cell" width="53.3333" x="53.3333" y="376.1429">
   24    24 				<title>3</title>
   25    25 			</rect>
   26    -1 			<rect height="96" role="cell" width="53.3333" x="213.3333" y="383">
   -1    26 			<rect height="137.1429" role="cell" width="53.3333" x="213.3333" y="341.8571">
   27    27 				<title>4</title>
   28    28 			</rect>
   29    -1 			<rect height="96" role="cell" width="53.3333" x="373.3333" y="383">
   -1    29 			<rect height="137.1429" role="cell" width="53.3333" x="373.3333" y="341.8571">
   30    30 				<title>4</title>
   31    31 			</rect>
   32    -1 			<rect height="120" role="cell" width="53.3333" x="533.3333" y="359">
   -1    32 			<rect height="171.4286" role="cell" width="53.3333" x="533.3333" y="307.5714">
   33    33 				<title>5</title>
   34    34 			</rect>
   35    35 		</g>
   36    36 		<g fill="#377eb8" role="row" stroke="white">
   37    -1 			<rect height="48" role="cell" width="53.3333" x="53.3333" y="359">
   -1    37 			<rect height="68.5714" role="cell" width="53.3333" x="53.3333" y="307.5714">
   38    38 				<title>2</title>
   39    39 			</rect>
   40    -1 			<rect height="48" role="cell" width="53.3333" x="213.3333" y="335">
   -1    40 			<rect height="68.5714" role="cell" width="53.3333" x="213.3333" y="273.2857">
   41    41 				<title>2</title>
   42    42 			</rect>
   43    -1 			<rect height="72" role="cell" width="53.3333" x="373.3333" y="311">
   -1    43 			<rect height="102.8571" role="cell" width="53.3333" x="373.3333" y="239">
   44    44 				<title>3</title>
   45    45 			</rect>
   46    -1 			<rect height="24" role="cell" width="53.3333" x="533.3333" y="335">
   -1    46 			<rect height="34.2857" role="cell" width="53.3333" x="533.3333" y="273.2857">
   47    47 				<title>1</title>
   48    48 			</rect>
   49    49 		</g>
   50    50 		<g fill="#4daf4a" role="row" stroke="white">
   51    -1 			<rect height="120" role="cell" width="53.3333" x="53.3333" y="239">
   -1    51 			<rect height="171.4286" role="cell" width="53.3333" x="53.3333" y="136.1429">
   52    52 				<title>5</title>
   53    53 			</rect>
   54    -1 			<rect height="72" role="cell" width="53.3333" x="213.3333" y="263">
   -1    54 			<rect height="102.8571" role="cell" width="53.3333" x="213.3333" y="170.4286">
   55    55 				<title>3</title>
   56    56 			</rect>
   57    -1 			<rect height="96" role="cell" width="53.3333" x="373.3333" y="215">
   -1    57 			<rect height="137.1429" role="cell" width="53.3333" x="373.3333" y="101.8571">
   58    58 				<title>4</title>
   59    59 			</rect>
   60    -1 			<rect height="48" role="cell" width="53.3333" x="533.3333" y="287">
   -1    60 			<rect height="68.5714" role="cell" width="53.3333" x="533.3333" y="204.7143">
   61    61 				<title>2</title>
   62    62 			</rect>
   63    63 		</g>

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

@@ -10,8 +10,8 @@
   10    10 		<line stroke="#333" x1="0" x2="640" y1="480" y2="480" />
   11    11 		<g aria-hidden="true">
   12    12 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="480">0</text>
   13    -1 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240">10</text>
   14    -1 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">20</text>
   -1    13 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240">7</text>
   -1    14 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">14</text>
   15    15 		</g>
   16    16 		<g role="row">
   17    17 			<text dominant-baseline="middle" fill="#333" role="columnheader" text-anchor="middle" x="80" y="490">Apples</text>
@@ -28,48 +28,48 @@
   28    28 			<rect fill="#4daf4a" height="10" width="10" x="592" y="-15" />
   29    29 			<text dominant-baseline="middle" fill="#333" x="606" y="-10">Joe</text>
   30    30 		</g>
   31    -1 		<polygon fill="#e41a1c" points="80,407 240,383 400,383 560,359 560,479 400,479 240,479 80,479" stroke="white" />
   32    -1 		<polygon fill="#377eb8" points="80,359 240,335 400,311 560,335 560,359 400,383 240,383 80,407" stroke="white" />
   33    -1 		<polygon fill="#4daf4a" points="80,239 240,263 400,215 560,287 560,335 400,311 240,335 80,359" stroke="white" />
   -1    31 		<polygon fill="#e41a1c" points="80,376.1429 240,341.8571 400,341.8571 560,307.5714 560,479 400,479 240,479 80,479" stroke="white" />
   -1    32 		<polygon fill="#377eb8" points="80,307.5714 240,273.2857 400,239 560,273.2857 560,307.5714 400,341.8571 240,341.8571 80,376.1429" stroke="white" />
   -1    33 		<polygon fill="#4daf4a" points="80,136.1429 240,170.4286 400,101.8571 560,204.7143 560,273.2857 400,239 240,273.2857 80,307.5714" stroke="white" />
   34    34 		<g fill="#e41a1c" role="row" stroke="white">
   35    -1 			<circle cx="80" cy="407" r="3" role="cell">
   -1    35 			<circle cx="80" cy="376.1429" r="3" role="cell">
   36    36 				<title>3</title>
   37    37 			</circle>
   38    -1 			<circle cx="240" cy="383" r="3" role="cell">
   -1    38 			<circle cx="240" cy="341.8571" r="3" role="cell">
   39    39 				<title>4</title>
   40    40 			</circle>
   41    -1 			<circle cx="400" cy="383" r="3" role="cell">
   -1    41 			<circle cx="400" cy="341.8571" r="3" role="cell">
   42    42 				<title>4</title>
   43    43 			</circle>
   44    -1 			<circle cx="560" cy="359" r="3" role="cell">
   -1    44 			<circle cx="560" cy="307.5714" r="3" role="cell">
   45    45 				<title>5</title>
   46    46 			</circle>
   47    47 		</g>
   48    48 		<g fill="#377eb8" role="row" stroke="white">
   49    -1 			<circle cx="80" cy="359" r="3" role="cell">
   -1    49 			<circle cx="80" cy="307.5714" r="3" role="cell">
   50    50 				<title>2</title>
   51    51 			</circle>
   52    -1 			<circle cx="240" cy="335" r="3" role="cell">
   -1    52 			<circle cx="240" cy="273.2857" r="3" role="cell">
   53    53 				<title>2</title>
   54    54 			</circle>
   55    -1 			<circle cx="400" cy="311" r="3" role="cell">
   -1    55 			<circle cx="400" cy="239" r="3" role="cell">
   56    56 				<title>3</title>
   57    57 			</circle>
   58    -1 			<circle cx="560" cy="335" r="3" role="cell">
   -1    58 			<circle cx="560" cy="273.2857" r="3" role="cell">
   59    59 				<title>1</title>
   60    60 			</circle>
   61    61 		</g>
   62    62 		<g fill="#4daf4a" role="row" stroke="white">
   63    -1 			<circle cx="80" cy="239" r="3" role="cell">
   -1    63 			<circle cx="80" cy="136.1429" r="3" role="cell">
   64    64 				<title>5</title>
   65    65 			</circle>
   66    -1 			<circle cx="240" cy="263" r="3" role="cell">
   -1    66 			<circle cx="240" cy="170.4286" r="3" role="cell">
   67    67 				<title>3</title>
   68    68 			</circle>
   69    -1 			<circle cx="400" cy="215" r="3" role="cell">
   -1    69 			<circle cx="400" cy="101.8571" r="3" role="cell">
   70    70 				<title>4</title>
   71    71 			</circle>
   72    -1 			<circle cx="560" cy="287" r="3" role="cell">
   -1    72 			<circle cx="560" cy="204.7143" r="3" role="cell">
   73    73 				<title>2</title>
   74    74 			</circle>
   75    75 		</g>

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

@@ -10,8 +10,8 @@
   10    10 		<line stroke="#333" x1="0" x2="640" y1="480" y2="480" />
   11    11 		<g aria-hidden="true">
   12    12 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="480">0</text>
   13    -1 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240">10</text>
   14    -1 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">20</text>
   -1    13 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="240">7</text>
   -1    14 			<text dominant-baseline="middle" fill="#333" text-anchor="end" x="-4" y="0">14</text>
   15    15 		</g>
   16    16 		<g role="row">
   17    17 			<text dominant-baseline="middle" fill="#333" role="columnheader" text-anchor="middle" x="80" y="490">Apples</text>
@@ -29,44 +29,44 @@
   29    29 			<text dominant-baseline="middle" fill="#333" x="606" y="-10">Joe</text>
   30    30 		</g>
   31    31 		<g fill="#e41a1c" role="row" stroke="white">
   32    -1 			<rect height="72" role="cell" width="53.3333" x="53.3333" y="407">
   -1    32 			<rect height="102.8571" role="cell" width="53.3333" x="53.3333" y="376.1429">
   33    33 				<title>3</title>
   34    34 			</rect>
   35    -1 			<rect height="96" role="cell" width="53.3333" x="213.3333" y="383">
   -1    35 			<rect height="137.1429" role="cell" width="53.3333" x="213.3333" y="341.8571">
   36    36 				<title>4</title>
   37    37 			</rect>
   38    -1 			<rect height="96" role="cell" width="53.3333" x="373.3333" y="383">
   -1    38 			<rect height="137.1429" role="cell" width="53.3333" x="373.3333" y="341.8571">
   39    39 				<title>4</title>
   40    40 			</rect>
   41    -1 			<rect height="120" role="cell" width="53.3333" x="533.3333" y="359">
   -1    41 			<rect height="171.4286" role="cell" width="53.3333" x="533.3333" y="307.5714">
   42    42 				<title>5</title>
   43    43 			</rect>
   44    44 		</g>
   45    45 		<g fill="#377eb8" role="row" stroke="white">
   46    -1 			<rect height="48" role="cell" width="53.3333" x="53.3333" y="359">
   -1    46 			<rect height="68.5714" role="cell" width="53.3333" x="53.3333" y="307.5714">
   47    47 				<title>2</title>
   48    48 			</rect>
   49    -1 			<rect height="48" role="cell" width="53.3333" x="213.3333" y="335">
   -1    49 			<rect height="68.5714" role="cell" width="53.3333" x="213.3333" y="273.2857">
   50    50 				<title>2</title>
   51    51 			</rect>
   52    -1 			<rect height="72" role="cell" width="53.3333" x="373.3333" y="311">
   -1    52 			<rect height="102.8571" role="cell" width="53.3333" x="373.3333" y="239">
   53    53 				<title>3</title>
   54    54 			</rect>
   55    -1 			<rect height="24" role="cell" width="53.3333" x="533.3333" y="335">
   -1    55 			<rect height="34.2857" role="cell" width="53.3333" x="533.3333" y="273.2857">
   56    56 				<title>1</title>
   57    57 			</rect>
   58    58 		</g>
   59    59 		<g fill="#4daf4a" role="row" stroke="white">
   60    -1 			<rect height="120" role="cell" width="53.3333" x="53.3333" y="239">
   -1    60 			<rect height="171.4286" role="cell" width="53.3333" x="53.3333" y="136.1429">
   61    61 				<title>5</title>
   62    62 			</rect>
   63    -1 			<rect height="72" role="cell" width="53.3333" x="213.3333" y="263">
   -1    63 			<rect height="102.8571" role="cell" width="53.3333" x="213.3333" y="170.4286">
   64    64 				<title>3</title>
   65    65 			</rect>
   66    -1 			<rect height="96" role="cell" width="53.3333" x="373.3333" y="215">
   -1    66 			<rect height="137.1429" role="cell" width="53.3333" x="373.3333" y="101.8571">
   67    67 				<title>4</title>
   68    68 			</rect>
   69    -1 			<rect height="48" role="cell" width="53.3333" x="533.3333" y="287">
   -1    69 			<rect height="68.5714" role="cell" width="53.3333" x="533.3333" y="204.7143">
   70    70 				<title>2</title>
   71    71 			</rect>
   72    72 		</g>