@samizdata/mozaic 0.0.0-stage → 0.3.0
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/LICENSE +674 -0
- package/README.md +44 -2
- package/dist/annotations/Arrow.svelte +50 -0
- package/dist/annotations/Arrow.svelte.d.ts +18 -0
- package/dist/annotations/Callout.svelte +87 -0
- package/dist/annotations/Callout.svelte.d.ts +22 -0
- package/dist/annotations/Label.svelte +55 -0
- package/dist/annotations/Label.svelte.d.ts +19 -0
- package/dist/annotations/RefBand.svelte +46 -0
- package/dist/annotations/RefBand.svelte.d.ts +18 -0
- package/dist/annotations/RefLine.svelte +107 -0
- package/dist/annotations/RefLine.svelte.d.ts +27 -0
- package/dist/annotations/callout-geometry.d.ts +23 -0
- package/dist/annotations/callout-geometry.js +45 -0
- package/dist/annotations/index.d.ts +6 -0
- package/dist/annotations/index.js +6 -0
- package/dist/core/Canvas.svelte +55 -0
- package/dist/core/Canvas.svelte.d.ts +19 -0
- package/dist/core/Facets.svelte +80 -0
- package/dist/core/Facets.svelte.d.ts +49 -0
- package/dist/core/Html.svelte +38 -0
- package/dist/core/Html.svelte.d.ts +13 -0
- package/dist/core/Plot.svelte +202 -0
- package/dist/core/Plot.svelte.d.ts +60 -0
- package/dist/core/Svg.svelte +58 -0
- package/dist/core/Svg.svelte.d.ts +17 -0
- package/dist/core/accessor.d.ts +5 -0
- package/dist/core/accessor.js +3 -0
- package/dist/core/context.d.ts +25 -0
- package/dist/core/context.js +69 -0
- package/dist/core/index.d.ts +10 -0
- package/dist/core/index.js +9 -0
- package/dist/core/scales.d.ts +16 -0
- package/dist/core/scales.js +32 -0
- package/dist/core/types.d.ts +78 -0
- package/dist/core/types.js +1 -0
- package/dist/core/units.d.ts +6 -0
- package/dist/core/units.js +10 -0
- package/dist/embed/Embed.svelte +50 -0
- package/dist/embed/Embed.svelte.d.ts +14 -0
- package/dist/embed/code.d.ts +18 -0
- package/dist/embed/code.js +9 -0
- package/dist/embed/host.d.ts +6 -0
- package/dist/embed/host.js +20 -0
- package/dist/embed/index.d.ts +6 -0
- package/dist/embed/index.js +5 -0
- package/dist/embed/manifest.d.ts +16 -0
- package/dist/embed/manifest.js +1 -0
- package/dist/embed/params.svelte.d.ts +10 -0
- package/dist/embed/params.svelte.js +27 -0
- package/dist/embed/resize.d.ts +13 -0
- package/dist/embed/resize.js +28 -0
- package/dist/export/download.d.ts +13 -0
- package/dist/export/download.js +52 -0
- package/dist/export/figure-to-svg.d.ts +21 -0
- package/dist/export/figure-to-svg.js +187 -0
- package/dist/export/fonts.d.ts +26 -0
- package/dist/export/fonts.js +112 -0
- package/dist/export/index.d.ts +2 -0
- package/dist/export/index.js +2 -0
- package/dist/frame/Byline.svelte +26 -0
- package/dist/frame/Byline.svelte.d.ts +8 -0
- package/dist/frame/Chart.svelte +144 -0
- package/dist/frame/Chart.svelte.d.ts +37 -0
- package/dist/frame/ChartTools.svelte +259 -0
- package/dist/frame/ChartTools.svelte.d.ts +17 -0
- package/dist/frame/DataDownload.svelte +34 -0
- package/dist/frame/DataDownload.svelte.d.ts +34 -0
- package/dist/frame/DataTable.svelte +49 -0
- package/dist/frame/DataTable.svelte.d.ts +34 -0
- package/dist/frame/Footer.svelte +39 -0
- package/dist/frame/Footer.svelte.d.ts +10 -0
- package/dist/frame/Header.svelte +21 -0
- package/dist/frame/Header.svelte.d.ts +9 -0
- package/dist/frame/Logo.svelte +57 -0
- package/dist/frame/Logo.svelte.d.ts +8 -0
- package/dist/frame/Notes.svelte +29 -0
- package/dist/frame/Notes.svelte.d.ts +9 -0
- package/dist/frame/Source.svelte +29 -0
- package/dist/frame/Source.svelte.d.ts +9 -0
- package/dist/frame/Subtitle.svelte +22 -0
- package/dist/frame/Subtitle.svelte.d.ts +9 -0
- package/dist/frame/Title.svelte +31 -0
- package/dist/frame/Title.svelte.d.ts +9 -0
- package/dist/frame/index.d.ts +12 -0
- package/dist/frame/index.js +12 -0
- package/dist/guides/AxisX.svelte +101 -0
- package/dist/guides/AxisX.svelte.d.ts +22 -0
- package/dist/guides/AxisY.svelte +107 -0
- package/dist/guides/AxisY.svelte.d.ts +25 -0
- package/dist/guides/ColorRamp.svelte +93 -0
- package/dist/guides/ColorRamp.svelte.d.ts +25 -0
- package/dist/guides/GridX.svelte +35 -0
- package/dist/guides/GridX.svelte.d.ts +9 -0
- package/dist/guides/GridY.svelte +35 -0
- package/dist/guides/GridY.svelte.d.ts +9 -0
- package/dist/guides/Key.svelte +48 -0
- package/dist/guides/Key.svelte.d.ts +14 -0
- package/dist/guides/Legend.svelte +112 -0
- package/dist/guides/Legend.svelte.d.ts +26 -0
- package/dist/guides/SizeLegend.svelte +62 -0
- package/dist/guides/SizeLegend.svelte.d.ts +15 -0
- package/dist/guides/index.d.ts +9 -0
- package/dist/guides/index.js +9 -0
- package/dist/guides/ticks.d.ts +6 -0
- package/dist/guides/ticks.js +15 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +14 -0
- package/dist/interactive/ButtonGroup.svelte +98 -0
- package/dist/interactive/ButtonGroup.svelte.d.ts +42 -0
- package/dist/interactive/PointerArea.svelte +49 -0
- package/dist/interactive/PointerArea.svelte.d.ts +18 -0
- package/dist/interactive/Scroller.svelte +147 -0
- package/dist/interactive/Scroller.svelte.d.ts +54 -0
- package/dist/interactive/Tooltip.svelte +116 -0
- package/dist/interactive/Tooltip.svelte.d.ts +34 -0
- package/dist/interactive/index.d.ts +4 -0
- package/dist/interactive/index.js +4 -0
- package/dist/interactive/tooltip-position.d.ts +12 -0
- package/dist/interactive/tooltip-position.js +16 -0
- package/dist/locale/definitions.d.ts +145 -0
- package/dist/locale/definitions.js +138 -0
- package/dist/locale/index.d.ts +23 -0
- package/dist/locale/index.js +34 -0
- package/dist/marks/Arcs.svelte +93 -0
- package/dist/marks/Arcs.svelte.d.ts +47 -0
- package/dist/marks/Area.svelte +44 -0
- package/dist/marks/Area.svelte.d.ts +43 -0
- package/dist/marks/Arrows.svelte +93 -0
- package/dist/marks/Arrows.svelte.d.ts +50 -0
- package/dist/marks/Bars.svelte +111 -0
- package/dist/marks/Bars.svelte.d.ts +61 -0
- package/dist/marks/Beeswarm.svelte +84 -0
- package/dist/marks/Beeswarm.svelte.d.ts +42 -0
- package/dist/marks/Dumbbell.svelte +71 -0
- package/dist/marks/Dumbbell.svelte.d.ts +42 -0
- package/dist/marks/GeoPath.svelte +56 -0
- package/dist/marks/GeoPath.svelte.d.ts +42 -0
- package/dist/marks/Hemicycle.svelte +182 -0
- package/dist/marks/Hemicycle.svelte.d.ts +78 -0
- package/dist/marks/Intervals.svelte +128 -0
- package/dist/marks/Intervals.svelte.d.ts +60 -0
- package/dist/marks/Line.svelte +64 -0
- package/dist/marks/Line.svelte.d.ts +43 -0
- package/dist/marks/LineEndLabels.svelte +70 -0
- package/dist/marks/LineEndLabels.svelte.d.ts +41 -0
- package/dist/marks/Points.svelte +70 -0
- package/dist/marks/Points.svelte.d.ts +46 -0
- package/dist/marks/Rects.svelte +92 -0
- package/dist/marks/Rects.svelte.d.ts +47 -0
- package/dist/marks/Rules.svelte +46 -0
- package/dist/marks/Rules.svelte.d.ts +15 -0
- package/dist/marks/Slope.svelte +112 -0
- package/dist/marks/Slope.svelte.d.ts +41 -0
- package/dist/marks/Text.svelte +75 -0
- package/dist/marks/Text.svelte.d.ts +47 -0
- package/dist/marks/Treemap.svelte +89 -0
- package/dist/marks/Treemap.svelte.d.ts +45 -0
- package/dist/marks/Voronoi.svelte +61 -0
- package/dist/marks/Voronoi.svelte.d.ts +39 -0
- package/dist/marks/Waffle.svelte +77 -0
- package/dist/marks/Waffle.svelte.d.ts +45 -0
- package/dist/marks/bar-path.d.ts +5 -0
- package/dist/marks/bar-path.js +15 -0
- package/dist/marks/index.d.ts +20 -0
- package/dist/marks/index.js +20 -0
- package/dist/recipes/ArrowChart.svelte +247 -0
- package/dist/recipes/ArrowChart.svelte.d.ts +73 -0
- package/dist/recipes/BarChart.svelte +122 -0
- package/dist/recipes/BarChart.svelte.d.ts +58 -0
- package/dist/recipes/BarDotChart.svelte +204 -0
- package/dist/recipes/BarDotChart.svelte.d.ts +75 -0
- package/dist/recipes/ColumnChart.svelte +119 -0
- package/dist/recipes/ColumnChart.svelte.d.ts +56 -0
- package/dist/recipes/LineChart.svelte +159 -0
- package/dist/recipes/LineChart.svelte.d.ts +61 -0
- package/dist/recipes/MosaicChart.svelte +256 -0
- package/dist/recipes/MosaicChart.svelte.d.ts +83 -0
- package/dist/recipes/ScatterChart.svelte +167 -0
- package/dist/recipes/ScatterChart.svelte.d.ts +63 -0
- package/dist/recipes/StackedBarChart.svelte +222 -0
- package/dist/recipes/StackedBarChart.svelte.d.ts +83 -0
- package/dist/recipes/index.d.ts +10 -0
- package/dist/recipes/index.js +19 -0
- package/dist/styles/base.d.ts +5 -0
- package/dist/styles/base.js +102 -0
- package/dist/styles/check.d.ts +8 -0
- package/dist/styles/check.js +32 -0
- package/dist/styles/color.d.ts +11 -0
- package/dist/styles/color.js +29 -0
- package/dist/styles/index.d.ts +9 -0
- package/dist/styles/index.js +17 -0
- package/dist/styles/types.d.ts +90 -0
- package/dist/styles/types.js +1 -0
- package/dist/table/Sparkline.svelte +59 -0
- package/dist/table/Sparkline.svelte.d.ts +16 -0
- package/dist/table/Table.svelte +287 -0
- package/dist/table/Table.svelte.d.ts +44 -0
- package/dist/table/csv.d.ts +3 -0
- package/dist/table/csv.js +12 -0
- package/dist/table/index.d.ts +4 -0
- package/dist/table/index.js +3 -0
- package/dist/table/types.d.ts +26 -0
- package/dist/table/types.js +1 -0
- package/dist/transforms/bin.d.ts +15 -0
- package/dist/transforms/bin.js +18 -0
- package/dist/transforms/dodge.d.ts +10 -0
- package/dist/transforms/dodge.js +35 -0
- package/dist/transforms/group.d.ts +14 -0
- package/dist/transforms/group.js +14 -0
- package/dist/transforms/hemicycle.d.ts +30 -0
- package/dist/transforms/hemicycle.js +51 -0
- package/dist/transforms/index.d.ts +8 -0
- package/dist/transforms/index.js +8 -0
- package/dist/transforms/labels.d.ts +6 -0
- package/dist/transforms/labels.js +20 -0
- package/dist/transforms/smooth.d.ts +61 -0
- package/dist/transforms/smooth.js +105 -0
- package/dist/transforms/stack.d.ts +25 -0
- package/dist/transforms/stack.js +61 -0
- package/dist/transforms/treemap.d.ts +21 -0
- package/dist/transforms/treemap.js +31 -0
- package/package.json +152 -3
- package/src/lib/recipes/ArrowChart.svelte +247 -0
- package/src/lib/recipes/BarChart.svelte +122 -0
- package/src/lib/recipes/BarDotChart.svelte +204 -0
- package/src/lib/recipes/ColumnChart.svelte +119 -0
- package/src/lib/recipes/LineChart.svelte +159 -0
- package/src/lib/recipes/MosaicChart.svelte +256 -0
- package/src/lib/recipes/ScatterChart.svelte +167 -0
- package/src/lib/recipes/StackedBarChart.svelte +222 -0
- package/src/lib/recipes/index.ts +20 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
Recipe: a sorted horizontal bar chart with value labels, hover tooltip and
|
|
4
|
+
the full frame. Use it as is, or run `mozaic eject BarChart` to copy this
|
|
5
|
+
file into your project and change anything.
|
|
6
|
+
-->
|
|
7
|
+
<script lang="ts" generics="T">
|
|
8
|
+
import type { Snippet } from 'svelte';
|
|
9
|
+
import { scaleBand, scaleLinear } from 'd3-scale';
|
|
10
|
+
import { max, min } from 'd3-array';
|
|
11
|
+
import { Chart, Header, Title, Subtitle, Footer, Source, Notes } from '../frame/index.js';
|
|
12
|
+
import type { ChartEmbed } from '../embed/index.js';
|
|
13
|
+
import { Plot, Svg, Html, estimateTextWidth, scaled, type PlotContext } from '../core/index.js';
|
|
14
|
+
import { Bars, Rules, Text } from '../marks/index.js';
|
|
15
|
+
import { AxisY } from '../guides/index.js';
|
|
16
|
+
import { Tooltip } from '../interactive/index.js';
|
|
17
|
+
import { createLocale, type LocaleCode } from '../locale/index.js';
|
|
18
|
+
import { base, type Medium, type Theme } from '../styles/index.js';
|
|
19
|
+
|
|
20
|
+
interface Props {
|
|
21
|
+
data: T[];
|
|
22
|
+
label: (d: T) => string;
|
|
23
|
+
value: (d: T) => number;
|
|
24
|
+
style?: Theme;
|
|
25
|
+
locale?: LocaleCode;
|
|
26
|
+
medium?: Medium;
|
|
27
|
+
width?: number;
|
|
28
|
+
title?: string;
|
|
29
|
+
subtitle?: string;
|
|
30
|
+
notes?: string;
|
|
31
|
+
source?: string;
|
|
32
|
+
alt?: string;
|
|
33
|
+
/** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
|
|
34
|
+
embed?: ChartEmbed;
|
|
35
|
+
/** Value label format; defaults to locale numbers. */
|
|
36
|
+
format?: (n: number) => string;
|
|
37
|
+
/** Bar colour; defaults to the first categorical colour. */
|
|
38
|
+
color?: (d: T) => string;
|
|
39
|
+
/** Sort largest first (default) or keep data order. */
|
|
40
|
+
sort?: boolean;
|
|
41
|
+
rowHeight?: number;
|
|
42
|
+
/** Extra SVG drawn on top of the bars (annotations); receives the plot context. */
|
|
43
|
+
annotations?: Snippet<[PlotContext]>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let {
|
|
47
|
+
data,
|
|
48
|
+
label,
|
|
49
|
+
value,
|
|
50
|
+
style = base,
|
|
51
|
+
locale,
|
|
52
|
+
medium,
|
|
53
|
+
width,
|
|
54
|
+
title,
|
|
55
|
+
subtitle,
|
|
56
|
+
notes,
|
|
57
|
+
source,
|
|
58
|
+
alt,
|
|
59
|
+
embed,
|
|
60
|
+
format,
|
|
61
|
+
color,
|
|
62
|
+
sort = true,
|
|
63
|
+
rowHeight = 28,
|
|
64
|
+
annotations
|
|
65
|
+
}: Props = $props();
|
|
66
|
+
|
|
67
|
+
const theme = $derived(style);
|
|
68
|
+
const fmt = $derived(format ?? createLocale(locale ?? theme.defaultLocale).number);
|
|
69
|
+
const rows = $derived(sort ? data.toSorted((a, b) => value(b) - value(a)) : data);
|
|
70
|
+
const x = $derived(
|
|
71
|
+
scaleLinear()
|
|
72
|
+
.domain([Math.min(0, min(rows, value) ?? 0), Math.max(0, max(rows, value) ?? 1)])
|
|
73
|
+
.nice()
|
|
74
|
+
);
|
|
75
|
+
const y = $derived(scaleBand<string>().domain(rows.map(label)).paddingInner(0.25).paddingOuter(0.1));
|
|
76
|
+
const left = $derived(Math.max(...rows.map((d) => estimateTextWidth(label(d), theme.plot.fontSize)), 0) + 12);
|
|
77
|
+
const right = $derived(Math.max(...rows.map((d) => estimateTextWidth(fmt(value(d)), theme.plot.fontSize)), 0) + 12);
|
|
78
|
+
let hovered = $state<T | null>(null);
|
|
79
|
+
</script>
|
|
80
|
+
|
|
81
|
+
<Chart {style} {locale} {medium} {width} {alt} {embed}>
|
|
82
|
+
{#if title || subtitle}
|
|
83
|
+
<Header>
|
|
84
|
+
{#if title}<Title>{title}</Title>{/if}
|
|
85
|
+
{#if subtitle}<Subtitle>{subtitle}</Subtitle>{/if}
|
|
86
|
+
</Header>
|
|
87
|
+
{/if}
|
|
88
|
+
|
|
89
|
+
<Plot {x} {y} height={rows.length * rowHeight} padding={{ left, right, top: 0, bottom: 0 }}>
|
|
90
|
+
{#snippet children(plot)}
|
|
91
|
+
<Svg>
|
|
92
|
+
<AxisY />
|
|
93
|
+
<Bars
|
|
94
|
+
data={rows}
|
|
95
|
+
x={value}
|
|
96
|
+
y={label}
|
|
97
|
+
fill={color}
|
|
98
|
+
opacity={(d) => (hovered && hovered !== d ? 0.5 : 1)}
|
|
99
|
+
onpointerenter={(d) => (hovered = d)}
|
|
100
|
+
onpointerleave={() => (hovered = null)}
|
|
101
|
+
/>
|
|
102
|
+
<Rules x={[0]} />
|
|
103
|
+
<Text data={rows} x={value} y={label} text={(d) => fmt(value(d))} dx={4} />
|
|
104
|
+
{@render annotations?.(plot)}
|
|
105
|
+
</Svg>
|
|
106
|
+
<Html>
|
|
107
|
+
{#if hovered}
|
|
108
|
+
<Tooltip x={plot.x(value(hovered)) ?? 0} y={scaled(plot.y, label(hovered))}>
|
|
109
|
+
<strong>{label(hovered)}</strong><br />{fmt(value(hovered))}
|
|
110
|
+
</Tooltip>
|
|
111
|
+
{/if}
|
|
112
|
+
</Html>
|
|
113
|
+
{/snippet}
|
|
114
|
+
</Plot>
|
|
115
|
+
|
|
116
|
+
{#if notes || source}
|
|
117
|
+
<Footer>
|
|
118
|
+
{#if notes}<Notes>{notes}</Notes>{/if}
|
|
119
|
+
{#if source}<Source>{source}</Source>{/if}
|
|
120
|
+
</Footer>
|
|
121
|
+
{/if}
|
|
122
|
+
</Chart>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { ChartEmbed } from '../embed/index.js';
|
|
3
|
+
import { type PlotContext } from '../core/index.js';
|
|
4
|
+
import { type LocaleCode } from '../locale/index.js';
|
|
5
|
+
import { type Medium, type Theme } from '../styles/index.js';
|
|
6
|
+
declare function $$render<T>(): {
|
|
7
|
+
props: {
|
|
8
|
+
data: T[];
|
|
9
|
+
label: (d: T) => string;
|
|
10
|
+
value: (d: T) => number;
|
|
11
|
+
style?: Theme;
|
|
12
|
+
locale?: LocaleCode;
|
|
13
|
+
medium?: Medium;
|
|
14
|
+
width?: number;
|
|
15
|
+
title?: string;
|
|
16
|
+
subtitle?: string;
|
|
17
|
+
notes?: string;
|
|
18
|
+
source?: string;
|
|
19
|
+
alt?: string;
|
|
20
|
+
/** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
|
|
21
|
+
embed?: ChartEmbed;
|
|
22
|
+
/** Value label format; defaults to locale numbers. */
|
|
23
|
+
format?: (n: number) => string;
|
|
24
|
+
/** Bar colour; defaults to the first categorical colour. */
|
|
25
|
+
color?: (d: T) => string;
|
|
26
|
+
/** Sort largest first (default) or keep data order. */
|
|
27
|
+
sort?: boolean;
|
|
28
|
+
rowHeight?: number;
|
|
29
|
+
/** Extra SVG drawn on top of the bars (annotations); receives the plot context. */
|
|
30
|
+
annotations?: Snippet<[PlotContext]>;
|
|
31
|
+
};
|
|
32
|
+
exports: {};
|
|
33
|
+
bindings: "";
|
|
34
|
+
slots: {};
|
|
35
|
+
events: {};
|
|
36
|
+
};
|
|
37
|
+
declare class __sveltets_Render<T> {
|
|
38
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
39
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
40
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
41
|
+
bindings(): "";
|
|
42
|
+
exports(): {};
|
|
43
|
+
}
|
|
44
|
+
interface $$IsomorphicComponent {
|
|
45
|
+
new <T>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
46
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
47
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
48
|
+
<T>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
49
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Recipe: a sorted horizontal bar chart with value labels, hover tooltip and
|
|
53
|
+
* the full frame. Use it as is, or run `mozaic eject BarChart` to copy this
|
|
54
|
+
* file into your project and change anything.
|
|
55
|
+
*/
|
|
56
|
+
declare const BarChart: $$IsomorphicComponent;
|
|
57
|
+
type BarChart<T> = InstanceType<typeof BarChart<T>>;
|
|
58
|
+
export default BarChart;
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
Recipe: horizontal bars for the latest value of each category, a dot for an
|
|
4
|
+
earlier value, and the latest value with its change written at the right
|
|
5
|
+
("29.2% −3.2"). Good for two survey waves where the latest one matters most.
|
|
6
|
+
Rows missing a value show only the bar or the dot. Use it as is, or run
|
|
7
|
+
`mozaic eject BarDotChart` to copy this file into your project and change
|
|
8
|
+
anything.
|
|
9
|
+
-->
|
|
10
|
+
<script lang="ts" generics="T">
|
|
11
|
+
import type { Snippet } from 'svelte';
|
|
12
|
+
import { scaleBand, scaleLinear } from 'd3-scale';
|
|
13
|
+
import { max, min } from 'd3-array';
|
|
14
|
+
import { Chart, Header, Title, Subtitle, Footer, Source, Notes } from '../frame/index.js';
|
|
15
|
+
import type { ChartEmbed } from '../embed/index.js';
|
|
16
|
+
import { Plot, Svg, estimateTextWidth, scaled, type PlotContext } from '../core/index.js';
|
|
17
|
+
import { Bars, Points } from '../marks/index.js';
|
|
18
|
+
import { AxisX, AxisY, GridX, Legend } from '../guides/index.js';
|
|
19
|
+
import { createLocale, type LocaleCode } from '../locale/index.js';
|
|
20
|
+
import { base, type Medium, type Theme } from '../styles/index.js';
|
|
21
|
+
|
|
22
|
+
type Maybe = number | null | undefined;
|
|
23
|
+
|
|
24
|
+
interface Props {
|
|
25
|
+
data: T[];
|
|
26
|
+
label: (d: T) => string;
|
|
27
|
+
/** Latest value, drawn as a bar. */
|
|
28
|
+
value: (d: T) => Maybe;
|
|
29
|
+
/** Earlier value, drawn as a dot. */
|
|
30
|
+
previous: (d: T) => Maybe;
|
|
31
|
+
/** Legend names for the bars and the dots (e.g. the two fieldwork dates). */
|
|
32
|
+
valueLabel?: string;
|
|
33
|
+
previousLabel?: string;
|
|
34
|
+
style?: Theme;
|
|
35
|
+
locale?: LocaleCode;
|
|
36
|
+
medium?: Medium;
|
|
37
|
+
width?: number;
|
|
38
|
+
title?: string;
|
|
39
|
+
subtitle?: string;
|
|
40
|
+
notes?: string;
|
|
41
|
+
source?: string;
|
|
42
|
+
alt?: string;
|
|
43
|
+
/** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
|
|
44
|
+
embed?: ChartEmbed;
|
|
45
|
+
/** Value label format; defaults to locale numbers. */
|
|
46
|
+
format?: (n: number) => string;
|
|
47
|
+
/** Change label format; defaults to one decimal with a sign. */
|
|
48
|
+
formatChange?: (n: number) => string;
|
|
49
|
+
/** Axis tick format; defaults to `format`. */
|
|
50
|
+
tickFormat?: (n: number) => string;
|
|
51
|
+
/** Bar colour; defaults to a mid step of the sequential palette. Use the context grey for "don't know" rows. */
|
|
52
|
+
color?: (d: T) => string;
|
|
53
|
+
/** Dot colour; defaults to the darkest sequential step. */
|
|
54
|
+
dotColor?: string;
|
|
55
|
+
/** Sort by the latest value, largest first, or keep data order (default). */
|
|
56
|
+
sort?: boolean;
|
|
57
|
+
/** x domain; defaults to zero and the largest value, rounded. */
|
|
58
|
+
domain?: [number, number];
|
|
59
|
+
rowHeight?: number;
|
|
60
|
+
/** Extra SVG drawn on top (annotations); receives the plot context. */
|
|
61
|
+
annotations?: Snippet<[PlotContext]>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
let {
|
|
65
|
+
data,
|
|
66
|
+
label,
|
|
67
|
+
value,
|
|
68
|
+
previous,
|
|
69
|
+
valueLabel,
|
|
70
|
+
previousLabel,
|
|
71
|
+
style = base,
|
|
72
|
+
locale,
|
|
73
|
+
medium,
|
|
74
|
+
width,
|
|
75
|
+
title,
|
|
76
|
+
subtitle,
|
|
77
|
+
notes,
|
|
78
|
+
source,
|
|
79
|
+
alt,
|
|
80
|
+
embed,
|
|
81
|
+
format,
|
|
82
|
+
formatChange,
|
|
83
|
+
tickFormat,
|
|
84
|
+
color,
|
|
85
|
+
dotColor,
|
|
86
|
+
sort = false,
|
|
87
|
+
domain,
|
|
88
|
+
rowHeight = 32,
|
|
89
|
+
annotations
|
|
90
|
+
}: Props = $props();
|
|
91
|
+
|
|
92
|
+
const theme = $derived(style);
|
|
93
|
+
const numbers = $derived(createLocale(locale ?? theme.defaultLocale));
|
|
94
|
+
const fmt = $derived(format ?? numbers.number);
|
|
95
|
+
const signed = $derived(
|
|
96
|
+
formatChange ?? ((n: number) => (Math.abs(n) < 0.05 ? numbers.format('.1f')(0) : numbers.format('+.1f')(n)))
|
|
97
|
+
);
|
|
98
|
+
const fontSize = $derived(theme.plot.fontSize);
|
|
99
|
+
const has = (v: Maybe): v is number => v !== null && v !== undefined && Number.isFinite(v);
|
|
100
|
+
const sequential = $derived(theme.palettes.sequential);
|
|
101
|
+
const barColor = $derived((d: T) => color?.(d) ?? sequential[Math.floor(sequential.length / 2)]);
|
|
102
|
+
const dot = $derived(dotColor ?? sequential[sequential.length - 1]);
|
|
103
|
+
|
|
104
|
+
const rows = $derived(sort ? data.toSorted((a, b) => (value(b) ?? -Infinity) - (value(a) ?? -Infinity)) : data);
|
|
105
|
+
const all = $derived(rows.flatMap((d) => [value(d), previous(d)]).filter(has));
|
|
106
|
+
const x = $derived(
|
|
107
|
+
scaleLinear()
|
|
108
|
+
.domain(domain ?? [Math.min(0, min(all) ?? 0), Math.max(0, max(all) ?? 1)])
|
|
109
|
+
.nice()
|
|
110
|
+
);
|
|
111
|
+
const y = $derived(scaleBand<string>().domain(rows.map(label)).padding(0.3));
|
|
112
|
+
const text = (d: T) => {
|
|
113
|
+
const v = value(d);
|
|
114
|
+
const p = previous(d);
|
|
115
|
+
return { value: has(v) ? fmt(v) : '–', change: has(v) && has(p) ? signed(v - p) : '' };
|
|
116
|
+
};
|
|
117
|
+
const left = $derived(Math.max(...rows.map((d) => estimateTextWidth(label(d), fontSize)), 0) + 12);
|
|
118
|
+
const right = $derived(
|
|
119
|
+
Math.max(
|
|
120
|
+
...rows.map((d) => {
|
|
121
|
+
const t = text(d);
|
|
122
|
+
return estimateTextWidth(`${t.value} ${t.change}`, fontSize);
|
|
123
|
+
}),
|
|
124
|
+
0
|
|
125
|
+
) + 12
|
|
126
|
+
);
|
|
127
|
+
</script>
|
|
128
|
+
|
|
129
|
+
<Chart {style} {locale} {medium} {width} {alt} {embed}>
|
|
130
|
+
<Header>
|
|
131
|
+
{#if title}<Title>{title}</Title>{/if}
|
|
132
|
+
{#if subtitle}<Subtitle>{subtitle}</Subtitle>{/if}
|
|
133
|
+
{#if valueLabel || previousLabel}
|
|
134
|
+
<div class="mz-bar-dot-legend">
|
|
135
|
+
{#if valueLabel}<Legend
|
|
136
|
+
items={[{ label: valueLabel, color: sequential[Math.floor(sequential.length / 2)] }]}
|
|
137
|
+
/>{/if}
|
|
138
|
+
{#if previousLabel}<Legend shape="circle" items={[{ label: previousLabel, color: dot }]} />{/if}
|
|
139
|
+
</div>
|
|
140
|
+
{/if}
|
|
141
|
+
</Header>
|
|
142
|
+
|
|
143
|
+
<Plot {x} {y} height={rows.length * rowHeight} padding={{ left, right, top: 4, bottom: 24 }}>
|
|
144
|
+
{#snippet children(plot)}
|
|
145
|
+
<Svg>
|
|
146
|
+
<GridX ticks={4} />
|
|
147
|
+
<AxisX ticks={4} format={tickFormat ?? fmt} />
|
|
148
|
+
<AxisY />
|
|
149
|
+
<Bars
|
|
150
|
+
data={rows.filter((d) => has(value(d)))}
|
|
151
|
+
y={label}
|
|
152
|
+
x={(d) => value(d)!}
|
|
153
|
+
fill={barColor}
|
|
154
|
+
title={(d) => `${label(d)}: ${fmt(value(d)!)}`}
|
|
155
|
+
/>
|
|
156
|
+
<Points
|
|
157
|
+
data={rows.filter((d) => has(previous(d)))}
|
|
158
|
+
y={label}
|
|
159
|
+
x={(d) => previous(d)!}
|
|
160
|
+
r={4}
|
|
161
|
+
fill={dot}
|
|
162
|
+
stroke={theme.tokens['--mz-color-bg']}
|
|
163
|
+
strokeWidth={1.5}
|
|
164
|
+
title={(d) => `${label(d)}${previousLabel ? `, ${previousLabel}` : ''}: ${fmt(previous(d)!)}`}
|
|
165
|
+
/>
|
|
166
|
+
{#each rows as d (label(d))}
|
|
167
|
+
{@const t = text(d)}
|
|
168
|
+
<text class="mz-bar-dot-value" x={plot.width + 8} y={scaled(plot.y, label(d))} dy="0.35em">
|
|
169
|
+
<tspan class="strong">{t.value}</tspan>
|
|
170
|
+
{#if t.change}<tspan class="change" dx="6">{t.change}</tspan>{/if}
|
|
171
|
+
</text>
|
|
172
|
+
{/each}
|
|
173
|
+
{@render annotations?.(plot)}
|
|
174
|
+
</Svg>
|
|
175
|
+
{/snippet}
|
|
176
|
+
</Plot>
|
|
177
|
+
|
|
178
|
+
{#if notes || source}
|
|
179
|
+
<Footer>
|
|
180
|
+
{#if notes}<Notes>{notes}</Notes>{/if}
|
|
181
|
+
{#if source}<Source>{source}</Source>{/if}
|
|
182
|
+
</Footer>
|
|
183
|
+
{/if}
|
|
184
|
+
</Chart>
|
|
185
|
+
|
|
186
|
+
<style>
|
|
187
|
+
.mz-bar-dot-legend {
|
|
188
|
+
display: flex;
|
|
189
|
+
flex-wrap: wrap;
|
|
190
|
+
gap: 0 1rem;
|
|
191
|
+
}
|
|
192
|
+
.mz-bar-dot-value {
|
|
193
|
+
font-family: var(--mz-font-body);
|
|
194
|
+
font-size: var(--mz-size-axis);
|
|
195
|
+
fill: var(--mz-color-text);
|
|
196
|
+
font-variant-numeric: tabular-nums;
|
|
197
|
+
}
|
|
198
|
+
.strong {
|
|
199
|
+
font-weight: var(--mz-weight-strong);
|
|
200
|
+
}
|
|
201
|
+
.change {
|
|
202
|
+
fill: var(--mz-color-muted);
|
|
203
|
+
}
|
|
204
|
+
</style>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { ChartEmbed } from '../embed/index.js';
|
|
3
|
+
import { type PlotContext } from '../core/index.js';
|
|
4
|
+
import { type LocaleCode } from '../locale/index.js';
|
|
5
|
+
import { type Medium, type Theme } from '../styles/index.js';
|
|
6
|
+
declare function $$render<T>(): {
|
|
7
|
+
props: {
|
|
8
|
+
data: T[];
|
|
9
|
+
label: (d: T) => string;
|
|
10
|
+
/** Latest value, drawn as a bar. */
|
|
11
|
+
value: (d: T) => number | null | undefined;
|
|
12
|
+
/** Earlier value, drawn as a dot. */
|
|
13
|
+
previous: (d: T) => number | null | undefined;
|
|
14
|
+
/** Legend names for the bars and the dots (e.g. the two fieldwork dates). */
|
|
15
|
+
valueLabel?: string;
|
|
16
|
+
previousLabel?: string;
|
|
17
|
+
style?: Theme;
|
|
18
|
+
locale?: LocaleCode;
|
|
19
|
+
medium?: Medium;
|
|
20
|
+
width?: number;
|
|
21
|
+
title?: string;
|
|
22
|
+
subtitle?: string;
|
|
23
|
+
notes?: string;
|
|
24
|
+
source?: string;
|
|
25
|
+
alt?: string;
|
|
26
|
+
/** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
|
|
27
|
+
embed?: ChartEmbed;
|
|
28
|
+
/** Value label format; defaults to locale numbers. */
|
|
29
|
+
format?: (n: number) => string;
|
|
30
|
+
/** Change label format; defaults to one decimal with a sign. */
|
|
31
|
+
formatChange?: (n: number) => string;
|
|
32
|
+
/** Axis tick format; defaults to `format`. */
|
|
33
|
+
tickFormat?: (n: number) => string;
|
|
34
|
+
/** Bar colour; defaults to a mid step of the sequential palette. Use the context grey for "don't know" rows. */
|
|
35
|
+
color?: (d: T) => string;
|
|
36
|
+
/** Dot colour; defaults to the darkest sequential step. */
|
|
37
|
+
dotColor?: string;
|
|
38
|
+
/** Sort by the latest value, largest first, or keep data order (default). */
|
|
39
|
+
sort?: boolean;
|
|
40
|
+
/** x domain; defaults to zero and the largest value, rounded. */
|
|
41
|
+
domain?: [number, number];
|
|
42
|
+
rowHeight?: number;
|
|
43
|
+
/** Extra SVG drawn on top (annotations); receives the plot context. */
|
|
44
|
+
annotations?: Snippet<[PlotContext]>;
|
|
45
|
+
};
|
|
46
|
+
exports: {};
|
|
47
|
+
bindings: "";
|
|
48
|
+
slots: {};
|
|
49
|
+
events: {};
|
|
50
|
+
};
|
|
51
|
+
declare class __sveltets_Render<T> {
|
|
52
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
53
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
54
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
55
|
+
bindings(): "";
|
|
56
|
+
exports(): {};
|
|
57
|
+
}
|
|
58
|
+
interface $$IsomorphicComponent {
|
|
59
|
+
new <T>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
60
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
61
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
62
|
+
<T>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
63
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Recipe: horizontal bars for the latest value of each category, a dot for an
|
|
67
|
+
* earlier value, and the latest value with its change written at the right
|
|
68
|
+
* ("29.2% −3.2"). Good for two survey waves where the latest one matters most.
|
|
69
|
+
* Rows missing a value show only the bar or the dot. Use it as is, or run
|
|
70
|
+
* `mozaic eject BarDotChart` to copy this file into your project and change
|
|
71
|
+
* anything.
|
|
72
|
+
*/
|
|
73
|
+
declare const BarDotChart: $$IsomorphicComponent;
|
|
74
|
+
type BarDotChart<T> = InstanceType<typeof BarDotChart<T>>;
|
|
75
|
+
export default BarDotChart;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
Recipe: a vertical column chart (one series), e.g. a value per year, with
|
|
4
|
+
gridlines, hover tooltip and the full frame. `mozaic eject ColumnChart`
|
|
5
|
+
copies this file into your project.
|
|
6
|
+
-->
|
|
7
|
+
<script lang="ts" generics="T">
|
|
8
|
+
import type { Snippet } from 'svelte';
|
|
9
|
+
import { scaleBand, scaleLinear } from 'd3-scale';
|
|
10
|
+
import { max, min } from 'd3-array';
|
|
11
|
+
import { Chart, Header, Title, Subtitle, Footer, Source, Notes } from '../frame/index.js';
|
|
12
|
+
import type { ChartEmbed } from '../embed/index.js';
|
|
13
|
+
import { Plot, Svg, Html, scaled, type PlotContext } from '../core/index.js';
|
|
14
|
+
import { Bars, Rules } from '../marks/index.js';
|
|
15
|
+
import { AxisX, AxisY, GridY } from '../guides/index.js';
|
|
16
|
+
import { Tooltip } from '../interactive/index.js';
|
|
17
|
+
import { createLocale, type LocaleCode } from '../locale/index.js';
|
|
18
|
+
import { base, type Medium, type Theme } from '../styles/index.js';
|
|
19
|
+
|
|
20
|
+
interface Props {
|
|
21
|
+
data: T[];
|
|
22
|
+
/** Category on the x axis (e.g. the year). */
|
|
23
|
+
label: (d: T) => string;
|
|
24
|
+
value: (d: T) => number;
|
|
25
|
+
style?: Theme;
|
|
26
|
+
locale?: LocaleCode;
|
|
27
|
+
medium?: Medium;
|
|
28
|
+
width?: number;
|
|
29
|
+
title?: string;
|
|
30
|
+
subtitle?: string;
|
|
31
|
+
notes?: string;
|
|
32
|
+
source?: string;
|
|
33
|
+
alt?: string;
|
|
34
|
+
/** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
|
|
35
|
+
embed?: ChartEmbed;
|
|
36
|
+
format?: (n: number) => string;
|
|
37
|
+
color?: (d: T) => string;
|
|
38
|
+
height?: number;
|
|
39
|
+
/** Show every nth x label (useful for long series). */
|
|
40
|
+
labelEvery?: number;
|
|
41
|
+
annotations?: Snippet<[PlotContext]>;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
let {
|
|
45
|
+
data,
|
|
46
|
+
label,
|
|
47
|
+
value,
|
|
48
|
+
style = base,
|
|
49
|
+
locale,
|
|
50
|
+
medium,
|
|
51
|
+
width,
|
|
52
|
+
title,
|
|
53
|
+
subtitle,
|
|
54
|
+
notes,
|
|
55
|
+
source,
|
|
56
|
+
alt,
|
|
57
|
+
embed,
|
|
58
|
+
format,
|
|
59
|
+
color,
|
|
60
|
+
height = 280,
|
|
61
|
+
labelEvery,
|
|
62
|
+
annotations
|
|
63
|
+
}: Props = $props();
|
|
64
|
+
|
|
65
|
+
const theme = $derived(style);
|
|
66
|
+
const fmt = $derived(format ?? createLocale(locale ?? theme.defaultLocale).number);
|
|
67
|
+
const x = $derived(scaleBand<string>().domain(data.map(label)).paddingInner(0.2).paddingOuter(0.1));
|
|
68
|
+
const y = $derived(
|
|
69
|
+
scaleLinear()
|
|
70
|
+
.domain([Math.min(0, min(data, value) ?? 0), Math.max(0, max(data, value) ?? 1)])
|
|
71
|
+
.nice()
|
|
72
|
+
);
|
|
73
|
+
let hovered = $state<T | null>(null);
|
|
74
|
+
</script>
|
|
75
|
+
|
|
76
|
+
<Chart {style} {locale} {medium} {width} {alt} {embed}>
|
|
77
|
+
{#if title || subtitle}
|
|
78
|
+
<Header>
|
|
79
|
+
{#if title}<Title>{title}</Title>{/if}
|
|
80
|
+
{#if subtitle}<Subtitle>{subtitle}</Subtitle>{/if}
|
|
81
|
+
</Header>
|
|
82
|
+
{/if}
|
|
83
|
+
|
|
84
|
+
<Plot {x} {y} {height} padding={{ left: 40, right: 8, top: 8, bottom: 28 }}>
|
|
85
|
+
{#snippet children(plot)}
|
|
86
|
+
{@const every = labelEvery ?? Math.max(1, Math.ceil((data.length * 36) / Math.max(1, plot.width)))}
|
|
87
|
+
<Svg>
|
|
88
|
+
<GridY ticks={5} />
|
|
89
|
+
<AxisY ticks={5} format={fmt} />
|
|
90
|
+
<AxisX tickValues={data.map(label).filter((_, i) => i % every === 0)} />
|
|
91
|
+
<Bars
|
|
92
|
+
{data}
|
|
93
|
+
x={label}
|
|
94
|
+
y={value}
|
|
95
|
+
fill={color}
|
|
96
|
+
opacity={(d) => (hovered && hovered !== d ? 0.5 : 1)}
|
|
97
|
+
onpointerenter={(d) => (hovered = d)}
|
|
98
|
+
onpointerleave={() => (hovered = null)}
|
|
99
|
+
/>
|
|
100
|
+
<Rules y={[0]} />
|
|
101
|
+
{@render annotations?.(plot)}
|
|
102
|
+
</Svg>
|
|
103
|
+
<Html>
|
|
104
|
+
{#if hovered}
|
|
105
|
+
<Tooltip x={scaled(plot.x, label(hovered))} y={plot.y(value(hovered)) ?? 0}>
|
|
106
|
+
<strong>{label(hovered)}</strong><br />{fmt(value(hovered))}
|
|
107
|
+
</Tooltip>
|
|
108
|
+
{/if}
|
|
109
|
+
</Html>
|
|
110
|
+
{/snippet}
|
|
111
|
+
</Plot>
|
|
112
|
+
|
|
113
|
+
{#if notes || source}
|
|
114
|
+
<Footer>
|
|
115
|
+
{#if notes}<Notes>{notes}</Notes>{/if}
|
|
116
|
+
{#if source}<Source>{source}</Source>{/if}
|
|
117
|
+
</Footer>
|
|
118
|
+
{/if}
|
|
119
|
+
</Chart>
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { ChartEmbed } from '../embed/index.js';
|
|
3
|
+
import { type PlotContext } from '../core/index.js';
|
|
4
|
+
import { type LocaleCode } from '../locale/index.js';
|
|
5
|
+
import { type Medium, type Theme } from '../styles/index.js';
|
|
6
|
+
declare function $$render<T>(): {
|
|
7
|
+
props: {
|
|
8
|
+
data: T[];
|
|
9
|
+
/** Category on the x axis (e.g. the year). */
|
|
10
|
+
label: (d: T) => string;
|
|
11
|
+
value: (d: T) => number;
|
|
12
|
+
style?: Theme;
|
|
13
|
+
locale?: LocaleCode;
|
|
14
|
+
medium?: Medium;
|
|
15
|
+
width?: number;
|
|
16
|
+
title?: string;
|
|
17
|
+
subtitle?: string;
|
|
18
|
+
notes?: string;
|
|
19
|
+
source?: string;
|
|
20
|
+
alt?: string;
|
|
21
|
+
/** The chart's embed page, for the embed code under the chart (see `<Chart embed>`). */
|
|
22
|
+
embed?: ChartEmbed;
|
|
23
|
+
format?: (n: number) => string;
|
|
24
|
+
color?: (d: T) => string;
|
|
25
|
+
height?: number;
|
|
26
|
+
/** Show every nth x label (useful for long series). */
|
|
27
|
+
labelEvery?: number;
|
|
28
|
+
annotations?: Snippet<[PlotContext]>;
|
|
29
|
+
};
|
|
30
|
+
exports: {};
|
|
31
|
+
bindings: "";
|
|
32
|
+
slots: {};
|
|
33
|
+
events: {};
|
|
34
|
+
};
|
|
35
|
+
declare class __sveltets_Render<T> {
|
|
36
|
+
props(): ReturnType<typeof $$render<T>>['props'];
|
|
37
|
+
events(): ReturnType<typeof $$render<T>>['events'];
|
|
38
|
+
slots(): ReturnType<typeof $$render<T>>['slots'];
|
|
39
|
+
bindings(): "";
|
|
40
|
+
exports(): {};
|
|
41
|
+
}
|
|
42
|
+
interface $$IsomorphicComponent {
|
|
43
|
+
new <T>(options: import('svelte').ComponentConstructorOptions<ReturnType<__sveltets_Render<T>['props']>>): import('svelte').SvelteComponent<ReturnType<__sveltets_Render<T>['props']>, ReturnType<__sveltets_Render<T>['events']>, ReturnType<__sveltets_Render<T>['slots']>> & {
|
|
44
|
+
$$bindings?: ReturnType<__sveltets_Render<T>['bindings']>;
|
|
45
|
+
} & ReturnType<__sveltets_Render<T>['exports']>;
|
|
46
|
+
<T>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
47
|
+
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Recipe: a vertical column chart (one series), e.g. a value per year, with
|
|
51
|
+
* gridlines, hover tooltip and the full frame. `mozaic eject ColumnChart`
|
|
52
|
+
* copies this file into your project.
|
|
53
|
+
*/
|
|
54
|
+
declare const ColumnChart: $$IsomorphicComponent;
|
|
55
|
+
type ColumnChart<T> = InstanceType<typeof ColumnChart<T>>;
|
|
56
|
+
export default ColumnChart;
|