Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jest.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"globals": {
"ts-jest": {
"tsConfig": "test/tsconfig.spec.json"
"tsconfig": "test/tsconfig.spec.json"
}
}
}
16,757 changes: 8,155 additions & 8,602 deletions package-lock.json

Large diffs are not rendered by default.

52 changes: 25 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nodeplotlib",
"version": "0.6.5",
"version": "0.7.0",
"description": "NodeJS frontend-less plotting lib using plotly.js inspired by matplotlib",
"main": "dist/lib/index.js",
"types": "dist/lib/index.d.ts",
Expand All @@ -17,17 +17,14 @@
],
"homepage": "https://github.com/ngfelixl/nodeplotlib#readme",
"scripts": {
"build": "npm run clean && webpack && npm run build-copy-files",
"build": "npm run clean && webpack",
"clean": "shx rm -rf dist",
"test": "jest --config jest.config.json --coverage --maxWorkers=15",
"format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"",
"lint": "tslint --project ./tsconfig.json",
"coverage": "cat coverage/lcov.info | coveralls",
"prepare": "npm run clean && npm run prepare-copy-files && npm run build ",
"prepublishOnly": "npm run lint",
"preversion": "npm run lint",
"build-copy-files": "node ./scripts/build.js",
"prepare-copy-files": "node ./scripts/prepare.js"
"preversion": "npm run lint"
},
"keywords": [
"plot",
Expand All @@ -39,33 +36,34 @@
"browser",
"localhost"
],
"author": "Felix Lemke <[email protected]> (https://felixlemke.com)",
"author": "Felix Lemke <[email protected]> (https://felixlemke.dev)",
"license": "MIT",
"dependencies": {},
"dependencies": {
"@types/plotly.js": "^1.54.7"
},
"devDependencies": {
"@types/d3": "^5.7.2",
"@types/jest": "^24.0.25",
"@types/node": "^13.1.1",
"@types/plotly.js": "^1.44.22",
"@types/request": "^2.48.4",
"copyfiles": "^2.1.1",
"coveralls": "^3.0.9",
"@types/d3": "^5.16.4",
"@types/jest": "^24.9.1",
"@types/node": "^13.13.39",
"@types/request": "^2.48.5",
"copyfiles": "^2.4.1",
"coveralls": "^3.1.0",
"dts-bundle": "^0.7.3",
"html-webpack-plugin": "^3.2.0",
"jest": "^24.9.0",
"plotly.js": "^1.51.3",
"html-webpack-plugin": "^4.5.1",
"jest": "^26.6.3",
"plotly.js": "1.58.4",
"prettier": "^1.19.1",
"request": "^2.88.0",
"shx": "^0.3.2",
"request": "^2.88.2",
"shx": "^0.3.3",
"source-map-loader": "^0.2.4",
"terser-webpack-plugin": "^2.3.1",
"ts-jest": "^24.2.0",
"ts-loader": "^6.2.1",
"ts-node": "^8.5.4",
"terser-webpack-plugin": "^5.0.3",
"ts-jest": "^26.4.4",
"ts-loader": "^6.2.2",
"ts-node": "^8.10.2",
"tslint": "^5.20.1",
"tslint-config-prettier": "^1.18.0",
"typescript": "^3.7.4",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10"
"typescript": "^4.1.3",
"webpack": "^5.11.1",
"webpack-cli": "^4.3.1"
}
}
31 changes: 0 additions & 31 deletions scripts/build.js

This file was deleted.

28 changes: 0 additions & 28 deletions scripts/prepare.js

This file was deleted.

1 change: 1 addition & 0 deletions src/models/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './plots-container';
export * from './plot';
export * from 'plotly.js';
5 changes: 2 additions & 3 deletions src/models/plot.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Layout as PlotlyLayout, PlotData } from './plotly.js/index';
import { Layout, PlotData } from 'plotly.js';

export type Plot = Partial<PlotData>;
export type Layout = Partial<PlotlyLayout>;

export interface IPlot {
data: Plot[];
layout?: Layout;
layout?: Partial<Layout>;
}
3 changes: 1 addition & 2 deletions src/www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<html>
<head>
<base href="./">
<!--<script src="https://cdn.plot.ly/plotly-latest.min.js"></script>-->
<style>
#container { display: flex; flex-wrap: wrap; }
#container > * { flex: 1 1 1280px; }
Expand All @@ -11,6 +10,6 @@
</head>
<body>
<div id="container" data-plotid="{{plotid}}"></div>
<script type="text/javascript" src="plotly.min.js"></script>
<script type="text/javascript" src="https://cdn.plot.ly/plotly-1.58.4.min.js"></script>
</body>
</html>
44 changes: 44 additions & 0 deletions test/demo/candlestick.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const npl = require('../../dist/lib');

const trace1 = {
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'],
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],
decreasing: {line: {color: '#7F7F7F'}},
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],
increasing: {line: {color: '#17BECF'}},
line: {color: 'rgba(31,119,180,1)'},
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],
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],
type: 'candlestick',
xaxis: 'x',
yaxis: 'y'
};

const data = [trace1];

const layout = {
dragmode: 'zoom',
margin: {
r: 10,
t: 25,
b: 40,
l: 60
},
showlegend: false,
xaxis: {
autorange: true,
domain: [0, 1],
range: ['2017-01-03 12:00', '2017-02-15 12:00'],
rangeslider: {range: ['2017-01-03 12:00', '2017-02-15 12:00']},
title: 'Date',
type: 'date'
},
yaxis: {
autorange: true,
domain: [0, 1],
range: [114.609999778, 137.410004222],
type: 'linear'
}
};

npl.plot(data, layout);
3 changes: 3 additions & 0 deletions test/demo/scatter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
const npl = require('../../dist/lib');
npl.stack([{ x: [0], y: [1], type: 'scatter'}])
npl.plot()
3 changes: 0 additions & 3 deletions test/index.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/stack.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('stack', () => {
});

it('should stack data with layout', () => {
stack(validData, {});
stack(validData, {} as any);

expect(plots.length).toBe(1);
});
Expand Down