@fundar/data-chart-telling 0.0.10 → 0.0.12
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/layout/tooltip/controller.svelte.d.ts +1 -0
- package/dist/layout/tooltip/controller.svelte.js +1 -1
- package/dist/plots/bar/Plot.svelte +3 -0
- package/dist/plots/line/Plot.svelte +3 -0
- package/dist/plots/markers/HoverMarker.svelte +8 -3
- package/dist/plots/pyramid/Plot.svelte +3 -0
- package/package.json +1 -1
|
@@ -33,6 +33,7 @@ export declare function createHoverController<T extends Record<string, unknown>>
|
|
|
33
33
|
y: AxisValue;
|
|
34
34
|
label: string;
|
|
35
35
|
series: string | undefined;
|
|
36
|
+
color: string | undefined;
|
|
36
37
|
}[];
|
|
37
38
|
readonly matchedRows: HoverPoint<T>[];
|
|
38
39
|
readonly ruleX: AxisValue | null;
|
|
@@ -31,7 +31,7 @@ export function createHoverController(args) {
|
|
|
31
31
|
const matchedRows = $derived(filterBySeries(matched, args.seriesFilter?.()));
|
|
32
32
|
// Points highlighted in THIS facet for the in-SVG marker — no series
|
|
33
33
|
// filtering, since that's the tooltip text's concern, not the marker's.
|
|
34
|
-
const highlight = $derived(matched.map(({ x, y, label, series }) => ({ x, y, label, series })));
|
|
34
|
+
const highlight = $derived(matched.map(({ x, y, label, series, color }) => ({ x, y, label, series, color })));
|
|
35
35
|
// Raw hover position — available whenever there are matched points.
|
|
36
36
|
// PlotLayout gates actual display with impliesRuleX/Y + the marker's ruleX/Y props.
|
|
37
37
|
const ruleX = $derived(matched.length > 0 ? args.hover().activeX : null);
|
|
@@ -156,10 +156,12 @@
|
|
|
156
156
|
ruleStyle={marker.ruleStyle}
|
|
157
157
|
dotStyle={marker.dotStyle}
|
|
158
158
|
fontStyle={marker.fontStyle}
|
|
159
|
+
seriesColor={seg.style?.fill ?? defaultColor}
|
|
159
160
|
/>
|
|
160
161
|
{/if}
|
|
161
162
|
{/each}
|
|
162
163
|
{:else}
|
|
164
|
+
{@const segs = resolveSegmentsForSeries(segments, group.series.name)}
|
|
163
165
|
<HoverMarker
|
|
164
166
|
data={seriesPoints}
|
|
165
167
|
ruleX={marker.ruleX !== false && (impliesRuleX || marker.ruleX === true) ? ruleX : null}
|
|
@@ -168,6 +170,7 @@
|
|
|
168
170
|
ruleStyle={marker.ruleStyle}
|
|
169
171
|
dotStyle={marker.dotStyle}
|
|
170
172
|
fontStyle={marker.fontStyle}
|
|
173
|
+
seriesColor={segs[0]?.style?.fill ?? defaultColor}
|
|
171
174
|
/>
|
|
172
175
|
{/if}
|
|
173
176
|
{/if}
|
|
@@ -178,10 +178,12 @@
|
|
|
178
178
|
ruleStyle={marker.ruleStyle}
|
|
179
179
|
dotStyle={marker.dotStyle}
|
|
180
180
|
fontStyle={marker.fontStyle}
|
|
181
|
+
seriesColor={seg.style?.stroke?.stroke ?? defaultColor}
|
|
181
182
|
/>
|
|
182
183
|
{/if}
|
|
183
184
|
{/each}
|
|
184
185
|
{:else}
|
|
186
|
+
{@const segs = resolveSegmentsForSeries(segments, group.series.name)}
|
|
185
187
|
<HoverMarker
|
|
186
188
|
data={seriesPoints}
|
|
187
189
|
ruleX={marker.ruleX !== false && (impliesRuleX || marker.ruleX === true) ? ruleX : null}
|
|
@@ -190,6 +192,7 @@
|
|
|
190
192
|
ruleStyle={marker.ruleStyle}
|
|
191
193
|
dotStyle={marker.dotStyle}
|
|
192
194
|
fontStyle={marker.fontStyle}
|
|
195
|
+
seriesColor={segs[0]?.style?.stroke?.stroke ?? defaultColor}
|
|
193
196
|
/>
|
|
194
197
|
{/if}
|
|
195
198
|
{/if}
|
|
@@ -34,9 +34,14 @@
|
|
|
34
34
|
ruleStyle,
|
|
35
35
|
dotStyle,
|
|
36
36
|
fontStyle,
|
|
37
|
+
seriesColor,
|
|
37
38
|
}: Props = $props();
|
|
38
39
|
|
|
39
40
|
const cfg = $derived(getConfiguration());
|
|
41
|
+
|
|
42
|
+
/** Explicit style wins; otherwise fall back to the series color, then the point's own resolved color. */
|
|
43
|
+
const resolveColor = (explicit: string | undefined, point: HoverDisplayPoint) =>
|
|
44
|
+
explicit ?? seriesColor ?? point.color;
|
|
40
45
|
</script>
|
|
41
46
|
|
|
42
47
|
{#if ruleX != null}
|
|
@@ -70,8 +75,8 @@
|
|
|
70
75
|
style={{
|
|
71
76
|
...cfg.hover.dot,
|
|
72
77
|
...dotStyle,
|
|
73
|
-
|
|
74
|
-
|
|
78
|
+
dotFill: resolveColor(dotStyle?.dotFill, point),
|
|
79
|
+
dotStroke: resolveColor(dotStyle?.dotStroke, point),
|
|
75
80
|
}}
|
|
76
81
|
/>
|
|
77
82
|
{/each}
|
|
@@ -85,7 +90,7 @@
|
|
|
85
90
|
style={{
|
|
86
91
|
...cfg.hover.font,
|
|
87
92
|
...fontStyle,
|
|
88
|
-
|
|
93
|
+
fill: resolveColor(fontStyle?.fill, point),
|
|
89
94
|
}}
|
|
90
95
|
/>
|
|
91
96
|
{/each}
|
|
@@ -262,10 +262,12 @@
|
|
|
262
262
|
ruleStyle={marker.ruleStyle}
|
|
263
263
|
dotStyle={marker.dotStyle}
|
|
264
264
|
fontStyle={marker.fontStyle}
|
|
265
|
+
seriesColor={seg.style?.fill ?? defaultColor}
|
|
265
266
|
/>
|
|
266
267
|
{/if}
|
|
267
268
|
{/each}
|
|
268
269
|
{:else}
|
|
270
|
+
{@const segs = resolveSegmentsForSeries(segments, group.series.name)}
|
|
269
271
|
<HoverMarker
|
|
270
272
|
data={seriesPoints}
|
|
271
273
|
ruleX={marker.ruleX !== false && (impliesRuleX || marker.ruleX === true) ? ruleX : null}
|
|
@@ -274,6 +276,7 @@
|
|
|
274
276
|
ruleStyle={marker.ruleStyle}
|
|
275
277
|
dotStyle={marker.dotStyle}
|
|
276
278
|
fontStyle={marker.fontStyle}
|
|
279
|
+
seriesColor={segs[0]?.style?.fill ?? defaultColor}
|
|
277
280
|
/>
|
|
278
281
|
{/if}
|
|
279
282
|
{/if}
|