@fundar/data-chart-telling 0.0.44 → 0.0.45
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.
|
@@ -20,9 +20,12 @@
|
|
|
20
20
|
*
|
|
21
21
|
* container ▸ timeline (one shared scrubber) ▸ facet (split per small-multiple) ▸ plot
|
|
22
22
|
*
|
|
23
|
-
* The leaf snippet receives `{ data, width, height, facetValue?, selectedValue
|
|
24
|
-
* and knows nothing about how that box or that data slice was
|
|
25
|
-
* is what lets any plot (line, bar, heatmap, …) drop in
|
|
23
|
+
* The leaf snippet receives `{ data, width, height, facetValue?, selectedValue?,
|
|
24
|
+
* margins? }` and knows nothing about how that box or that data slice was
|
|
25
|
+
* produced, which is what lets any plot (line, bar, heatmap, …) drop in
|
|
26
|
+
* unchanged. `margins` is only present when `facet.labelsForMargin` is
|
|
27
|
+
* given — forward it to the plot's own `margins` prop so every facet
|
|
28
|
+
* shares the same content box.
|
|
26
29
|
*/
|
|
27
30
|
let {
|
|
28
31
|
width,
|
|
@@ -83,17 +86,19 @@
|
|
|
83
86
|
formatIndicator={facet.formatIndicator}
|
|
84
87
|
indicator={facet.indicator}
|
|
85
88
|
navButton={facet.navButton}
|
|
89
|
+
labelsForMargin={facet.labelsForMargin}
|
|
86
90
|
width={w}
|
|
87
91
|
height={h}
|
|
88
92
|
>
|
|
89
|
-
{#snippet cell({ facetValue, data: cellData, width: cw, height: ch })}
|
|
93
|
+
{#snippet cell({ facetValue, data: cellData, width: cw, height: ch, margins })}
|
|
90
94
|
{@render plot({
|
|
91
95
|
data: cellData,
|
|
92
96
|
width: cw,
|
|
93
97
|
height: ch,
|
|
94
98
|
facetValue,
|
|
95
99
|
selectedValue,
|
|
96
|
-
legend: legendPlotContext
|
|
100
|
+
legend: legendPlotContext,
|
|
101
|
+
margins
|
|
97
102
|
})}
|
|
98
103
|
{/snippet}
|
|
99
104
|
</FacetLayout>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
2
|
import type { TimeValue } from '../layout/timeline';
|
|
3
3
|
import type { LegendPlotContext } from '../layout/legend';
|
|
4
|
+
import type { MarginConfig } from '../plots/props';
|
|
4
5
|
export type ChartBoxContext = {
|
|
5
6
|
width: number;
|
|
6
7
|
height: number;
|
|
@@ -13,6 +14,8 @@ export type ChartPlotContext<TRow extends Record<string, unknown>> = {
|
|
|
13
14
|
facetValue?: string;
|
|
14
15
|
selectedValue?: TimeValue;
|
|
15
16
|
legend?: LegendPlotContext;
|
|
17
|
+
/** Present only when faceted with `facet.labelsForMargin` — forward to the plot's own `margins` prop so every facet shares the same content box. */
|
|
18
|
+
margins?: MarginConfig;
|
|
16
19
|
};
|
|
17
20
|
export type ChartPlotSnippet<TRow extends Record<string, unknown>> = Snippet<[
|
|
18
21
|
ChartPlotContext<TRow>
|