-
Notifications
You must be signed in to change notification settings - Fork 1
/
mod.ts
86 lines (84 loc) · 1.96 KB
/
mod.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/**
* # Deplot
*
* > Simple and complete Plot gui module for [Deno](https://deno.land) local scripts
* > to provide a helper for science computing.
*
* ## Dependencies
*
* Use [WebUI](https://deno.land/x/webui) for window managing and plots libraries for tracing.
*
* Supports [Plotly.js](https://plotly.com/javascript/) and [Chart.js](https://www.chartjs.org/) for plotting.
*
* ## Usage
*
* All the modules are exposed in `mod.ts`
*
* ```ts
* import { Datas, Deplot, Plotly } from 'https://deno.land/x/deplot/mod.ts'
*
* const barPlot = new Deplot(
* 'Plotly',
* {
* title: 'My bar plot',
* size: { width: 800, height: 600 },
* },
* )
*
* const trace: Plotly.Data = {
* x: ['Zebras', 'Lions', 'Pelicans'],
* y: [90, 40, 60],
* type: 'bar',
* name: 'New York Zoo',
* }
*
* const layout: Partial<Plotly.Layout> = {
* title: 'Hide the Modebar',
* showlegend: true,
* }
*
* const datas: Datas = { data: [trace], layout, config: { editable: true } }
*
* await barPlot.plot(datas)
*
* const trace2: Plotly.Data = {
* x: [1, 2, 3, 4, 5],
* y: [4, 0, 4, 6, 8],
* mode: 'lines+markers',
* type: 'scatter',
* }
*
* const datas2 = { data: [trace2], layout }
*
* new Deplot('Plotly').plot(datas)
* ```
*
* ## Examples
*
* [Plotly.js](https://plotly.com/javascript/)
*
* ```sh
* deno run --allow-read --allow-write --allow-env --allow-ffi --unstable https://deno.land/x/deplot/examples/plotly.ts
* ```
*
* [Chart.js](https://www.chartjs.org/docs/3.7.0/)
*
* ```sh
* deno run --allow-read --allow-write --allow-env --allow-ffi --unstable https://deno.land/x/deplot/examples/chartjs.ts
* ```
*
* _For flags see [Deno WebUI/Security flags](https://github.com/webui-dev/deno-webui/#security-flags)_
*
* @module
* @license MIT
*/
import { Deplot } from './src/deplot.ts'
export default Deplot
export { Deplot } from './src/deplot.ts'
export type {
ChartJs,
Datas,
DeplotOptions,
PlotEngine,
Plotly,
} from './src/types.ts'