layerchart 0.81.1 → 0.81.3
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.
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
import type { DomainType } from '../utils/scales.js';
|
|
16
16
|
import { asAny } from '../utils/types.js';
|
|
17
17
|
|
|
18
|
-
const { xScale, yScale, width, height, padding } = chartContext();
|
|
18
|
+
const { xScale, yScale, width, height, padding, config } = chartContext();
|
|
19
19
|
|
|
20
20
|
/** Axis to apply brushing */
|
|
21
21
|
export let axis: 'x' | 'y' | 'both' = 'x';
|
|
@@ -38,8 +38,8 @@
|
|
|
38
38
|
export let mode: 'integrated' | 'separated' = 'integrated';
|
|
39
39
|
|
|
40
40
|
// Capture original domains for reset()
|
|
41
|
-
const originalXDomain = $
|
|
42
|
-
const originalYDomain = $
|
|
41
|
+
const originalXDomain = $config.xDomain;
|
|
42
|
+
const originalYDomain = $config.yDomain;
|
|
43
43
|
|
|
44
44
|
$: [xDomainMin, xDomainMax] = extent<number>($xScale.domain()) as [number, number];
|
|
45
45
|
$: [yDomainMin, yDomainMax] = extent<number>($yScale.domain()) as [number, number];
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
export let onChange: (e: { xDomain?: DomainType; yDomain?: DomainType }) => void = () => {};
|
|
65
65
|
export let onBrushStart: (e: { xDomain?: DomainType; yDomain?: DomainType }) => void = () => {};
|
|
66
66
|
export let onBrushEnd: (e: { xDomain?: DomainType; yDomain?: DomainType }) => void = () => {};
|
|
67
|
+
export let onReset: (e: { xDomain?: DomainType; yDomain?: DomainType }) => void = () => {};
|
|
67
68
|
|
|
68
69
|
let frameEl: SVGRectElement;
|
|
69
70
|
|
|
@@ -201,6 +202,8 @@
|
|
|
201
202
|
|
|
202
203
|
xDomain = originalXDomain;
|
|
203
204
|
yDomain = originalYDomain;
|
|
205
|
+
|
|
206
|
+
onReset({ xDomain, yDomain });
|
|
204
207
|
}
|
|
205
208
|
|
|
206
209
|
function selectAll() {
|
|
@@ -222,10 +225,10 @@
|
|
|
222
225
|
$: if (mode === 'separated') {
|
|
223
226
|
// Set reactively to handle cases where xDomain/yDomain are set externally (ex. `bind:xDomain`)
|
|
224
227
|
isActive =
|
|
225
|
-
xDomain?.[0]?.valueOf() !== originalXDomain[0]?.valueOf() ||
|
|
226
|
-
xDomain?.[1]?.valueOf() !== originalXDomain[1]?.valueOf() ||
|
|
227
|
-
yDomain?.[0]?.valueOf() !== originalYDomain[0]?.valueOf() ||
|
|
228
|
-
yDomain?.[1]?.valueOf() !== originalYDomain[1]?.valueOf();
|
|
228
|
+
xDomain?.[0]?.valueOf() !== originalXDomain?.[0]?.valueOf() ||
|
|
229
|
+
xDomain?.[1]?.valueOf() !== originalXDomain?.[1]?.valueOf() ||
|
|
230
|
+
yDomain?.[0]?.valueOf() !== originalYDomain?.[0]?.valueOf() ||
|
|
231
|
+
yDomain?.[1]?.valueOf() !== originalYDomain?.[1]?.valueOf();
|
|
229
232
|
}
|
|
230
233
|
</script>
|
|
231
234
|
|
|
@@ -36,6 +36,10 @@ declare const __propDef: {
|
|
|
36
36
|
xDomain?: DomainType;
|
|
37
37
|
yDomain?: DomainType;
|
|
38
38
|
}) => void) | undefined;
|
|
39
|
+
onReset?: ((e: {
|
|
40
|
+
xDomain?: DomainType;
|
|
41
|
+
yDomain?: DomainType;
|
|
42
|
+
}) => void) | undefined;
|
|
39
43
|
};
|
|
40
44
|
events: {
|
|
41
45
|
[evt: string]: CustomEvent<any>;
|
|
@@ -16,9 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { accessor, chartDataArray, type Accessor } from '../../utils/common.js';
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
interface $$Props extends ChartProps {
|
|
19
|
+
interface $$Props extends ComponentProps<Chart<TData>> {
|
|
22
20
|
cornerRadius?: typeof cornerRadius;
|
|
23
21
|
innerRadius?: typeof innerRadius;
|
|
24
22
|
key?: typeof key;
|
|
@@ -39,7 +37,7 @@
|
|
|
39
37
|
onTooltipClick?: typeof onTooltipClick;
|
|
40
38
|
}
|
|
41
39
|
|
|
42
|
-
export let data:
|
|
40
|
+
export let data: $$Props['data'] = [];
|
|
43
41
|
|
|
44
42
|
/** Key accessor */
|
|
45
43
|
export let key: Accessor<TData> = 'key';
|