|
28 | 28 | ticks?: number | string | RawValue[];
|
29 | 29 | /** set to false or null to disable tick labels */
|
30 | 30 | text: boolean | null;
|
31 |
| - } & XOR< |
32 |
| - { |
33 |
| - /** approximate number of ticks to be generated */ |
34 |
| - tickCount?: number; |
35 |
| - }, |
36 |
| - { |
37 |
| - /** approximate number of pixels between generated ticks */ |
38 |
| - tickSpacing?: number; |
39 |
| - } |
40 |
| - >; |
| 31 | + /** approximate number of ticks to be generated */ |
| 32 | + tickCount?: number; |
| 33 | + /** approximate number of pixels between generated ticks */ |
| 34 | + tickSpacing?: number; |
| 35 | + }; |
41 | 36 | </script>
|
42 | 37 |
|
43 | 38 | <script lang="ts">
|
|
49 | 44 | BaseMarkProps,
|
50 | 45 | RawValue,
|
51 | 46 | FacetContext,
|
52 |
| - PlotDefaults |
| 47 | + PlotDefaults, |
| 48 | + ChannelName |
53 | 49 | } from '../types.js';
|
54 | 50 | import autoTimeFormat from '$lib/helpers/autoTimeFormat.js';
|
55 | 51 | import type { ConstantAccessor } from '$lib/types.js';
|
56 | 52 | import { autoTicks } from '$lib/helpers/autoTicks.js';
|
57 | 53 | import { resolveScaledStyles } from '$lib/helpers/resolve.js';
|
58 | 54 |
|
59 |
| - const DEFAULTS = { |
| 55 | + let markProps: AxisYMarkProps = $props(); |
| 56 | +
|
| 57 | + const DEFAULTS: Omit<AxisYMarkProps, 'data' | ChannelName> = { |
60 | 58 | tickSize: 6,
|
61 | 59 | tickPadding: 3,
|
62 | 60 | tickFontSize: 11,
|
63 |
| - axisYAnchor: 'left', |
64 |
| - ...getContext<Partial<PlotDefaults>>('svelteplot/_defaults') |
| 61 | + anchor: 'left', |
| 62 | + ...getContext<PlotDefaults>('svelteplot/_defaults').axis, |
| 63 | + ...getContext<PlotDefaults>('svelteplot/_defaults').axisY |
65 | 64 | };
|
66 | 65 |
|
67 |
| - let { |
| 66 | + const { |
68 | 67 | ticks: magicTicks,
|
69 | 68 | data = Array.isArray(magicTicks) ? magicTicks : [],
|
70 | 69 | automatic = false,
|
71 | 70 | title,
|
72 |
| - anchor = DEFAULTS.axisYAnchor as 'left' | 'right', |
| 71 | + anchor, |
73 | 72 | facetAnchor = 'auto',
|
74 | 73 | interval = typeof magicTicks === 'string' ? magicTicks : undefined,
|
75 | 74 | lineAnchor = 'center',
|
76 |
| - tickSize = DEFAULTS.tickSize, |
77 |
| - tickFontSize = DEFAULTS.tickFontSize, |
78 |
| - tickPadding = DEFAULTS.tickPadding, |
| 75 | + tickSize, |
| 76 | + tickFontSize, |
| 77 | + tickPadding, |
79 | 78 | tickFormat,
|
80 | 79 | tickClass,
|
81 | 80 | tickCount = typeof magicTicks === 'number' ? magicTicks : undefined,
|
82 | 81 | tickSpacing,
|
83 | 82 | text = true,
|
84 | 83 | ...options
|
85 |
| - }: AxisYMarkProps = $props(); |
| 84 | + }: AxisYMarkProps = $derived({ ...DEFAULTS, ...markProps }); |
86 | 85 |
|
87 | 86 | const { getPlotState } = getContext<PlotContext>('svelteplot');
|
88 | 87 | const plot = $derived(getPlotState());
|
|
0 commit comments