aiden-shared-calculations-unified 1.0.81 → 1.0.83
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/README.MD +126 -49
- package/calculations/core/price-metrics.js +372 -0
- package/calculations/helix/winner-loser-flow.js +4 -2
- package/node-graphviz/README.md +123 -0
- package/node-graphviz/bin/graphvizlib.wasm +0 -0
- package/node-graphviz/index.d.ts +33 -0
- package/node-graphviz/index.js +4911 -0
- package/node-graphviz/package.json +16 -0
- package/package.json +14 -6
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# node-graphviz
|
|
2
|
+
|
|
3
|
+
A JS + WASM module for compiling graphs written in DOT to images, using GraphViz in Node.js.
|
|
4
|
+
|
|
5
|
+
No annoying native build system or native dependencies that need to be compiled.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
npm install node-graphviz --save
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
See [The DOT Language](https://graphviz.gitlab.io/_pages/doc/info/lang.html) for more information about DOT, and [GraphViz Pocket Reference](https://graphs.grevian.org/example) for some examples.
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
const fs = require('fs');
|
|
19
|
+
const { graphviz } = require('node-graphviz');
|
|
20
|
+
|
|
21
|
+
// Define a graph using DOT notation
|
|
22
|
+
const graph = `
|
|
23
|
+
digraph {
|
|
24
|
+
a -> b;
|
|
25
|
+
b -> c;
|
|
26
|
+
c -> d;
|
|
27
|
+
d -> a;
|
|
28
|
+
}
|
|
29
|
+
`;
|
|
30
|
+
|
|
31
|
+
// Compile the graph to SVG using the `circo` layout algorithm
|
|
32
|
+
graphviz.circo(graph, 'svg').then((svg) => {
|
|
33
|
+
// Write the SVG to file
|
|
34
|
+
fs.writeFileSync('graph.svg', svg);
|
|
35
|
+
});
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Running the above produces the following SVG:
|
|
39
|
+
|
|
40
|
+

|
|
41
|
+
|
|
42
|
+
## API
|
|
43
|
+
|
|
44
|
+
The module exports the following API:
|
|
45
|
+
|
|
46
|
+
```ts
|
|
47
|
+
declare type Format = 'svg' | 'dot' | 'json' | 'dot_json' | 'xdot_json';
|
|
48
|
+
|
|
49
|
+
declare type Engine = 'circo' | 'dot' | 'fdp' | 'neato' | 'osage' | 'patchwork' | 'twopi';
|
|
50
|
+
|
|
51
|
+
export declare const graphviz = {
|
|
52
|
+
layout(dotSource: string, outputFormat?: Format, layoutEngine?: Engine): Promise<string>;
|
|
53
|
+
circo(dotSource: string, outputFormat?: Format): Promise<string>;
|
|
54
|
+
dot(dotSource: string, outputFormat?: Format): Promise<string>;
|
|
55
|
+
fdp(dotSource: string, outputFormat?: Format): Promise<string>;
|
|
56
|
+
neato(dotSource: string, outputFormat?: Format): Promise<string>;
|
|
57
|
+
osage(dotSource: string, outputFormat?: Format): Promise<string>;
|
|
58
|
+
patchwork(dotSource: string, outputFormat?: Format): Promise<string>;
|
|
59
|
+
twopi(dotSource: string, outputFormat?: Format): Promise<string>;
|
|
60
|
+
};
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### graphviz.layout(_dotSource_[, _outputFormat_][, _layoutengine_])
|
|
64
|
+
|
|
65
|
+
Performs layout for the supplied `dotSource`.
|
|
66
|
+
|
|
67
|
+
Where:
|
|
68
|
+
|
|
69
|
+
- `outputFormat` is one of the following (see [Output Formats](https://graphviz.gitlab.io/_pages/doc/info/output.html) for details):
|
|
70
|
+
- `dot`
|
|
71
|
+
- `dot_json`
|
|
72
|
+
- `json`
|
|
73
|
+
- `svg` (default)
|
|
74
|
+
- `xdot_json`
|
|
75
|
+
- `layoutEngine` is one of the following (see [Layout documentation](https://www.graphviz.org/documentation/) for details):
|
|
76
|
+
- `circo`
|
|
77
|
+
- `dot` (default)
|
|
78
|
+
- `fdp`
|
|
79
|
+
- `neato`
|
|
80
|
+
- `osage`
|
|
81
|
+
- `patchwork`
|
|
82
|
+
- `twopi`
|
|
83
|
+
|
|
84
|
+
### graphviz.circo(_dotSource_[, _outputFormat_])
|
|
85
|
+
|
|
86
|
+
Convenience function that performs **circo** layout, is equivalent to `layout(dotSource, outputFormat, 'circo')`.
|
|
87
|
+
|
|
88
|
+
### graphviz.dot(_dotSource_[, _outputFormat_])
|
|
89
|
+
|
|
90
|
+
Convenience function that performs **dot** layout, is equivalent to `layout(dotSource, outputFormat, 'dot')`.
|
|
91
|
+
|
|
92
|
+
### graphviz.fdp(_dotSource_[, _outputFormat_])
|
|
93
|
+
|
|
94
|
+
Convenience function that performs **circo** layout, is equivalent to `layout(dotSource, outputFormat, 'fdp')`.
|
|
95
|
+
|
|
96
|
+
### graphviz.neato(_dotSource_[, _outputFormat_])
|
|
97
|
+
|
|
98
|
+
Convenience function that performs **neato** layout, is equivalent to `layout(dotSource, outputFormat, 'neato')`.
|
|
99
|
+
|
|
100
|
+
### graphviz.osage(_dotSource_[, _outputFormat_])
|
|
101
|
+
|
|
102
|
+
Convenience function that performs **osage** layout, is equivalent to `layout(dotSource, outputFormat, 'osage')`.
|
|
103
|
+
|
|
104
|
+
### graphviz.patchwork(_dotSource_[, _outputFormat_])
|
|
105
|
+
|
|
106
|
+
Convenience function that performs **patchwork** layout, is equivalent to `layout(dotSource, outputFormat, 'patchwork')`.
|
|
107
|
+
|
|
108
|
+
### graphviz.twopi(_dotSource_[, _outputFormat_])
|
|
109
|
+
|
|
110
|
+
Convenience function that performs **twopi** layout, is equivalent to `layout(dotSource, outputFormat, 'twopi')`.
|
|
111
|
+
|
|
112
|
+
## Credits
|
|
113
|
+
|
|
114
|
+
This module is based on [hpcc-systems/hpcc-js-wasm](https://github.com/hpcc-systems/hpcc-js-wasm), which is designed for use in a browser, not Node.js. The following changes were made to support Node and simplify the module to include only GraphViz:
|
|
115
|
+
|
|
116
|
+
- Rewrote WASM binary location and fetching to read from the filesystem
|
|
117
|
+
- Added the compiled [WASM binary](https://unpkg.com/browse/@hpcc-js/wasm@0.3.14/dist/) to the source
|
|
118
|
+
- Reduced the JS code by half to include only GraphViz, removed Expat and other unrelated code
|
|
119
|
+
- Removed build system and TypeScript, in favor of a single source file (based on the compiled dist file from [hpcc-systems/hpcc-js-wasm](https://github.com/hpcc-systems/hpcc-js-wasm))
|
|
120
|
+
|
|
121
|
+
## Licence
|
|
122
|
+
|
|
123
|
+
[MIT](LICENSE)
|
|
Binary file
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
declare type Format = "svg" | "dot" | "json" | "dot_json" | "xdot_json";
|
|
2
|
+
|
|
3
|
+
declare type Engine = "circo" | "dot" | "fdp" | "neato" | "osage" | "patchwork" | "twopi";
|
|
4
|
+
|
|
5
|
+
interface Image {
|
|
6
|
+
path: string;
|
|
7
|
+
width: string;
|
|
8
|
+
height: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface File {
|
|
12
|
+
path: string;
|
|
13
|
+
data: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface Ext {
|
|
17
|
+
images?: Image[];
|
|
18
|
+
files?: File[];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export declare const graphviz: {
|
|
22
|
+
layout(dotSource: string, outputFormat?: Format, layoutEngine?: Engine, ext?: Ext | undefined): Promise<string>;
|
|
23
|
+
circo(dotSource: string, outputFormat?: Format, ext?: Ext | undefined): Promise<string>;
|
|
24
|
+
dot(dotSource: string, outputFormat?: Format, ext?: Ext | undefined): Promise<string>;
|
|
25
|
+
fdp(dotSource: string, outputFormat?: Format, ext?: Ext | undefined): Promise<string>;
|
|
26
|
+
neato(dotSource: string, outputFormat?: Format, ext?: Ext | undefined): Promise<string>;
|
|
27
|
+
osage(dotSource: string, outputFormat?: Format, ext?: Ext | undefined): Promise<string>;
|
|
28
|
+
patchwork(dotSource: string, outputFormat?: Format, ext?: Ext | undefined): Promise<string>;
|
|
29
|
+
twopi(dotSource: string, outputFormat?: Format, ext?: Ext | undefined): Promise<string>;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export {};
|
|
33
|
+
|