chartist-svg 0.2.4 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2018-22 Subhajit Sahu
3
+ Copyright (c) 2018-23 Subhajit Sahu
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  Generate SVG chart using [Chartist].
2
- > You can paste the SVG code to a file directly.
2
+ > You can paste the SVG code to a file directly. \
3
+ > Use [SVGViewer](https://www.svgviewer.dev) to view the generated SVG.
3
4
 
4
5
  <br>
5
6
 
@@ -42,18 +43,24 @@ options: {
42
43
  Example:
43
44
 
44
45
  ```javascript
46
+ const Chartist = require('chartist');
47
+ const chartistSvg = require('chartist-svg');
48
+
45
49
  var data = {
46
50
  title: 'Time to play PUBG',
47
51
  subtitle: 'Player Unknown\'s Battleground',
48
52
  labels: ['P', 'U', 'B', 'G'],
49
53
  series: [
50
54
  [1, 2, 3, 4],
51
- [3, 4, 5, 6]
55
+ [3, 5, 5, 6],
52
56
  ]
53
57
  };
58
+
54
59
  var options = {
55
- css: '.ct-chart-line .ct-series .ct-point { stroke: green; }'
60
+ css: '.ct-chart-line .ct-series .ct-point { stroke: green; }',
61
+ chart: {lineSmooth: Chartist.Interpolation.step()},
56
62
  };
63
+
57
64
  chartistSvg('line', data, options).then(svg => console.log(svg));
58
65
  /* (generated svg can be used independently) */
59
66
  /* (it is not dependent upon any external css) */
package/index.js CHANGED
@@ -1,12 +1,16 @@
1
1
  const fs = require('fs');
2
2
  const svgdomCss = require('svgdom-css');
3
- const Chartist = require('chartist');
3
+ const Chartist = require('chartist');
4
4
 
5
5
 
6
6
 
7
7
 
8
- const CSSPATH = require.resolve('chartist/dist/chartist.min.css');
9
- var CSSDATA = ''; // delay loading
8
+ // CONSTANTS
9
+ // =========
10
+
11
+ /** Path to Chartist CSS file. */
12
+ const CSSPATH = require.resolve('chartist/dist/index.css');
13
+ /** Custom CSS for Chartist. */
10
14
  const CSSCUSTOM =
11
15
  `.ct-label.ct-vertical {
12
16
  font-family: Courier;
@@ -21,42 +25,118 @@ const CSSCUSTOM =
21
25
  fill: crimson;
22
26
  text-anchor: start;
23
27
  }`;
24
-
28
+ /** Map of Chartist functions. */
25
29
  const FUNCTION = new Map([
26
- ['bar', Chartist.Bar],
27
- ['line', Chartist.Line],
28
- ['pie', Chartist.Pie],
30
+ ['bar', Chartist.BarChart],
31
+ ['line', Chartist.LineChart],
32
+ ['pie', Chartist.PieChart],
29
33
  ]);
30
34
 
31
35
 
32
36
 
33
37
 
34
- function tag(nam, cnt='', att={}) {
35
- var z = document.createElement(nam);
36
- for (var k in att)
37
- z.setAttribute(k, att[k]);
38
- z.textContent = cnt;
39
- return z;
38
+ // GLOBAL VARIABLES
39
+ // ================
40
+
41
+ var CSSDATA = ''; // Delay loading CSS file.
42
+
43
+
44
+
45
+
46
+ // METHODS
47
+ // =======
48
+
49
+ // UTILITY
50
+ // -------
51
+
52
+ /**
53
+ * Create an element with attributes and content.
54
+ * @param {string} name tag name
55
+ * @param {string} content text content
56
+ * @param {object<string, string>} attrs attributes
57
+ * @returns {Element} element
58
+ */
59
+ function createElement(name, content='', attrs={}) {
60
+ var a = document.createElement(name);
61
+ for (var k in attrs)
62
+ a.setAttribute(k, attrs[k]);
63
+ a.textContent = content;
64
+ return a;
40
65
  }
41
66
 
42
- function title(txt, x=0, y=0, o={}) {
43
- o.x += x; o.y += y;
44
- return tag('text', txt, o);
67
+
68
+ /**
69
+ * Create a title element for Chartist.
70
+ * @param {string} text title text
71
+ * @param {number} x x-coordinate
72
+ * @param {number} y y-coordinate
73
+ * @param {Object} o attributes
74
+ * @returns {Element} title element
75
+ */
76
+ function createTitle(text, x=0, y=0, o={}) {
77
+ o.x += x;
78
+ o.y += y;
79
+ return createElement('text', text, o);
45
80
  }
46
81
 
47
82
 
48
83
 
49
84
 
85
+ // DEFAULT OPTIONS
86
+ // ---------------
87
+
88
+ /**
89
+ * Set default options.
90
+ * @param {Object} o options
91
+ * @returns {Object} options
92
+ */
50
93
  function defaults(o) {
51
- var options = Object.assign({width: 1200, height: 600, chartPadding: {left: 20, right: 100}}, o.options, o.chart);
52
- var resOptions = o.resOptions||o.resChart||[], onDraw = o.onDraw||null;
53
- var css = o.css||'', h = Math.min(options.width, options.height);
54
- var title = Object.assign({x: 0, y: 0, height: 0.08*h, 'font-size': `${0.03*h}px`, 'font-family': 'Verdana', 'font-weight': 'bold', fill: 'crimson', 'text-anchor': 'middle', role: 'caption'}, o.title);
55
- var subtitle = Object.assign({x: 0, y: 0, height: 0.04*h, 'font-size': `${0.02*h}px`, 'font-family': 'Verdana', 'font-weight': 'bold', fill: 'indianred', 'text-anchor': 'middle'}, o.subtitle);
56
- return Object.assign({options, resOptions, onDraw, css, title, subtitle}, o);
94
+ // Set options.
95
+ var options = Object.assign({
96
+ width: 1200,
97
+ height: 600,
98
+ chartPadding: {
99
+ left: 20,
100
+ right: 100,
101
+ },
102
+ }, o.options, o.chart);
103
+ // Set responsive options.
104
+ var resOptions = o.resOptions || o.resChart || [];
105
+ // Set onDraw handler, css.
106
+ var onDraw = o.onDraw || null;
107
+ var css = o.css || '';
108
+ // Set title and subtitle.
109
+ var h = Math.min(options.width, options.height);
110
+ var title = Object.assign({
111
+ x: 0,
112
+ y: 0,
113
+ height: 0.08*h,
114
+ 'font-size': `${0.03*h}px`,
115
+ 'font-family': 'Verdana',
116
+ 'font-weight': 'bold',
117
+ 'text-anchor': 'middle',
118
+ fill: 'crimson',
119
+ role: 'caption',
120
+ }, o.title);
121
+ var subtitle = Object.assign({
122
+ x: 0,
123
+ y: 0,
124
+ height: 0.04*h,
125
+ 'font-size': `${0.02*h}px`,
126
+ 'font-family': 'Verdana',
127
+ 'font-weight': 'bold',
128
+ 'text-anchor': 'middle',
129
+ fill: 'indianred',
130
+ }, o.subtitle);
131
+ return Object.assign({}, o, {options, resOptions, onDraw, css, title, subtitle});
57
132
  }
58
133
 
59
134
 
135
+
136
+
137
+ // MAIN
138
+ // ----
139
+
60
140
  /**
61
141
  * Generate SVG chart using Chartist.
62
142
  * @param {string} type chart type (line, bar, pie)
@@ -75,35 +155,35 @@ function chartistSvg(type, data, o={}) {
75
155
  if (!CSSDATA) CSSDATA = fs.readFileSync(CSSPATH, 'utf8');
76
156
 
77
157
  // Setup window with svg.
78
- var o = defaults(o);
79
- window = svgdomCss(o.css+'\n'+CSSCUSTOM+'\n'+CSSDATA);
158
+ var o = defaults(o);
159
+ window = svgdomCss(o.css + '\n' + CSSCUSTOM + '\n' + CSSDATA);
80
160
  document = window.document;
81
- var w = o.options.width, h = o.options.height;
82
- var th = o.title.height, sth = o.subtitle.height;
83
- var div = document.createElement('div');
161
+ var w = o.options.width, h = o.options.height;
162
+ var th = o.title.height, sth = o.subtitle.height;
163
+ var div = document.createElement('div');
84
164
  document.querySelector('svg').appendChild(div);
85
165
 
86
166
  // Create chart.
87
- var fn = FUNCTION.get(type);
167
+ var fn = FUNCTION.get(type);
88
168
  var chart = new fn(div, data, o.options, o.resOptions);
89
- return new Promise((fres) => {
169
+ return new Promise(resolve => {
90
170
  if (o.onDraw) chart.on('draw', o.onDraw);
91
171
  chart.on('created', () => {
92
172
  var svg = div.querySelector('svg');
93
- var ttl = title(data.title, 0.5*w, 0.6*th, o.title);
94
- var stl = title(data.subtitle, 0.5*w, th+0.6*sth, o.subtitle);
173
+ var title = createTitle(data.title, 0.5*w, 0.6*th, o.title);
174
+ var subtitle = createTitle(data.subtitle, 0.5*w, th + 0.6*sth, o.subtitle);
95
175
  for(var e of div.querySelectorAll('svg > g'))
96
- e.setAttribute('transform', `translate(0, ${th+sth})`);
176
+ e.setAttribute('transform', `translate(0, ${th + sth})`);
97
177
  for(var e of div.querySelectorAll('svg .ct-label.ct-horizontal'))
98
178
  e.setAttribute('transform', `rotate(20, ${e.getAttribute('x')}, ${e.getAttribute('y')}) translate(-10, 0)`);
99
- svg.setAttribute('height', h+th+sth+0.2*h);
179
+ svg.setAttribute('height', h + th + sth + 0.2*h);
100
180
  svg.setAttribute('style', '');
101
- svg.appendChild(ttl);
102
- svg.appendChild(stl);
181
+ svg.appendChild(title);
182
+ svg.appendChild(subtitle);
103
183
  window.setComputedStyle(div);
104
- var txt = div.innerHTML;
184
+ var text = div.innerHTML;
105
185
  div.parentNode.removeChild(div);
106
- fres(txt);
186
+ resolve(text);
107
187
  });
108
188
  });
109
189
  }
package/index.svg ADDED
@@ -0,0 +1 @@
1
+ <svg xmlns:ct="http://gionkunz.github.com/chartist-js/ct" width="1200" height="792" style="" class="ct-chart-line"><g class="ct-grids" transform="translate(0, 72)"><line x1="60" x2="60" y1="15" y2="565" class="ct-grid ct-horizontal" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line x1="320" x2="320" y1="15" y2="565" class="ct-grid ct-horizontal" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line x1="580" x2="580" y1="15" y2="565" class="ct-grid ct-horizontal" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line x1="840" x2="840" y1="15" y2="565" class="ct-grid ct-horizontal" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line y1="565" y2="565" x1="60" x2="1100" class="ct-grid ct-vertical" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line y1="537.5" y2="537.5" x1="60" x2="1100" class="ct-grid ct-vertical" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line y1="510" y2="510" x1="60" x2="1100" class="ct-grid ct-vertical" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line y1="482.5" y2="482.5" x1="60" x2="1100" class="ct-grid ct-vertical" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line y1="455" y2="455" x1="60" x2="1100" class="ct-grid ct-vertical" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line y1="427.5" y2="427.5" x1="60" x2="1100" class="ct-grid ct-vertical" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line y1="400" y2="400" x1="60" x2="1100" class="ct-grid ct-vertical" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line y1="372.5" y2="372.5" x1="60" x2="1100" class="ct-grid ct-vertical" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line y1="345" y2="345" x1="60" x2="1100" class="ct-grid ct-vertical" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line y1="317.5" y2="317.5" x1="60" x2="1100" class="ct-grid ct-vertical" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line y1="290" y2="290" x1="60" x2="1100" class="ct-grid ct-vertical" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line y1="262.5" y2="262.5" x1="60" x2="1100" class="ct-grid ct-vertical" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line y1="235" y2="235" x1="60" x2="1100" class="ct-grid ct-vertical" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line y1="207.5" y2="207.5" x1="60" x2="1100" class="ct-grid ct-vertical" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line y1="180" y2="180" x1="60" x2="1100" class="ct-grid ct-vertical" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line y1="152.5" y2="152.5" x1="60" x2="1100" class="ct-grid ct-vertical" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line y1="125" y2="125" x1="60" x2="1100" class="ct-grid ct-vertical" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line y1="97.5" y2="97.5" x1="60" x2="1100" class="ct-grid ct-vertical" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line y1="70" y2="70" x1="60" x2="1100" class="ct-grid ct-vertical" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line y1="42.5" y2="42.5" x1="60" x2="1100" class="ct-grid ct-vertical" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line><line y1="15" y2="15" x1="60" x2="1100" class="ct-grid ct-vertical" style="stroke:rgba(0,0,0,.2);stroke-width:1px;stroke-dasharray:2px;stroke-dasharray:2px;stroke-width:1px;stroke:rgba(0,0,0,.2);"></line></g><g transform="translate(0, 72)"><g class="ct-series ct-series-a"><path d="M60,565L320,565L320,455L580,455L580,345L840,345L840,235" class="ct-line" style="stroke:#d70206;stroke:#d70206;fill:none;stroke-width:4px;stroke-width:4px;fill:none;"></path><line x1="60" y1="565" x2="60.01" y2="565" class="ct-point" ct:value="1" style="stroke:#d70206;stroke:#d70206;stroke-width:10px;stroke-linecap:round;stroke-linecap:round;stroke-width:10px;stroke:green;stroke:green;"></line><line x1="320" y1="565" x2="320.01" y2="565" class="ct-point" ct:value="1" style="stroke:#d70206;stroke:#d70206;stroke-width:10px;stroke-linecap:round;stroke-linecap:round;stroke-width:10px;stroke:green;stroke:green;"></line><line x1="320" y1="455" x2="320.01" y2="455" class="ct-point" ct:value="2" style="stroke:#d70206;stroke:#d70206;stroke-width:10px;stroke-linecap:round;stroke-linecap:round;stroke-width:10px;stroke:green;stroke:green;"></line><line x1="580" y1="455" x2="580.01" y2="455" class="ct-point" ct:value="2" style="stroke:#d70206;stroke:#d70206;stroke-width:10px;stroke-linecap:round;stroke-linecap:round;stroke-width:10px;stroke:green;stroke:green;"></line><line x1="580" y1="345" x2="580.01" y2="345" class="ct-point" ct:value="3" style="stroke:#d70206;stroke:#d70206;stroke-width:10px;stroke-linecap:round;stroke-linecap:round;stroke-width:10px;stroke:green;stroke:green;"></line><line x1="840" y1="345" x2="840.01" y2="345" class="ct-point" ct:value="3" style="stroke:#d70206;stroke:#d70206;stroke-width:10px;stroke-linecap:round;stroke-linecap:round;stroke-width:10px;stroke:green;stroke:green;"></line><line x1="840" y1="235" x2="840.01" y2="235" class="ct-point" ct:value="4" style="stroke:#d70206;stroke:#d70206;stroke-width:10px;stroke-linecap:round;stroke-linecap:round;stroke-width:10px;stroke:green;stroke:green;"></line></g><g class="ct-series ct-series-b"><path d="M60,345L320,345L320,125L580,125L580,125L840,125L840,15" class="ct-line" style="stroke:#f05b4f;stroke:#f05b4f;fill:none;stroke-width:4px;stroke-width:4px;fill:none;"></path><line x1="60" y1="345" x2="60.01" y2="345" class="ct-point" ct:value="3" style="stroke:#f05b4f;stroke:#f05b4f;stroke-width:10px;stroke-linecap:round;stroke-linecap:round;stroke-width:10px;stroke:green;stroke:green;"></line><line x1="320" y1="345" x2="320.01" y2="345" class="ct-point" ct:value="3" style="stroke:#f05b4f;stroke:#f05b4f;stroke-width:10px;stroke-linecap:round;stroke-linecap:round;stroke-width:10px;stroke:green;stroke:green;"></line><line x1="320" y1="125" x2="320.01" y2="125" class="ct-point" ct:value="5" style="stroke:#f05b4f;stroke:#f05b4f;stroke-width:10px;stroke-linecap:round;stroke-linecap:round;stroke-width:10px;stroke:green;stroke:green;"></line><line x1="580" y1="125" x2="580.01" y2="125" class="ct-point" ct:value="5" style="stroke:#f05b4f;stroke:#f05b4f;stroke-width:10px;stroke-linecap:round;stroke-linecap:round;stroke-width:10px;stroke:green;stroke:green;"></line><line x1="580" y1="125" x2="580.01" y2="125" class="ct-point" ct:value="5" style="stroke:#f05b4f;stroke:#f05b4f;stroke-width:10px;stroke-linecap:round;stroke-linecap:round;stroke-width:10px;stroke:green;stroke:green;"></line><line x1="840" y1="125" x2="840.01" y2="125" class="ct-point" ct:value="5" style="stroke:#f05b4f;stroke:#f05b4f;stroke-width:10px;stroke-linecap:round;stroke-linecap:round;stroke-width:10px;stroke:green;stroke:green;"></line><line x1="840" y1="15" x2="840.01" y2="15" class="ct-point" ct:value="6" style="stroke:#f05b4f;stroke:#f05b4f;stroke-width:10px;stroke-linecap:round;stroke-linecap:round;stroke-width:10px;stroke:green;stroke:green;"></line></g></g><g class="ct-labels" transform="translate(0, 72)"><foreignObject style="overflow: visible;" x="60" y="570" width="260" height="20"><span class="ct-label ct-horizontal ct-end" style="text-align:left;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;fill:crimson;text-anchor:start;text-anchor:start;fill:crimson;font-size:14px;font-weight:bold;font-family:Courier;width: 260px; height: 20px;" xmlns="http://www.w3.org/2000/xmlns/" transform="rotate(20, null, null) translate(-10, 0)">P</span></foreignObject><foreignObject style="overflow: visible;" x="320" y="570" width="260" height="20"><span class="ct-label ct-horizontal ct-end" style="text-align:left;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;fill:crimson;text-anchor:start;text-anchor:start;fill:crimson;font-size:14px;font-weight:bold;font-family:Courier;width: 260px; height: 20px;" xmlns="http://www.w3.org/2000/xmlns/" transform="rotate(20, null, null) translate(-10, 0)">U</span></foreignObject><foreignObject style="overflow: visible;" x="580" y="570" width="260" height="20"><span class="ct-label ct-horizontal ct-end" style="text-align:left;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;fill:crimson;text-anchor:start;text-anchor:start;fill:crimson;font-size:14px;font-weight:bold;font-family:Courier;width: 260px; height: 20px;" xmlns="http://www.w3.org/2000/xmlns/" transform="rotate(20, null, null) translate(-10, 0)">B</span></foreignObject><foreignObject style="overflow: visible;" x="840" y="570" width="260" height="20"><span class="ct-label ct-horizontal ct-end" style="text-align:left;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;fill:crimson;text-anchor:start;text-anchor:start;fill:crimson;font-size:14px;font-weight:bold;font-family:Courier;width: 260px; height: 20px;" xmlns="http://www.w3.org/2000/xmlns/" transform="rotate(20, null, null) translate(-10, 0)">G</span></foreignObject><foreignObject style="overflow: visible;" y="537.5" x="20" height="27.5" width="30"><span class="ct-label ct-vertical ct-start" style="text-align:right;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;text-anchor:end;text-anchor:end;font-size:14px;font-weight:bold;font-family:Courier;height: 28px; width: 30px;" xmlns="http://www.w3.org/2000/xmlns/">1</span></foreignObject><foreignObject style="overflow: visible;" y="510" x="20" height="27.5" width="30"><span class="ct-label ct-vertical ct-start" style="text-align:right;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;text-anchor:end;text-anchor:end;font-size:14px;font-weight:bold;font-family:Courier;height: 28px; width: 30px;" xmlns="http://www.w3.org/2000/xmlns/">1.25</span></foreignObject><foreignObject style="overflow: visible;" y="482.5" x="20" height="27.5" width="30"><span class="ct-label ct-vertical ct-start" style="text-align:right;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;text-anchor:end;text-anchor:end;font-size:14px;font-weight:bold;font-family:Courier;height: 28px; width: 30px;" xmlns="http://www.w3.org/2000/xmlns/">1.5</span></foreignObject><foreignObject style="overflow: visible;" y="455" x="20" height="27.5" width="30"><span class="ct-label ct-vertical ct-start" style="text-align:right;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;text-anchor:end;text-anchor:end;font-size:14px;font-weight:bold;font-family:Courier;height: 28px; width: 30px;" xmlns="http://www.w3.org/2000/xmlns/">1.75</span></foreignObject><foreignObject style="overflow: visible;" y="427.5" x="20" height="27.5" width="30"><span class="ct-label ct-vertical ct-start" style="text-align:right;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;text-anchor:end;text-anchor:end;font-size:14px;font-weight:bold;font-family:Courier;height: 28px; width: 30px;" xmlns="http://www.w3.org/2000/xmlns/">2</span></foreignObject><foreignObject style="overflow: visible;" y="400" x="20" height="27.5" width="30"><span class="ct-label ct-vertical ct-start" style="text-align:right;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;text-anchor:end;text-anchor:end;font-size:14px;font-weight:bold;font-family:Courier;height: 28px; width: 30px;" xmlns="http://www.w3.org/2000/xmlns/">2.25</span></foreignObject><foreignObject style="overflow: visible;" y="372.5" x="20" height="27.5" width="30"><span class="ct-label ct-vertical ct-start" style="text-align:right;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;text-anchor:end;text-anchor:end;font-size:14px;font-weight:bold;font-family:Courier;height: 28px; width: 30px;" xmlns="http://www.w3.org/2000/xmlns/">2.5</span></foreignObject><foreignObject style="overflow: visible;" y="345" x="20" height="27.5" width="30"><span class="ct-label ct-vertical ct-start" style="text-align:right;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;text-anchor:end;text-anchor:end;font-size:14px;font-weight:bold;font-family:Courier;height: 28px; width: 30px;" xmlns="http://www.w3.org/2000/xmlns/">2.75</span></foreignObject><foreignObject style="overflow: visible;" y="317.5" x="20" height="27.5" width="30"><span class="ct-label ct-vertical ct-start" style="text-align:right;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;text-anchor:end;text-anchor:end;font-size:14px;font-weight:bold;font-family:Courier;height: 28px; width: 30px;" xmlns="http://www.w3.org/2000/xmlns/">3</span></foreignObject><foreignObject style="overflow: visible;" y="290" x="20" height="27.5" width="30"><span class="ct-label ct-vertical ct-start" style="text-align:right;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;text-anchor:end;text-anchor:end;font-size:14px;font-weight:bold;font-family:Courier;height: 28px; width: 30px;" xmlns="http://www.w3.org/2000/xmlns/">3.25</span></foreignObject><foreignObject style="overflow: visible;" y="262.5" x="20" height="27.5" width="30"><span class="ct-label ct-vertical ct-start" style="text-align:right;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;text-anchor:end;text-anchor:end;font-size:14px;font-weight:bold;font-family:Courier;height: 28px; width: 30px;" xmlns="http://www.w3.org/2000/xmlns/">3.5</span></foreignObject><foreignObject style="overflow: visible;" y="235" x="20" height="27.5" width="30"><span class="ct-label ct-vertical ct-start" style="text-align:right;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;text-anchor:end;text-anchor:end;font-size:14px;font-weight:bold;font-family:Courier;height: 28px; width: 30px;" xmlns="http://www.w3.org/2000/xmlns/">3.75</span></foreignObject><foreignObject style="overflow: visible;" y="207.5" x="20" height="27.5" width="30"><span class="ct-label ct-vertical ct-start" style="text-align:right;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;text-anchor:end;text-anchor:end;font-size:14px;font-weight:bold;font-family:Courier;height: 28px; width: 30px;" xmlns="http://www.w3.org/2000/xmlns/">4</span></foreignObject><foreignObject style="overflow: visible;" y="180" x="20" height="27.5" width="30"><span class="ct-label ct-vertical ct-start" style="text-align:right;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;text-anchor:end;text-anchor:end;font-size:14px;font-weight:bold;font-family:Courier;height: 28px; width: 30px;" xmlns="http://www.w3.org/2000/xmlns/">4.25</span></foreignObject><foreignObject style="overflow: visible;" y="152.5" x="20" height="27.5" width="30"><span class="ct-label ct-vertical ct-start" style="text-align:right;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;text-anchor:end;text-anchor:end;font-size:14px;font-weight:bold;font-family:Courier;height: 28px; width: 30px;" xmlns="http://www.w3.org/2000/xmlns/">4.5</span></foreignObject><foreignObject style="overflow: visible;" y="125" x="20" height="27.5" width="30"><span class="ct-label ct-vertical ct-start" style="text-align:right;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;text-anchor:end;text-anchor:end;font-size:14px;font-weight:bold;font-family:Courier;height: 28px; width: 30px;" xmlns="http://www.w3.org/2000/xmlns/">4.75</span></foreignObject><foreignObject style="overflow: visible;" y="97.5" x="20" height="27.5" width="30"><span class="ct-label ct-vertical ct-start" style="text-align:right;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;text-anchor:end;text-anchor:end;font-size:14px;font-weight:bold;font-family:Courier;height: 28px; width: 30px;" xmlns="http://www.w3.org/2000/xmlns/">5</span></foreignObject><foreignObject style="overflow: visible;" y="70" x="20" height="27.5" width="30"><span class="ct-label ct-vertical ct-start" style="text-align:right;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;text-anchor:end;text-anchor:end;font-size:14px;font-weight:bold;font-family:Courier;height: 28px; width: 30px;" xmlns="http://www.w3.org/2000/xmlns/">5.25</span></foreignObject><foreignObject style="overflow: visible;" y="42.5" x="20" height="27.5" width="30"><span class="ct-label ct-vertical ct-start" style="text-align:right;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;text-anchor:end;text-anchor:end;font-size:14px;font-weight:bold;font-family:Courier;height: 28px; width: 30px;" xmlns="http://www.w3.org/2000/xmlns/">5.5</span></foreignObject><foreignObject style="overflow: visible;" y="15" x="20" height="27.5" width="30"><span class="ct-label ct-vertical ct-start" style="text-align:right;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;text-anchor:end;text-anchor:end;font-size:14px;font-weight:bold;font-family:Courier;height: 28px; width: 30px;" xmlns="http://www.w3.org/2000/xmlns/">5.75</span></foreignObject><foreignObject style="overflow: visible;" y="-11.19047619047619" x="20" height="26.19047619047619" width="30"><span class="ct-label ct-vertical ct-start" style="text-align:right;fill:rgba(0,0,0,.4);color:rgba(0,0,0,.4);font-size:12px;line-height:1;line-height:1;font-size:12px;color:rgba(0,0,0,.4);fill:rgba(0,0,0,.4);font-family:Courier;font-weight:bold;font-size:14px;text-anchor:end;text-anchor:end;font-size:14px;font-weight:bold;font-family:Courier;height: 26px; width: 30px;" xmlns="http://www.w3.org/2000/xmlns/">6</span></foreignObject></g><text x="600" y="28.799999999999997" height="48" font-size="18px" font-family="Verdana" font-weight="bold" text-anchor="middle" fill="crimson" role="caption">Time to play PUBG</text><text x="600" y="62.4" height="24" font-size="12px" font-family="Verdana" font-weight="bold" text-anchor="middle" fill="indianred">Player Unknown's Battleground</text></svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chartist-svg",
3
- "version": "0.2.4",
3
+ "version": "0.2.7",
4
4
  "description": "Generate SVG chart using chartist on node.js.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,7 +22,7 @@
22
22
  },
23
23
  "homepage": "https://github.com/nodef/chartist-svg#readme",
24
24
  "dependencies": {
25
- "chartist": "0.11",
26
- "svgdom-css": "0.2"
25
+ "chartist": "^1.3",
26
+ "svgdom-css": "^0.2"
27
27
  }
28
28
  }