adaptive-linechart 1.3.0 → 1.4.0

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/tools/updoc.js ADDED
@@ -0,0 +1,35 @@
1
+ // Generates the API documentation from the JSDoc comments in the code
2
+ // and inserts it into README.md between the markers <!-- @API --> and
3
+ // <!-- /@API -->. If the markers don't exist yet, the section is inserted
4
+ // before the "# Public methods" chapter (or appended at the end).
5
+ //
6
+ // Usage: npm run updoc
7
+ const fs = require('fs');
8
+ const path = require('path');
9
+ const jsdoc2md = require('jsdoc-to-markdown');
10
+
11
+ (async function () {
12
+ const readmePath = path.join(__dirname, '..', 'README.md');
13
+ let readme = fs.readFileSync(readmePath, 'utf8');
14
+
15
+ const api = await jsdoc2md.render({ files: path.join(__dirname, '..', 'src', 'linechart.js') });
16
+
17
+ const start = '<!-- @API -->';
18
+ const end = '<!-- /@API -->';
19
+ const section = start + '\n\n' + api.trim() + '\n\n' + end;
20
+
21
+ const markerRe = /<!-- @API -->[\s\S]*?<!-- \/@API -->/;
22
+ if (markerRe.test(readme)) {
23
+ readme = readme.replace(markerRe, section);
24
+ } else {
25
+ const anchor = '# Public methods';
26
+ if (readme.includes(anchor)) {
27
+ readme = readme.replace(anchor, section + '\n\n' + anchor);
28
+ } else {
29
+ readme += '\n\n' + section;
30
+ }
31
+ }
32
+
33
+ fs.writeFileSync(readmePath, readme);
34
+ console.log('README.md: API-Sektion aktualisiert');
35
+ })();
@@ -1,17 +0,0 @@
1
- # Prepare files for distribution
2
-
3
- * Update version in README, package.json, linechart.js
4
- * Put information about changes in CHANGELOG
5
-
6
- ```
7
- npm -i terser -g
8
-
9
- terser src\linechart.js src\chart-util.js -o dist\linechart-all.min.js
10
- type src\linechart.css > dist\linechart.css
11
- ```
12
- # Uplod to NPM
13
- ```
14
- npm publish
15
- ```
16
-
17
-
@@ -1,70 +0,0 @@
1
- document.addEventListener('DOMContentLoaded', function () {
2
- createCharts();
3
- });
4
-
5
- var isMobil = false;
6
- var charts = [];
7
-
8
- function createCharts () {
9
-
10
- // Parent element for charts
11
- let parent = document.getElementById('charts');
12
-
13
- // Create chart with numerical axis-x and attach to array
14
- let lchart = new LineChart(parent,null , null,
15
- 'Example with numerical values on axis-x', null, "number");
16
- charts.push(lchart);
17
-
18
- let lineData1 = {
19
- obj_name: "Line one",
20
- values: ""
21
- };
22
-
23
- // Create two examples as math. function. Last ";" don't need
24
- for(i = 0; i < 91 ; i++){
25
- lineData1.values += i+ "/"+ (i* Math.cos(i))+";";
26
- }
27
- lineData1.values = lineData1.values.substring(0, lineData1.values.length -1);
28
- lchart.addLine(lineData1);
29
-
30
- let lineData2 = {
31
- obj_name: "Line two",
32
- values: ""
33
- };
34
- for(i = 0; i < 90 ; i++){
35
- lineData2.values += i+ "/"+ (i* Math.cos(i) * 2)+";";
36
- }
37
- lineData2.values = lineData2.values.substring(0, lineData2.values.length -1);
38
- lchart.addLine(lineData2);
39
-
40
- lchart.draw();
41
-
42
- // Extract data from CSV and create new chart with time-based axis-x.
43
- let request = new XMLHttpRequest();
44
- request.open("GET","example.csv");
45
- request.addEventListener('load', function(event) {
46
- if (request.status == 200) {
47
-
48
- let arScvData = scvToTimeSeries(request.responseText);
49
- lchart = new LineChart(document.getElementById('charts'),null, null,
50
- "Example data from CSV and data-time on axis-x.", null, "time");
51
- charts.push(lchart);
52
-
53
- for(let i=0; i < arScvData.length - 1; i++) {
54
- let line = {
55
- obj_name: 'Stock preis',
56
- par_name: arScvData[i].name,
57
- values: arScvData[i].data
58
- };
59
- lchart.addLine(line);
60
- }
61
-
62
- lchart.draw();
63
- } else {
64
- parent.innerHTML("Failed get CSV. "+ request.statusText+ " Responce "+ request.responseText);
65
- }
66
- });
67
-
68
- request.send();
69
- }
70
-
package/example/test.html DELETED
@@ -1,18 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
6
- <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
7
- <title>Example Adaptive-Linecharts</title>
8
- <link type="text/css" rel="stylesheet" href="../src/linechart.css" >
9
- <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.24.0/moment.min.js"></script>
10
- <script src="../src/linechart.js"></script>
11
- <script src="../src/chart-util.js"></script>
12
- <script src="example.js"></script>
13
- </head>
14
-
15
- <body>
16
- <div id="charts" style="width: 99%;"> </div>
17
- </body>
18
- </html>