Skip to content

Commit a6a9b55

Browse files
authored
Merge pull request #41 from ngfelixl/refactor/remove-manual-plotly-version
refactor/get-plotly-from-cdn
2 parents 2536b9d + a0e5a45 commit a6a9b55

File tree

12 files changed

+8233
-8698
lines changed

12 files changed

+8233
-8698
lines changed

jest.config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
},
1616
"globals": {
1717
"ts-jest": {
18-
"tsConfig": "test/tsconfig.spec.json"
18+
"tsconfig": "test/tsconfig.spec.json"
1919
}
2020
}
2121
}

package-lock.json

Lines changed: 8155 additions & 8602 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 25 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "nodeplotlib",
3-
"version": "0.6.5",
3+
"version": "0.7.0",
44
"description": "NodeJS frontend-less plotting lib using plotly.js inspired by matplotlib",
55
"main": "dist/lib/index.js",
66
"types": "dist/lib/index.d.ts",
@@ -17,17 +17,14 @@
1717
],
1818
"homepage": "https://github.com/ngfelixl/nodeplotlib#readme",
1919
"scripts": {
20-
"build": "npm run clean && webpack && npm run build-copy-files",
20+
"build": "npm run clean && webpack",
2121
"clean": "shx rm -rf dist",
2222
"test": "jest --config jest.config.json --coverage --maxWorkers=15",
2323
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
2424
"lint": "tslint --project ./tsconfig.json",
2525
"coverage": "cat coverage/lcov.info | coveralls",
26-
"prepare": "npm run clean && npm run prepare-copy-files && npm run build ",
2726
"prepublishOnly": "npm run lint",
28-
"preversion": "npm run lint",
29-
"build-copy-files": "node ./scripts/build.js",
30-
"prepare-copy-files": "node ./scripts/prepare.js"
27+
"preversion": "npm run lint"
3128
},
3229
"keywords": [
3330
"plot",
@@ -39,33 +36,34 @@
3936
"browser",
4037
"localhost"
4138
],
42-
"author": "Felix Lemke <[email protected]> (https://felixlemke.com)",
39+
"author": "Felix Lemke <[email protected]> (https://felixlemke.dev)",
4340
"license": "MIT",
44-
"dependencies": {},
41+
"dependencies": {
42+
"@types/plotly.js": "^1.54.7"
43+
},
4544
"devDependencies": {
46-
"@types/d3": "^5.7.2",
47-
"@types/jest": "^24.0.25",
48-
"@types/node": "^13.1.1",
49-
"@types/plotly.js": "^1.44.22",
50-
"@types/request": "^2.48.4",
51-
"copyfiles": "^2.1.1",
52-
"coveralls": "^3.0.9",
45+
"@types/d3": "^5.16.4",
46+
"@types/jest": "^24.9.1",
47+
"@types/node": "^13.13.39",
48+
"@types/request": "^2.48.5",
49+
"copyfiles": "^2.4.1",
50+
"coveralls": "^3.1.0",
5351
"dts-bundle": "^0.7.3",
54-
"html-webpack-plugin": "^3.2.0",
55-
"jest": "^24.9.0",
56-
"plotly.js": "^1.51.3",
52+
"html-webpack-plugin": "^4.5.1",
53+
"jest": "^26.6.3",
54+
"plotly.js": "1.58.4",
5755
"prettier": "^1.19.1",
58-
"request": "^2.88.0",
59-
"shx": "^0.3.2",
56+
"request": "^2.88.2",
57+
"shx": "^0.3.3",
6058
"source-map-loader": "^0.2.4",
61-
"terser-webpack-plugin": "^2.3.1",
62-
"ts-jest": "^24.2.0",
63-
"ts-loader": "^6.2.1",
64-
"ts-node": "^8.5.4",
59+
"terser-webpack-plugin": "^5.0.3",
60+
"ts-jest": "^26.4.4",
61+
"ts-loader": "^6.2.2",
62+
"ts-node": "^8.10.2",
6563
"tslint": "^5.20.1",
6664
"tslint-config-prettier": "^1.18.0",
67-
"typescript": "^3.7.4",
68-
"webpack": "^4.41.5",
69-
"webpack-cli": "^3.3.10"
65+
"typescript": "^4.1.3",
66+
"webpack": "^5.11.1",
67+
"webpack-cli": "^4.3.1"
7068
}
7169
}

scripts/build.js

Lines changed: 0 additions & 31 deletions
This file was deleted.

scripts/prepare.js

Lines changed: 0 additions & 28 deletions
This file was deleted.

src/models/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
export * from './plots-container';
22
export * from './plot';
3+
export * from 'plotly.js';

src/models/plot.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import { Layout as PlotlyLayout, PlotData } from './plotly.js/index';
1+
import { Layout, PlotData } from 'plotly.js';
22

