layerchart 0.90.0 → 0.91.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/dist/components/Brush.svelte +18 -12
- package/dist/components/Chart.svelte.d.ts +1 -1
- package/dist/components/charts/AreaChart.svelte +2 -2
- package/dist/components/charts/LineChart.svelte +2 -2
- package/dist/components/charts/PieChart.svelte.d.ts +1 -1
- package/dist/components/charts/ScatterChart.svelte +2 -2
- package/dist/components/tooltip/TooltipContext.svelte +4 -4
- package/dist/components/tooltip/TooltipContext.svelte.d.ts +1 -1
- package/package.json +1 -1
|
@@ -61,10 +61,16 @@
|
|
|
61
61
|
labels?: string;
|
|
62
62
|
} = {};
|
|
63
63
|
|
|
64
|
-
export let
|
|
65
|
-
export let
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
export let onchange: (detail: { xDomain?: DomainType; yDomain?: DomainType }) => void = () => {};
|
|
65
|
+
export let onbrushstart: (detail: {
|
|
66
|
+
xDomain?: DomainType;
|
|
67
|
+
yDomain?: DomainType;
|
|
68
|
+
}) => void = () => {};
|
|
69
|
+
export let onbrushend: (detail: {
|
|
70
|
+
xDomain?: DomainType;
|
|
71
|
+
yDomain?: DomainType;
|
|
72
|
+
}) => void = () => {};
|
|
73
|
+
export let onreset: (detail: { xDomain?: DomainType; yDomain?: DomainType }) => void = () => {};
|
|
68
74
|
|
|
69
75
|
let frameEl: SVGRectElement;
|
|
70
76
|
|
|
@@ -88,7 +94,7 @@
|
|
|
88
94
|
},
|
|
89
95
|
};
|
|
90
96
|
|
|
91
|
-
|
|
97
|
+
onbrushstart({ xDomain, yDomain });
|
|
92
98
|
|
|
93
99
|
const onPointerMove = (e: PointerEvent) => {
|
|
94
100
|
fn(start, {
|
|
@@ -100,17 +106,17 @@
|
|
|
100
106
|
// // Ignore?
|
|
101
107
|
// // TODO: What about when using `x` or `y` axis?
|
|
102
108
|
// } else {
|
|
103
|
-
|
|
109
|
+
onchange({ xDomain, yDomain });
|
|
104
110
|
// }
|
|
105
111
|
};
|
|
106
112
|
|
|
107
113
|
const onPointerUp = (e: PointerEvent) => {
|
|
108
114
|
if (e.target === frameEl) {
|
|
109
115
|
reset();
|
|
110
|
-
|
|
116
|
+
onchange({ xDomain, yDomain });
|
|
111
117
|
}
|
|
112
118
|
|
|
113
|
-
|
|
119
|
+
onbrushend({ xDomain, yDomain });
|
|
114
120
|
|
|
115
121
|
if (resetOnEnd) {
|
|
116
122
|
reset();
|
|
@@ -203,7 +209,7 @@
|
|
|
203
209
|
xDomain = originalXDomain;
|
|
204
210
|
yDomain = originalYDomain;
|
|
205
211
|
|
|
206
|
-
|
|
212
|
+
onreset({ xDomain, yDomain });
|
|
207
213
|
}
|
|
208
214
|
|
|
209
215
|
function selectAll() {
|
|
@@ -267,7 +273,7 @@
|
|
|
267
273
|
ondblclick={() => {
|
|
268
274
|
if (yDomain) {
|
|
269
275
|
yDomain[0] = yDomainMin;
|
|
270
|
-
|
|
276
|
+
onchange({ xDomain, yDomain });
|
|
271
277
|
}
|
|
272
278
|
}}
|
|
273
279
|
>
|
|
@@ -312,7 +318,7 @@
|
|
|
312
318
|
ondblclick={() => {
|
|
313
319
|
if (xDomain) {
|
|
314
320
|
xDomain[0] = xDomainMin;
|
|
315
|
-
|
|
321
|
+
onchange({ xDomain, yDomain });
|
|
316
322
|
}
|
|
317
323
|
}}
|
|
318
324
|
>
|
|
@@ -334,7 +340,7 @@
|
|
|
334
340
|
ondblclick={() => {
|
|
335
341
|
if (xDomain) {
|
|
336
342
|
xDomain[1] = xDomainMax;
|
|
337
|
-
|
|
343
|
+
onchange({ xDomain, yDomain });
|
|
338
344
|
}
|
|
339
345
|
}}
|
|
340
346
|
>
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
/** Enable debug view (show hit targets, etc) */
|
|
112
112
|
export let debug = false;
|
|
113
113
|
|
|
114
|
-
export let onclick: ({ data }: { data: any }) => any = () => {};
|
|
114
|
+
export let onclick: (e: MouseEvent, { data }: { data: any }) => any = () => {};
|
|
115
115
|
|
|
116
116
|
/** Exposed to allow binding in Chart */
|
|
117
117
|
export let tooltip = writable({
|
|
@@ -406,7 +406,7 @@
|
|
|
406
406
|
on:pointerleave={triggerPointerEvents ? hideTooltip : undefined}
|
|
407
407
|
on:click={(e) => {
|
|
408
408
|
if (triggerPointerEvents) {
|
|
409
|
-
onclick({ data: $tooltip?.data });
|
|
409
|
+
onclick(e, { data: $tooltip?.data });
|
|
410
410
|
}
|
|
411
411
|
}}
|
|
412
412
|
>
|
|
@@ -438,7 +438,7 @@
|
|
|
438
438
|
}
|
|
439
439
|
}}
|
|
440
440
|
onclick={(e, { data }) => {
|
|
441
|
-
onclick({ data });
|
|
441
|
+
onclick(e, { data });
|
|
442
442
|
}}
|
|
443
443
|
classes={{ path: cls(debug && 'fill-danger/10 stroke-danger') }}
|
|
444
444
|
/>
|
|
@@ -464,7 +464,7 @@
|
|
|
464
464
|
}
|
|
465
465
|
}}
|
|
466
466
|
on:click={(e) => {
|
|
467
|
-
onclick({ data: rect.data });
|
|
467
|
+
onclick(e, { data: rect.data });
|
|
468
468
|
}}
|
|
469
469
|
/>
|
|
470
470
|
{/each}
|
|
@@ -26,7 +26,7 @@ declare const __propDef: {
|
|
|
26
26
|
* @type {number}
|
|
27
27
|
*/ radius?: number;
|
|
28
28
|
/** Enable debug view (show hit targets, etc) */ debug?: boolean;
|
|
29
|
-
onclick?: ({ data }: {
|
|
29
|
+
onclick?: (e: MouseEvent, { data }: {
|
|
30
30
|
data: any;
|
|
31
31
|
}) => any;
|
|
32
32
|
/** Exposed to allow binding in Chart */ tooltip?: import("svelte/store").Writable<{
|