svelte-plotly.js 0.2.0 → 0.2.1
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/Plot.svelte +1 -1
- package/Plot.svelte.d.ts +3 -3
- package/README.md +42 -1
- package/package.json +2 -2
package/Plot.svelte
CHANGED
|
@@ -52,7 +52,7 @@ const events = {
|
|
|
52
52
|
plotly_transitioninterrupted: 'transitionInterrupted',
|
|
53
53
|
plotly_unhover: 'unhover',
|
|
54
54
|
plotly_update: 'update',
|
|
55
|
-
plotly_webglcontextlost: 'webGLContextLost'
|
|
55
|
+
plotly_webglcontextlost: 'webGLContextLost'
|
|
56
56
|
// TODO add all plotly_${traceType}click
|
|
57
57
|
};
|
|
58
58
|
const dispatch = createEventDispatcher();
|
package/Plot.svelte.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="lodash" />
|
|
2
2
|
import { SvelteComponentTyped } from "svelte";
|
|
3
|
-
import type { Data, Layout, Config, PlotlyHTMLElement, BeforePlotEvent, ClickAnnotationEvent, FrameAnimationEvent, LegendClickEvent, PlotMouseEvent, PlotRelayoutEvent, PlotRestyleEvent, PlotSelectionEvent, SliderEndEvent, SliderChangeEvent, SliderStartEvent, SunburstClickEvent } from 'plotly.js';
|
|
4
|
-
export type { Data, Layout, Config, PlotlyHTMLElement, BeforePlotEvent, ClickAnnotationEvent, FrameAnimationEvent, LegendClickEvent, PlotMouseEvent, PlotRelayoutEvent, PlotRestyleEvent, PlotSelectionEvent, SliderChangeEvent, SliderStartEvent, SunburstClickEvent };
|
|
3
|
+
import type { Data, Layout, Config, PlotlyHTMLElement, BeforePlotEvent, ClickAnnotationEvent, FrameAnimationEvent, LegendClickEvent, PlotMouseEvent, PlotHoverEvent, PlotRelayoutEvent, PlotRestyleEvent, PlotSelectionEvent, SliderEndEvent, SliderChangeEvent, SliderStartEvent, SunburstClickEvent } from 'plotly.js';
|
|
4
|
+
export type { Data, Layout, Config, PlotlyHTMLElement, BeforePlotEvent, ClickAnnotationEvent, FrameAnimationEvent, LegendClickEvent, PlotMouseEvent, PlotHoverEvent, PlotRelayoutEvent, PlotRestyleEvent, PlotSelectionEvent, SliderChangeEvent, SliderStartEvent, SunburstClickEvent };
|
|
5
5
|
export declare type FillParent = boolean | 'width' | 'height';
|
|
6
6
|
import type { DebounceSettings } from 'lodash-es';
|
|
7
7
|
export interface DebounceOptions extends DebounceSettings {
|
|
@@ -47,7 +47,7 @@ declare const __propDef: {
|
|
|
47
47
|
deselect: undefined;
|
|
48
48
|
doubleClick: undefined;
|
|
49
49
|
framework: undefined;
|
|
50
|
-
hover:
|
|
50
|
+
hover: PlotHoverEvent;
|
|
51
51
|
legendClick: LegendClickEvent;
|
|
52
52
|
legendDoubleClick: LegendClickEvent;
|
|
53
53
|
react: PlotUpdateEvent;
|
package/README.md
CHANGED
|
@@ -41,10 +41,51 @@ This is an unofficial package that lets you efficiently use [plotly.js](https://
|
|
|
41
41
|
| `bind:element` | `HTMLDivElement` | the HTML element wrapping the plot
|
|
42
42
|
| `bind:plot` | `PlotlyHTMLElement` | the inner HTML element containing the plot
|
|
43
43
|
|
|
44
|
+
## Events
|
|
45
|
+
_**NOTE:** Due to Plotly's atrocious documentation, most events aren't even mentioned anywhere. Links to source code are provided as the bare minimum information about each event._
|
|
46
|
+
|
|
47
|
+
| Prop | Callback argument | Description
|
|
48
|
+
| ---- | ----------------- | -------------
|
|
49
|
+
| `on:afterExport` | — | ?
|
|
50
|
+
| `on:afterPlot` | — | triggers each time a chart is plotted, or re-plotted after the restyling or relayout of a plot [(docs)](https://plotly.com/javascript/plotlyjs-events/#afterplot-event), [(src)](https://github.com/plotly/plotly.js/blob/11699489c248767619f1f73cde4295f001ec37c3/src/plot_api/plot_api.js#L405)
|
|
51
|
+
| `on:animated` | — | triggers once an animation finished playing [(demo)](https://codepen.io/csha/pen/NWYJGgg), [(docs)](https://plotly.com/javascript/plotlyjs-events/#additional-events), [(src 1)](https://github.com/plotly/plotly.js/blob/11699489c248767619f1f73cde4295f001ec37c3/src/plot_api/plot_api.js#L405), [(src 2)](https://github.com/plotly/plotly.js/blob/11699489c248767619f1f73cde4295f001ec37c3/src/plot_api/plot_api.js#L3445)
|
|
52
|
+
| `on:animating` | — | ? [(src)](https://github.com/plotly/plotly.js/blob/11699489c248767619f1f73cde4295f001ec37c3/src/plot_api/plot_api.js#L3308)
|
|
53
|
+
| `on:animatingFrame` | [`FrameAnimationEvent`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0852d33e37bc8fff1fe99cc328bde65e84e3e1c0/types/plotly.js/index.d.ts#L126) | ? [(src)](https://github.com/plotly/plotly.js/blob/11699489c248767619f1f73cde4295f001ec37c3/src/plot_api/plot_api.js#L3293)
|
|
54
|
+
| `on:animationInterrupted` | — | ? [(src)](https://github.com/plotly/plotly.js/blob/11699489c248767619f1f73cde4295f001ec37c3/src/plot_api/plot_api.js#L3189)
|
|
55
|
+
| `on:autoSize` | — | ? [(docs)](https://plotly.com/javascript/plotlyjs-events/#additional-events)
|
|
56
|
+
| `on:beforeExport` | — | ?
|
|
57
|
+
| `on:beforeHover` | [`PlotMouseEvent`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0852d33e37bc8fff1fe99cc328bde65e84e3e1c0/types/plotly.js/index.d.ts#L69) | ?
|
|
58
|
+
| `on:beforePlot` | [`BeforePlotEvent`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0852d33e37bc8fff1fe99cc328bde65e84e3e1c0/types/plotly.js/index.d.ts#L243) | ? [(src)](https://github.com/plotly/plotly.js/blob/11699489c248767619f1f73cde4295f001ec37c3/src/plot_api/plot_api.js#L72)
|
|
59
|
+
| `on:buttonClicked` | [`ButtonClickedEvent`](https://github.com/m93a/svelte-plotly.js/blob/c59b0bad033960797200e359136befae87379ab6/src/lib/Plot.svelte#L46) | ?
|
|
60
|
+
| `on:click` | [`PlotMouseEvent`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0852d33e37bc8fff1fe99cc328bde65e84e3e1c0/types/plotly.js/index.d.ts#L69) | ? [(docs 1)](https://plotly.com/javascript/plotlyjs-events/#click-event), [(docs 2)](https://plotly.com/javascript/click-events/)
|
|
61
|
+
| `on:clickAnnotation` | [`ClickAnnotationEvent`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0852d33e37bc8fff1fe99cc328bde65e84e3e1c0/types/plotly.js/index.d.ts#L119) | ?
|
|
62
|
+
| `on:deselect` | — | ? [(docs)](https://plotly.com/javascript/plotlyjs-events/#additional-events)
|
|
63
|
+
| `on:doubleClick` | — | ? [(docs)](https://plotly.com/javascript/plotlyjs-events/#double-click-event)
|
|
64
|
+
| `on:framework` | — | ?
|
|
65
|
+
| `on:hover` | [`PlotHoverEvent`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0852d33e37bc8fff1fe99cc328bde65e84e3e1c0/types/plotly.js/index.d.ts#L74) | ? [(docs)](https://plotly.com/javascript/plotlyjs-events/#hover-event)
|
|
66
|
+
| `on:legendClick` | [`LegendClickEvent`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0852d33e37bc8fff1fe99cc328bde65e84e3e1c0/types/plotly.js/index.d.ts#L138) | ? [(docs)](https://plotly.com/javascript/plotlyjs-events/#legend-click-events)
|
|
67
|
+
| `on:legendDoubleClick` | [`LegendClickEvent`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0852d33e37bc8fff1fe99cc328bde65e84e3e1c0/types/plotly.js/index.d.ts#L138) | ? [(docs)](https://plotly.com/javascript/plotlyjs-events/#legend-click-events)
|
|
68
|
+
| `on:react` | [`PlotUpdateEvent`](https://github.com/m93a/svelte-plotly.js/blob/c59b0bad033960797200e359136befae87379ab6/src/lib/Plot.svelte#L52) | ?
|
|
69
|
+
| `on:redraw` | — | ? [(docs)](https://plotly.com/javascript/plotlyjs-events/#additional-events)
|
|
70
|
+
| `on:relayout` | [`PlotRelayoutEvent`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0852d33e37bc8fff1fe99cc328bde65e84e3e1c0/types/plotly.js/index.d.ts#L110) | ? [(docs)](https://plotly.com/javascript/plotlyjs-events/#update-data)
|
|
71
|
+
| `on:relayouting` | [`PlotRelayoutEvent`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0852d33e37bc8fff1fe99cc328bde65e84e3e1c0/types/plotly.js/index.d.ts#L110) | ? [(docs)](https://plotly.com/javascript/plotlyjs-events/#update-data)
|
|
72
|
+
| `on:restyle` | [`PlotRestyleEvent`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0852d33e37bc8fff1fe99cc328bde65e84e3e1c0/types/plotly.js/index.d.ts#L102) | ? [(docs)](https://plotly.com/javascript/plotlyjs-events/#update-data)
|
|
73
|
+
| `on:selected` | [`PlotSelectionEvent`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0852d33e37bc8fff1fe99cc328bde65e84e3e1c0/types/plotly.js/index.d.ts#L92) | ? [(docs)](https://plotly.com/javascript/plotlyjs-events/#select-event)
|
|
74
|
+
| `on:selecting` | [`PlotSelectionEvent`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0852d33e37bc8fff1fe99cc328bde65e84e3e1c0/types/plotly.js/index.d.ts#L92) | ? [(docs)](https://plotly.com/javascript/plotlyjs-events/#select-event)
|
|
75
|
+
| `on:sliderChange` | [`SliderChangeEvent`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0852d33e37bc8fff1fe99cc328bde65e84e3e1c0/types/plotly.js/index.d.ts#L203) | ?
|
|
76
|
+
| `on:sliderEnd` | [`SliderEndEvent`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0852d33e37bc8fff1fe99cc328bde65e84e3e1c0/types/plotly.js/index.d.ts#L214) | ?
|
|
77
|
+
| `on:sliderStart` | [`SliderStartEvent`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0852d33e37bc8fff1fe99cc328bde65e84e3e1c0/types/plotly.js/index.d.ts#L210) | ?
|
|
78
|
+
| `on:sunburstClick` | [`SunburstClickEvent`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0852d33e37bc8fff1fe99cc328bde65e84e3e1c0/types/plotly.js/index.d.ts#L219) | ?
|
|
79
|
+
| `on:transitioned` | — | ?
|
|
80
|
+
| `on:transitioning` | — | ?
|
|
81
|
+
| `on:transitionInterrupted` | — | ?
|
|
82
|
+
| `on:unhover` | [`PlotMouseEvent`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0852d33e37bc8fff1fe99cc328bde65e84e3e1c0/types/plotly.js/index.d.ts#L69) | ?
|
|
83
|
+
| `on:update` | [`PlotUpdateEvent`](https://github.com/m93a/svelte-plotly.js/blob/c59b0bad033960797200e359136befae87379ab6/src/lib/Plot.svelte#L52) | ?
|
|
84
|
+
| `on:webGLContextLost` | — | ? [(docs)](https://plotly.com/javascript/plotlyjs-events/#additional-events)
|
|
44
85
|
|
|
45
86
|
# Roadmap
|
|
46
87
|
* [x] add autosizing
|
|
47
88
|
* [x] add debouncing
|
|
48
|
-
* [
|
|
89
|
+
* [x] add event redirecting
|
|
49
90
|
* [ ] add unit tests
|
|
50
91
|
* [ ] add SSR rendering to an image
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svelte-plotly.js",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Michal Grňo (m93a)",
|
|
6
6
|
"url": "https://github.com/m93a/"
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"type": "module",
|
|
39
39
|
"dependencies": {
|
|
40
40
|
"@types/lodash-es": "^4.17.6",
|
|
41
|
-
"@types/plotly.js": "^
|
|
41
|
+
"@types/plotly.js": "^2.12.2",
|
|
42
42
|
"lodash-es": "^4.17.21",
|
|
43
43
|
"plotly.js-dist": "^2.12.1"
|
|
44
44
|
},
|