33
export type Plot = Partial<PlotData>;
4-
export type Layout = Partial<PlotlyLayout>;
54

65
export interface IPlot {
76
data: Plot[];
8-
layout?: Layout;
7+
layout?: Partial<Layout>;
98
}

src/www/index.html

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
<html>
33
<head>
44
<base href="./">
5-
<!--<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>-->
65
<style>
76
#container { display: flex; flex-wrap: wrap; }
87
#container > * { flex: 1 1 1280px; }
@@ -11,6 +10,6 @@
1110
</head>
1211
<body>
1312
<div id="container" data-plotid="{{plotid}}"></div>
14-
<script type="text/javascript" src="plotly.min.js"></script>
13+
<script type="text/javascript" src="https://cdn.plot.ly/plotly-1.58.4.min.js"></script>
1514
</body>
1615
</html>

test/demo/candlestick.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
const npl = require('../../dist/lib');
2+
3+
const trace1 = {
4+
x: ['2017-01-04', '2017-01-05', '2017-01-06', '2017-01-09', '2017-01-10', '2017-01-11', '2017-01-12', '2017-01-13', '2017-01-17', '2017-01-18', '2017-01-19', '2017-01-20', '2017-01-23', '2017-01-24', '2017-01-25', '2017-01-26', '2017-01-27', '2017-01-30', '2017-01-31', '2017-02-01', '2017-02-02', '2017-02-03', '2017-02-06', '2017-02-07', '2017-02-08', '2017-02-09', '2017-02-10', '2017-02-13', '2017-02-14', '2017-02-15'],
5+
close: [116.019997, 116.610001, 117.910004, 118.989998, 119.110001, 119.75, 119.25, 119.040001, 120, 119.989998, 119.779999, 120, 120.080002, 119.970001, 121.879997, 121.940002, 121.949997, 121.629997, 121.349998, 128.75, 128.529999, 129.080002, 130.289993, 131.529999, 132.039993, 132.419998, 132.119995, 133.289993, 135.020004, 135.509995],
6+
decreasing: {line: {color: '#7F7F7F'}},
7+
high: [116.510002, 116.860001, 118.160004, 119.43, 119.379997, 119.93, 119.300003, 119.620003, 120.239998, 120.5, 120.089996, 120.449997, 120.809998, 120.099998, 122.099998, 122.440002, 122.349998, 121.629997, 121.389999, 130.490005, 129.389999, 129.190002, 130.5, 132.089996, 132.220001, 132.449997, 132.940002, 133.820007, 135.089996, 136.270004],
8+
increasing: {line: {color: '#17BECF'}},
9+
line: {color: 'rgba(31,119,180,1)'},
10+
low: [115.75, 115.809998, 116.470001, 117.940002, 118.300003, 118.599998, 118.209999, 118.809998, 118.220001, 119.709999, 119.370003, 119.730003, 119.769997, 119.5, 120.279999, 121.599998, 121.599998, 120.660004, 120.620003, 127.010002, 127.779999, 128.160004, 128.899994, 130.449997, 131.220001, 131.119995, 132.050003, 132.75, 133.25, 134.619995],
11+
open: [115.849998, 115.919998, 116.779999, 117.949997, 118.769997, 118.739998, 118.900002, 119.110001, 118.339996, 120, 119.400002, 120.449997, 120, 119.550003, 120.419998, 121.669998, 122.139999, 120.93, 121.150002, 127.029999, 127.980003, 128.309998, 129.130005, 130.539993, 131.350006, 131.649994, 132.460007, 133.080002, 133.470001, 135.520004],
12+
type: 'candlestick',
13+
xaxis: 'x',
14+
yaxis: 'y'
15+
};
16+
17+
const data = [trace1];
18+
19+
const layout = {
20+
dragmode: 'zoom',
21+
margin: {
22+
r: 10,
23+
t: 25,
24+
b: 40,
25+
l: 60
26+
},
27+
showlegend: false,
28+
xaxis: {
29+
autorange: true,
30+
domain: [0, 1],
31+
range: ['2017-01-03 12:00', '2017-02-15 12:00'],
32+
rangeslider: {range: ['2017-01-03 12:00', '2017-02-15 12:00']},
33+
title: 'Date',
34+
type: 'date'
35+
},
36+
yaxis: {
37+
autorange: true,
38+
domain: [0, 1],
39+
range: [114.609999778, 137.410004222],
40+
type: 'linear'
41+
}
42+
};
43+
44+
npl.plot(data, layout);

test/demo/scatter.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const npl = require('../../dist/lib');
2+
npl.stack([{ x: [0], y: [1], type: 'scatter'}])
3+
npl.plot()

0 commit comments

Comments
 (0)