@cfasim-ui/charts 0.4.11 → 0.4.13
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/BarChart/BarChart.d.ts +15 -2
- package/dist/ChoroplethMap/ChoroplethMap.d.ts +9 -0
- package/dist/LineChart/LineChart.d.ts +38 -10
- package/dist/_shared/annotations.d.ts +14 -9
- package/dist/_shared/chartProps.d.ts +37 -0
- package/dist/_shared/dateAxis.d.ts +65 -0
- package/dist/_shared/dateAxis.test.d.ts +1 -0
- package/dist/_shared/index.d.ts +3 -2
- package/dist/_shared/useChartFoundation.d.ts +2 -0
- package/dist/_shared/useChartPadding.d.ts +30 -0
- package/dist/hsa-mapping.d.ts +1 -0
- package/dist/hsa-mapping.js +2 -0
- package/dist/hsaMapping-Devrp7Rk.js +4125 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1529 -5014
- package/package.json +6 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NumberFormat } from '@cfasim-ui/shared';
|
|
2
|
-
import { ChartData, ChartCommonProps, ChartHoverPayload, ChartTooltipBaseProps } from '../_shared/index.js';
|
|
2
|
+
import { ChartData, DateFormat, ChartCommonProps, ChartHoverPayload, ChartTooltipBaseProps } from '../_shared/index.js';
|
|
3
3
|
export type BarChartData = ChartData;
|
|
4
4
|
export interface BarSeries {
|
|
5
5
|
/** Bar values; one entry per category. `y` is accepted as an alias. */
|
|
@@ -30,8 +30,11 @@ interface BarChartProps extends ChartCommonProps {
|
|
|
30
30
|
/**
|
|
31
31
|
* Category labels for the categorical axis. Length should match the
|
|
32
32
|
* longest series. When omitted, indices (0, 1, 2, ...) are used.
|
|
33
|
+
* Accepts date strings or `Date` objects: when every category parses
|
|
34
|
+
* as a date, label formatting switches to date mode (bar positions
|
|
35
|
+
* stay ordinal — they are not time-proportional).
|
|
33
36
|
*/
|
|
34
|
-
categories?: readonly string[];
|
|
37
|
+
categories?: readonly (string | Date)[];
|
|
35
38
|
/** "vertical" (default, aka column) draws upright bars; "horizontal" draws sideways. */
|
|
36
39
|
orientation?: "vertical" | "horizontal";
|
|
37
40
|
/** "grouped" (default) places series side-by-side; "stacked" stacks them. */
|
|
@@ -60,6 +63,16 @@ interface BarChartProps extends ChartCommonProps {
|
|
|
60
63
|
valueTickFormat?: NumberFormat;
|
|
61
64
|
/** Formatter for category-axis labels. Receives the resolved category string. */
|
|
62
65
|
categoryFormat?: (label: string, index: number) => string;
|
|
66
|
+
/**
|
|
67
|
+
* Date-tick formatter for date-mode category labels (auto-detected
|
|
68
|
+
* when every entry of `categories` parses as a date). Ignored unless
|
|
69
|
+
* the axis is in date mode. Accepts a `DateFormat` — preset name,
|
|
70
|
+
* `Intl.DateTimeFormatOptions`, or `(ms, unit?) => string`. When
|
|
71
|
+
* omitted, the formatter is picked from the chosen tick unit (e.g.
|
|
72
|
+
* monthly ticks → `"month-year"`). Has no effect when
|
|
73
|
+
* `categoryFormat` is also set.
|
|
74
|
+
*/
|
|
75
|
+
dateFormat?: DateFormat;
|
|
63
76
|
/**
|
|
64
77
|
* Fraction of each category slot reserved as gap between groups (0..1).
|
|
65
78
|
* Default 0.2 — i.e. bars/groups fill 80% of their slot.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Topology } from 'topojson-specification';
|
|
2
2
|
import { NumberFormat } from '@cfasim-ui/shared';
|
|
3
|
+
import { TitleStyle, LabelStyle } from '../_shared/index.js';
|
|
3
4
|
export type GeoType = "states" | "counties" | "hsas";
|
|
4
5
|
export interface StateData {
|
|
5
6
|
/** FIPS code (e.g. "06" for California, "04015" for a county) or name */
|
|
@@ -68,7 +69,15 @@ type __VLS_Props = {
|
|
|
68
69
|
width?: number;
|
|
69
70
|
height?: number;
|
|
70
71
|
colorScale?: ChoroplethColorScale | ThresholdStop[] | CategoricalStop[];
|
|
72
|
+
/**
|
|
73
|
+
* Map title. `\n` in the string creates additional lines, each
|
|
74
|
+
* adding `titleStyle.lineHeight` (default 18px) of vertical space.
|
|
75
|
+
*/
|
|
71
76
|
title?: string;
|
|
77
|
+
/** Styling for the map title. See `TitleStyle`. */
|
|
78
|
+
titleStyle?: TitleStyle;
|
|
79
|
+
/** Styling for the legend (title, swatch labels, and continuous-scale ticks). */
|
|
80
|
+
legendStyle?: LabelStyle;
|
|
72
81
|
noDataColor?: string;
|
|
73
82
|
strokeColor?: string;
|
|
74
83
|
strokeWidth?: number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NumberFormat } from '@cfasim-ui/shared';
|
|
2
|
-
import { ChartData, ChartCommonProps, ChartHoverPayload, ChartTooltipBaseProps } from '../_shared/index.js';
|
|
2
|
+
import { ChartData, LabelStyle, DateFormat, DateTimezone, ChartCommonProps, ChartHoverPayload, ChartTooltipBaseProps } from '../_shared/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Numeric input accepted by the chart. `number[]` and any standard numeric
|
|
5
5
|
* typed array are supported, so the output of
|
|
@@ -7,6 +7,12 @@ import { ChartData, ChartCommonProps, ChartHoverPayload, ChartTooltipBaseProps }
|
|
|
7
7
|
* without copying into a plain array.
|
|
8
8
|
*/
|
|
9
9
|
export type LineChartData = ChartData;
|
|
10
|
+
/**
|
|
11
|
+
* Accepted shapes for an `x` array. Numeric arrays (typed or plain) plot
|
|
12
|
+
* as numbers; string-or-`Date` arrays trigger date-axis mode when every
|
|
13
|
+
* element parses. See the `timezone` prop and `dateAxis` module.
|
|
14
|
+
*/
|
|
15
|
+
export type LineChartXInput = LineChartData | readonly (string | Date)[];
|
|
10
16
|
export interface Series {
|
|
11
17
|
/**
|
|
12
18
|
* Y-values. One of `y` or `data` must be supplied; `y` wins if both
|
|
@@ -18,9 +24,10 @@ export interface Series {
|
|
|
18
24
|
/**
|
|
19
25
|
* Optional x-values, parallel to `y`/`data`. When set, the chart
|
|
20
26
|
* plots points at the given x positions (irregular spacing supported).
|
|
21
|
-
* When omitted, points are plotted at indices 0, 1, 2, ...
|
|
27
|
+
* When omitted, points are plotted at indices 0, 1, 2, ... Accepts
|
|
28
|
+
* date strings or `Date` objects to enable date-axis mode.
|
|
22
29
|
*/
|
|
23
|
-
x?:
|
|
30
|
+
x?: LineChartXInput;
|
|
24
31
|
color?: string;
|
|
25
32
|
dashed?: boolean;
|
|
26
33
|
strokeWidth?: number;
|
|
@@ -55,7 +62,7 @@ export interface Area {
|
|
|
55
62
|
upper: LineChartData;
|
|
56
63
|
lower: LineChartData;
|
|
57
64
|
/** Optional x-values parallel to `upper`/`lower`. See `Series.x`. */
|
|
58
|
-
x?:
|
|
65
|
+
x?: LineChartXInput;
|
|
59
66
|
color?: string;
|
|
60
67
|
opacity?: number;
|
|
61
68
|
}
|
|
@@ -80,6 +87,17 @@ export interface AreaSection {
|
|
|
80
87
|
dashed?: boolean;
|
|
81
88
|
/** Label placement: "below" (default) renders below chart, "inline" renders in legend row, false hides label */
|
|
82
89
|
legend?: "inline" | "below" | false;
|
|
90
|
+
/**
|
|
91
|
+
* Style for the area section's primary label text. Defaults: font-size
|
|
92
|
+
* 11, font-weight 600, color taken from the section's `color`.
|
|
93
|
+
*/
|
|
94
|
+
inlineLabelStyle?: LabelStyle;
|
|
95
|
+
/**
|
|
96
|
+
* Style for the area section's secondary description text. Defaults:
|
|
97
|
+
* font-size 11, currentColor at 0.6 opacity. Providing `color` drops
|
|
98
|
+
* the default opacity.
|
|
99
|
+
*/
|
|
100
|
+
inlineDescriptionStyle?: LabelStyle;
|
|
83
101
|
}
|
|
84
102
|
interface LineChartProps extends ChartCommonProps {
|
|
85
103
|
/** Y-values. Equivalent to `data`. If both are set, `y` wins. */
|
|
@@ -90,8 +108,9 @@ interface LineChartProps extends ChartCommonProps {
|
|
|
90
108
|
* Optional x-values paired with `y`/`data`. When provided, points
|
|
91
109
|
* are plotted at the given x positions instead of at their indices.
|
|
92
110
|
* Ignored when `series` is used — set `x` on each `Series` instead.
|
|
111
|
+
* Accepts date strings or `Date` objects to enable date-axis mode.
|
|
93
112
|
*/
|
|
94
|
-
x?:
|
|
113
|
+
x?: LineChartXInput;
|
|
95
114
|
series?: Series[];
|
|
96
115
|
areas?: Area[];
|
|
97
116
|
areaSections?: AreaSection[];
|
|
@@ -124,12 +143,21 @@ interface LineChartProps extends ChartCommonProps {
|
|
|
124
143
|
*/
|
|
125
144
|
yTicks?: number | number[];
|
|
126
145
|
/**
|
|
127
|
-
* Formatter for x-axis tick labels.
|
|
128
|
-
* format string, or a function
|
|
129
|
-
* is also supported for index-based
|
|
130
|
-
* `@cfasim-ui/shared
|
|
146
|
+
* Formatter for x-axis tick labels. On a numeric axis, accepts a
|
|
147
|
+
* preset name, a printf-style format string, or a function (the
|
|
148
|
+
* two-arg `(value, index)` form is also supported for index-based
|
|
149
|
+
* labels — see `formatNumber` in `@cfasim-ui/shared`). On a date
|
|
150
|
+
* axis (auto-detected when every x value parses as a date), accepts
|
|
151
|
+
* a `DateFormat` instead — see the `dateAxis` module.
|
|
152
|
+
*/
|
|
153
|
+
xTickFormat?: NumberFormat | ((value: number, index: number) => string) | DateFormat;
|
|
154
|
+
/**
|
|
155
|
+
* Timezone used when parsing offset-less ISO strings and rendering
|
|
156
|
+
* date-axis tick labels. `"utc"` (default) keeps visuals consistent
|
|
157
|
+
* across viewers; `"local"` uses the browser timezone. Ignored on a
|
|
158
|
+
* numeric axis.
|
|
131
159
|
*/
|
|
132
|
-
|
|
160
|
+
timezone?: DateTimezone;
|
|
133
161
|
/**
|
|
134
162
|
* Formatter for y-axis tick labels. Accepts a preset name, a printf-style
|
|
135
163
|
* format string, or a function. See `formatNumber` in `@cfasim-ui/shared`.
|
|
@@ -39,18 +39,23 @@ export interface ChartAnnotation {
|
|
|
39
39
|
*/
|
|
40
40
|
fontWeight?: string | number;
|
|
41
41
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
42
|
+
* Color of the legibility outline drawn behind the text, pointer/rule
|
|
43
|
+
* line, and arrow tip. Defaults to `var(--color-bg-0, #fff)` so it
|
|
44
|
+
* matches the page background out of the box.
|
|
45
45
|
*/
|
|
46
|
-
|
|
47
|
-
/** Halo stroke width in pixels. Default: 3. */
|
|
48
|
-
haloWidth?: number;
|
|
46
|
+
outlineColor?: string;
|
|
49
47
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
48
|
+
* Outline stroke width in pixels. Applied to the text (via paint-order
|
|
49
|
+
* stroke), and added to `lineWidth` for the pointer/rule line and
|
|
50
|
+
* arrow tip outline pass. Set to `0` to disable the outline. Default: 3.
|
|
52
51
|
*/
|
|
53
|
-
|
|
52
|
+
outlineWidth?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Horizontal alignment of the label relative to its anchor position.
|
|
55
|
+
* When omitted, derived from the sign of `offset.x`: positive →
|
|
56
|
+
* `"left"`, negative → `"right"`, zero → `"center"`.
|
|
57
|
+
*/
|
|
58
|
+
align?: "left" | "center" | "right";
|
|
54
59
|
/** Pointer- or rule-line color override. Defaults to `color`. */
|
|
55
60
|
lineColor?: string;
|
|
56
61
|
/** Pointer- or rule-line width in pixels. Default: 1. */
|
|
@@ -1,6 +1,31 @@
|
|
|
1
1
|
import { NumberFormat } from '@cfasim-ui/shared';
|
|
2
2
|
import { ChartAnnotation } from './annotations.js';
|
|
3
3
|
import { ChartPadding } from './useChartPadding.js';
|
|
4
|
+
/**
|
|
5
|
+
* Visual styling for the chart title. All fields optional; unspecified
|
|
6
|
+
* fields fall back to the chart's defaults (font-size 14, line-height 18,
|
|
7
|
+
* font-weight 600, currentColor, align "left"). `lineHeight` is in pixels
|
|
8
|
+
* and controls spacing between lines when the title contains `\n`.
|
|
9
|
+
*/
|
|
10
|
+
export interface TitleStyle {
|
|
11
|
+
fontSize?: number;
|
|
12
|
+
lineHeight?: number;
|
|
13
|
+
color?: string;
|
|
14
|
+
fontWeight?: number | string;
|
|
15
|
+
/** Horizontal alignment of the title. Default: `"left"`. */
|
|
16
|
+
align?: "left" | "center" | "right";
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Visual styling for axis labels, tick labels, and legend text. Each
|
|
20
|
+
* field is optional; unspecified fields fall back to that element's
|
|
21
|
+
* default. When `color` is set, the default fill-opacity (used by tick
|
|
22
|
+
* labels) is dropped so the exact color is rendered.
|
|
23
|
+
*/
|
|
24
|
+
export interface LabelStyle {
|
|
25
|
+
fontSize?: number;
|
|
26
|
+
color?: string;
|
|
27
|
+
fontWeight?: number | string;
|
|
28
|
+
}
|
|
4
29
|
/**
|
|
5
30
|
* Props common to every cartesian chart component. Anything specific to
|
|
6
31
|
* the chart type (series shape, layout, value-axis details) lives on the
|
|
@@ -9,7 +34,19 @@ import { ChartPadding } from './useChartPadding.js';
|
|
|
9
34
|
export interface ChartCommonProps {
|
|
10
35
|
width?: number;
|
|
11
36
|
height?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Chart title. `\n` in the string creates additional lines, each
|
|
39
|
+
* adding `titleStyle.lineHeight` (default 18px) of vertical space.
|
|
40
|
+
*/
|
|
12
41
|
title?: string;
|
|
42
|
+
/** Styling for the chart title. See `TitleStyle`. */
|
|
43
|
+
titleStyle?: TitleStyle;
|
|
44
|
+
/** Styling for axis labels (the `xLabel` / `yLabel` text). */
|
|
45
|
+
axisLabelStyle?: LabelStyle;
|
|
46
|
+
/** Styling for axis tick labels (the numbers/categories on each axis). */
|
|
47
|
+
tickLabelStyle?: LabelStyle;
|
|
48
|
+
/** Styling for the inline legend item labels. */
|
|
49
|
+
legendStyle?: LabelStyle;
|
|
13
50
|
xLabel?: string;
|
|
14
51
|
yLabel?: string;
|
|
15
52
|
debounce?: number;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Date axis support: parsing, auto-detection, tick selection, and
|
|
3
|
+
* formatting for chart x-axes that carry temporal data. All functions
|
|
4
|
+
* are pure (no Vue reactivity, no DOM); chart components call into this
|
|
5
|
+
* module from their computed setup.
|
|
6
|
+
*
|
|
7
|
+
* Design notes:
|
|
8
|
+
* - Parsing is regex-based, not `Date.parse`. The ES spec parses bare
|
|
9
|
+
* `YYYY-MM-DD` as UTC but offset-less `YYYY-MM-DDTHH:mm:ss` as local,
|
|
10
|
+
* which makes a `timezone` prop incoherent. Manual parsing keeps the
|
|
11
|
+
* timezone interpretation consistent.
|
|
12
|
+
* - `isDateLike` deliberately rejects plain numbers so existing numeric
|
|
13
|
+
* demos (generation indices, day counters) aren't misclassified.
|
|
14
|
+
* - Tick stepping for month/year (and day/week in local mode) goes
|
|
15
|
+
* through `Date` field math so DST and month-length irregularities
|
|
16
|
+
* don't drift the tick boundaries.
|
|
17
|
+
*/
|
|
18
|
+
export type DateTickUnit = "year" | "month" | "week" | "day" | "hour" | "minute" | "second";
|
|
19
|
+
export type DateTimezone = "utc" | "local";
|
|
20
|
+
export type DateFormatPreset = "iso" | "iso-datetime" | "year" | "month-year" | "month-day" | "day" | "time" | "datetime" | "medium";
|
|
21
|
+
/**
|
|
22
|
+
* How to render a tick label on a date axis. Accepts:
|
|
23
|
+
* - A preset name (`"iso"`, `"month-year"`, ...).
|
|
24
|
+
* - An `Intl.DateTimeFormatOptions` literal for full control.
|
|
25
|
+
* - A function receiving the tick's epoch-ms and the tick unit the
|
|
26
|
+
* chart picked. Useful for unit-aware custom formatting.
|
|
27
|
+
*/
|
|
28
|
+
export type DateFormat = DateFormatPreset | Intl.DateTimeFormatOptions | ((ms: number, unit?: DateTickUnit) => string);
|
|
29
|
+
/**
|
|
30
|
+
* Parse `v` into an epoch-ms timestamp under the given timezone.
|
|
31
|
+
* Accepts `Date` instances and ISO-shaped strings; returns `null` for
|
|
32
|
+
* anything else (including plain `number`s — see `isDateLike`).
|
|
33
|
+
*/
|
|
34
|
+
export declare function parseDate(v: unknown, tz: DateTimezone): number | null;
|
|
35
|
+
/**
|
|
36
|
+
* Whether `v` looks like a date value to the auto-detector. Strict:
|
|
37
|
+
* `Date` instances or ISO-shaped strings only. Plain numbers are *not*
|
|
38
|
+
* considered date-like so numeric demos can't be silently promoted to
|
|
39
|
+
* a date axis.
|
|
40
|
+
*/
|
|
41
|
+
export declare function isDateLike(v: unknown): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Whether every entry of `values` is date-like and parses cleanly. An
|
|
44
|
+
* empty array is *not* considered all-dates (auto-detection should
|
|
45
|
+
* stay opt-in by content).
|
|
46
|
+
*/
|
|
47
|
+
export declare function isAllDates(values: ArrayLike<unknown>, tz: DateTimezone): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Choose tick values for a date axis spanning `[minMs, maxMs]`. The
|
|
50
|
+
* returned `unit` lets the default formatter pick a unit-appropriate
|
|
51
|
+
* preset (year ticks → "year", month → "month-year", day → "month-day",
|
|
52
|
+
* etc.) — same trick Vega-Lite uses.
|
|
53
|
+
*/
|
|
54
|
+
export declare function pickDateTicks(minMs: number, maxMs: number, targetCount: number, tz: DateTimezone): {
|
|
55
|
+
values: number[];
|
|
56
|
+
unit: DateTickUnit;
|
|
57
|
+
};
|
|
58
|
+
/** All valid preset names. Exported for the disjointness invariant test. */
|
|
59
|
+
export declare const DATE_FORMAT_PRESETS: readonly DateFormatPreset[];
|
|
60
|
+
/**
|
|
61
|
+
* Format an epoch-ms timestamp into a tick label. When `format` is
|
|
62
|
+
* undefined, picks a preset based on the tick `unit` (Vega-Lite style:
|
|
63
|
+
* year ticks read as "2024", month ticks as "Jan 2024", etc.).
|
|
64
|
+
*/
|
|
65
|
+
export declare function formatDate(ms: number, format: DateFormat | undefined, tz: DateTimezone, unit?: DateTickUnit): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/_shared/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { snap, niceStep, intervalValues, formatTick, type ChartData, } from './a
|
|
|
2
2
|
export { computeTickValues, type TickValueOptions } from './computeTicks.js';
|
|
3
3
|
export { scaleFraction, clampExtentForScale, computeLogTickValues, LOG_FLOOR, type ScaleType, } from './scale.js';
|
|
4
4
|
export { useChartSize, type ChartSizeOptions } from './useChartSize.js';
|
|
5
|
-
export { useChartPadding, INLINE_LEGEND_ROW_HEIGHT, type ChartPaddingOptions, type ChartPadding, type ChartBounds, type PositionedLegendItem, } from './useChartPadding.js';
|
|
5
|
+
export { useChartPadding, resolveLabelStyle, INLINE_LEGEND_ROW_HEIGHT, TITLE_LINE_HEIGHT, TITLE_FONT_SIZE, TITLE_FONT_WEIGHT, AXIS_LABEL_FONT_SIZE, TICK_LABEL_FONT_SIZE, TICK_LABEL_OPACITY, LEGEND_FONT_SIZE, type ChartPaddingOptions, type ChartPadding, type ChartBounds, type PositionedLegendItem, } from './useChartPadding.js';
|
|
6
6
|
export { useChartTooltip, type ChartTooltipOptions, } from './useChartTooltip.js';
|
|
7
7
|
export { useChartMenu, type ChartMenuOptions } from './useChartMenu.js';
|
|
8
8
|
export { useChartFullscreen } from './useChartFullscreen.js';
|
|
@@ -10,4 +10,5 @@ export { seriesToCsv, categoricalToCsv, type CsvSeries } from './seriesCsv.js';
|
|
|
10
10
|
export { default as ChartAnnotations } from './ChartAnnotations';
|
|
11
11
|
export type { ChartAnnotation } from './annotations.js';
|
|
12
12
|
export { useChartFoundation, makeTooltipValueFormatter, type ChartFoundationOptions, } from './useChartFoundation.js';
|
|
13
|
-
export type { ChartCommonProps, ChartHoverPayload, ChartTooltipValue, ChartTooltipBaseProps, } from './chartProps.js';
|
|
13
|
+
export type { ChartCommonProps, ChartHoverPayload, ChartTooltipValue, ChartTooltipBaseProps, TitleStyle, LabelStyle, } from './chartProps.js';
|
|
14
|
+
export { parseDate, isDateLike, isAllDates, pickDateTicks, formatDate, DATE_FORMAT_PRESETS, type DateFormat, type DateFormatPreset, type DateTickUnit, type DateTimezone, } from './dateAxis.js';
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { NumberFormat } from '@cfasim-ui/shared';
|
|
2
2
|
import { ChartPadding } from './useChartPadding.js';
|
|
3
3
|
import { TooltipClamp } from '../tooltip-position.js';
|
|
4
|
+
import { TitleStyle } from './chartProps.js';
|
|
4
5
|
export interface ChartFoundationOptions {
|
|
5
6
|
width: () => number | undefined;
|
|
6
7
|
height: () => number | undefined;
|
|
7
8
|
title: () => string | undefined;
|
|
9
|
+
titleStyle: () => TitleStyle | undefined;
|
|
8
10
|
xLabel: () => string | undefined;
|
|
9
11
|
yLabel: () => string | undefined;
|
|
10
12
|
debounce: () => number | undefined;
|
|
@@ -1,5 +1,34 @@
|
|
|
1
|
+
import { LabelStyle, TitleStyle } from './chartProps.js';
|
|
1
2
|
/** Vertical space reserved per row of the inline legend strip. */
|
|
2
3
|
export declare const INLINE_LEGEND_ROW_HEIGHT = 20;
|
|
4
|
+
/** Default line height (px) for the chart title; overridable per chart. */
|
|
5
|
+
export declare const TITLE_LINE_HEIGHT = 18;
|
|
6
|
+
/** Default font size (px) for the chart title; overridable per chart. */
|
|
7
|
+
export declare const TITLE_FONT_SIZE = 14;
|
|
8
|
+
/** Default font weight for the chart title; overridable per chart. */
|
|
9
|
+
export declare const TITLE_FONT_WEIGHT: number | string;
|
|
10
|
+
/** Default font size (px) for axis labels (`xLabel` / `yLabel`). */
|
|
11
|
+
export declare const AXIS_LABEL_FONT_SIZE = 13;
|
|
12
|
+
/** Default font size (px) for axis tick labels (the numbers on each axis). */
|
|
13
|
+
export declare const TICK_LABEL_FONT_SIZE = 10;
|
|
14
|
+
/** Default fill-opacity for tick labels when no custom color is set. */
|
|
15
|
+
export declare const TICK_LABEL_OPACITY = 0.6;
|
|
16
|
+
/** Default font size (px) for inline legend item labels. */
|
|
17
|
+
export declare const LEGEND_FONT_SIZE = 11;
|
|
18
|
+
/**
|
|
19
|
+
* Resolve a `LabelStyle` against per-element defaults. Returns the
|
|
20
|
+
* fields the chart's `<text>` element needs. When `style.color` is set,
|
|
21
|
+
* the default fill-opacity is dropped so the exact color renders.
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveLabelStyle(style: LabelStyle | undefined, defaults: {
|
|
24
|
+
fontSize: number;
|
|
25
|
+
fillOpacity?: number;
|
|
26
|
+
}): {
|
|
27
|
+
fontSize: number;
|
|
28
|
+
fill: string;
|
|
29
|
+
fontWeight: number | string | undefined;
|
|
30
|
+
fillOpacity: number | undefined;
|
|
31
|
+
};
|
|
3
32
|
/**
|
|
4
33
|
* Extra space added around the chart's standard layout. A number applies
|
|
5
34
|
* the same amount to all four sides; an object lets you pad sides
|
|
@@ -14,6 +43,7 @@ export type ChartPadding = number | {
|
|
|
14
43
|
};
|
|
15
44
|
export interface ChartPaddingOptions {
|
|
16
45
|
title: () => string | undefined;
|
|
46
|
+
titleStyle?: () => TitleStyle | undefined;
|
|
17
47
|
xLabel: () => string | undefined;
|
|
18
48
|
yLabel: () => string | undefined;
|
|
19
49
|
/**
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { fipsToHsa, hsaNames } from './ChoroplethMap/hsaMapping.js';
|