@opendata-ai/openchart-core 8.0.0-rc.1 → 8.0.0-rc.11
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/index.d.ts +201 -20
- package/dist/index.js +26 -7
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.css.map +1 -1
- package/package.json +1 -2
- package/schema/chart.schema.json +131 -2
- package/schema/vizspec.schema.json +257 -29
- package/src/accessibility/__tests__/alt-text.test.ts +0 -110
- package/src/accessibility/__tests__/aria.test.ts +0 -125
- package/src/accessibility/alt-text.ts +0 -155
- package/src/accessibility/aria.ts +0 -75
- package/src/accessibility/index.ts +0 -6
- package/src/colors/__tests__/colorblind.test.ts +0 -75
- package/src/colors/__tests__/contrast.test.ts +0 -119
- package/src/colors/__tests__/palettes.test.ts +0 -74
- package/src/colors/colorblind.ts +0 -131
- package/src/colors/contrast.ts +0 -143
- package/src/colors/index.ts +0 -36
- package/src/colors/palettes.ts +0 -206
- package/src/helpers/__tests__/deep-merge.test.ts +0 -54
- package/src/helpers/__tests__/spec-builders.test.ts +0 -338
- package/src/helpers/deep-merge.ts +0 -29
- package/src/helpers/spec-builders.ts +0 -479
- package/src/index.ts +0 -215
- package/src/labels/__tests__/collision.test.ts +0 -310
- package/src/labels/collision.ts +0 -249
- package/src/labels/index.ts +0 -13
- package/src/layout/__tests__/chrome.test.ts +0 -208
- package/src/layout/__tests__/text-measure.test.ts +0 -57
- package/src/layout/chrome.ts +0 -470
- package/src/layout/index.ts +0 -18
- package/src/layout/text-measure.ts +0 -404
- package/src/layout/text-wrap.ts +0 -93
- package/src/locale/__tests__/format.test.ts +0 -606
- package/src/locale/format.ts +0 -459
- package/src/locale/index.ts +0 -21
- package/src/responsive/__tests__/breakpoints.test.ts +0 -146
- package/src/responsive/__tests__/metrics.test.ts +0 -52
- package/src/responsive/breakpoints.ts +0 -172
- package/src/responsive/index.ts +0 -53
- package/src/responsive/metrics.ts +0 -297
- package/src/schema/__tests__/generated-artifacts.test.ts +0 -42
- package/src/schema/__tests__/schema.test.ts +0 -179
- package/src/styles/__tests__/reduced-motion-selectors.test.ts +0 -28
- package/src/styles/animation.css +0 -199
- package/src/styles/base.css +0 -102
- package/src/styles/chrome.css +0 -174
- package/src/styles/dark.css +0 -44
- package/src/styles/graph.css +0 -135
- package/src/styles/index.css +0 -28
- package/src/styles/keyframes.css +0 -135
- package/src/styles/legend.css +0 -18
- package/src/styles/reduced-motion.css +0 -67
- package/src/styles/series-search.css +0 -153
- package/src/styles/sparkline.css +0 -16
- package/src/styles/table-animation.css +0 -93
- package/src/styles/table.css +0 -398
- package/src/styles/token-definitions.ts +0 -199
- package/src/styles/tokens.css +0 -156
- package/src/styles/tooltip.css +0 -126
- package/src/styles/you-draw-it.css +0 -126
- package/src/theme/__tests__/dark-mode.test.ts +0 -232
- package/src/theme/__tests__/defaults.test.ts +0 -73
- package/src/theme/__tests__/resolve.test.ts +0 -277
- package/src/theme/dark-mode.ts +0 -258
- package/src/theme/defaults.ts +0 -110
- package/src/theme/index.ts +0 -8
- package/src/theme/presets.ts +0 -64
- package/src/theme/resolve.ts +0 -312
- package/src/types/__tests__/encoding.test.ts +0 -368
- package/src/types/__tests__/gradient.test.ts +0 -95
- package/src/types/__tests__/spec.test.ts +0 -499
- package/src/types/encoding.ts +0 -280
- package/src/types/events.ts +0 -154
- package/src/types/index.ts +0 -287
- package/src/types/layout.ts +0 -1966
- package/src/types/schema-roots.ts +0 -32
- package/src/types/spec.ts +0 -2867
- package/src/types/table.ts +0 -108
- package/src/types/theme.ts +0 -209
package/dist/index.d.ts
CHANGED
|
@@ -31,8 +31,13 @@ declare const HEIGHT_SHORT_MAX = 350;
|
|
|
31
31
|
declare function getHeightClass(height: number): HeightClass;
|
|
32
32
|
/** Label display mode at a given breakpoint. */
|
|
33
33
|
type LabelMode = 'all' | 'important' | 'none';
|
|
34
|
-
/**
|
|
35
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Legend position at a given breakpoint. `'top-left'` is a map-only overlay
|
|
36
|
+
* position: the legend floats inside the map area's top-left corner (with its
|
|
37
|
+
* own backdrop) instead of reserving a block of figure height. Charts treat
|
|
38
|
+
* it as the default position.
|
|
39
|
+
*/
|
|
40
|
+
type LegendPosition = 'top' | 'top-left' | 'right' | 'bottom' | 'bottom-right' | 'inline';
|
|
36
41
|
/** Annotation position strategy. */
|
|
37
42
|
type AnnotationPosition = 'inline' | 'tooltip-only';
|
|
38
43
|
/** Axis label density (controls tick count reduction). */
|
|
@@ -963,6 +968,20 @@ interface Encoding<TData extends DataRow = DataRow> {
|
|
|
963
968
|
* per-panel axes.
|
|
964
969
|
*/
|
|
965
970
|
facet?: FacetChannel<TData>;
|
|
971
|
+
/**
|
|
972
|
+
* Row facet channel: partitions data into vertically-stacked panels.
|
|
973
|
+
* Each unique value of the row field produces one panel, arranged in a
|
|
974
|
+
* single column. Shares the x-axis scale by default; y-axis is independent.
|
|
975
|
+
* Mutually exclusive with `facet` and `column`.
|
|
976
|
+
*/
|
|
977
|
+
row?: FacetChannel<TData>;
|
|
978
|
+
/**
|
|
979
|
+
* Column facet channel: partitions data into side-by-side panels.
|
|
980
|
+
* Each unique value of the column field produces one panel, arranged in a
|
|
981
|
+
* single row. Shares the y-axis scale by default; x-axis is independent.
|
|
982
|
+
* Mutually exclusive with `facet` and `row`.
|
|
983
|
+
*/
|
|
984
|
+
column?: FacetChannel<TData>;
|
|
966
985
|
}
|
|
967
986
|
/** Encoding channel for graph nodes and edges. */
|
|
968
987
|
interface GraphEncodingChannel {
|
|
@@ -1937,7 +1956,12 @@ interface BaseChartSpec<TData extends DataRow = DataRow> {
|
|
|
1937
1956
|
darkMode?: DarkMode;
|
|
1938
1957
|
/** Whether to show the tryOpenData.ai watermark. Defaults to true. */
|
|
1939
1958
|
watermark?: boolean;
|
|
1940
|
-
/**
|
|
1959
|
+
/**
|
|
1960
|
+
* Series names to hide from rendering by default. This is the authored
|
|
1961
|
+
* persistence target for legend visibility. Runtime legend toggles
|
|
1962
|
+
* (legend-toggle edit events) layer on top of this via ephemeral runtime
|
|
1963
|
+
* sets but never modify it.
|
|
1964
|
+
*/
|
|
1941
1965
|
hiddenSeries?: string[];
|
|
1942
1966
|
/** Per-series visual overrides, keyed by series name (the color field value). */
|
|
1943
1967
|
seriesStyles?: Record<string, SeriesStyle>;
|
|
@@ -2265,7 +2289,16 @@ interface LayerSpec<TData extends DataRow = DataRow> {
|
|
|
2265
2289
|
height?: number;
|
|
2266
2290
|
/** Accepted for Vega-Lite compatibility and ignored (with a compile warning). */
|
|
2267
2291
|
$schema?: string;
|
|
2268
|
-
/**
|
|
2292
|
+
/**
|
|
2293
|
+
* Annotations for the layered chart. When present, these are the
|
|
2294
|
+
* annotations rendered and available for editing. When absent, falls back
|
|
2295
|
+
* to the first leaf layer's annotations. Annotations on second and later
|
|
2296
|
+
* leaf layers are not rendered.
|
|
2297
|
+
*
|
|
2298
|
+
* For edit persistence: the `data-annotation-index` stamped on each
|
|
2299
|
+
* rendered annotation maps to this array (or the first leaf's if this is
|
|
2300
|
+
* unset). Place annotations here for reliable index-based edit matching.
|
|
2301
|
+
*/
|
|
2269
2302
|
annotations?: Annotation[];
|
|
2270
2303
|
/** Label display configuration. `false` disables all labels, `true` uses defaults. */
|
|
2271
2304
|
labels?: LabelSpec;
|
|
@@ -2281,7 +2314,12 @@ interface LayerSpec<TData extends DataRow = DataRow> {
|
|
|
2281
2314
|
watermark?: boolean;
|
|
2282
2315
|
/** Resolution strategy for shared scales/axes/legends. */
|
|
2283
2316
|
resolve?: ResolveConfig;
|
|
2284
|
-
/**
|
|
2317
|
+
/**
|
|
2318
|
+
* Series names to hide from rendering by default. This is the authored
|
|
2319
|
+
* persistence target for legend visibility. Runtime legend toggles
|
|
2320
|
+
* (legend-toggle edit events) layer on top of this via ephemeral runtime
|
|
2321
|
+
* sets but never modify it.
|
|
2322
|
+
*/
|
|
2285
2323
|
hiddenSeries?: string[];
|
|
2286
2324
|
/** Endpoint labels column, inherited by child layers that don't set their own. */
|
|
2287
2325
|
endpointLabels?: boolean | EndpointLabelsConfig;
|
|
@@ -2424,9 +2462,21 @@ interface TileMapSpec {
|
|
|
2424
2462
|
/** Supported map projections. */
|
|
2425
2463
|
type MapProjection = 'albersUsa' | 'mercator' | 'equalEarth' | 'identity';
|
|
2426
2464
|
/** Focus target for map camera: feature id(s) to zoom/pan to. */
|
|
2465
|
+
/**
|
|
2466
|
+
* Fit the point layer's cluster. `true` fits every point; `{ field, value }`
|
|
2467
|
+
* fits only the points whose data row has `row[field] === value` (e.g. only the
|
|
2468
|
+
* campuses rated "F"), which lets a story pan between sub-clusters.
|
|
2469
|
+
*/
|
|
2470
|
+
type MapPointsFocus = true | {
|
|
2471
|
+
field: string;
|
|
2472
|
+
value: string | number;
|
|
2473
|
+
};
|
|
2427
2474
|
type MapFocus = string | number | Array<string | number> | {
|
|
2428
2475
|
features: string | number | Array<string | number>;
|
|
2429
2476
|
padding?: number;
|
|
2477
|
+
} | {
|
|
2478
|
+
points: MapPointsFocus;
|
|
2479
|
+
padding?: number;
|
|
2430
2480
|
};
|
|
2431
2481
|
/** Geo configuration for map specs. */
|
|
2432
2482
|
interface MapGeo {
|
|
@@ -2436,18 +2486,44 @@ interface MapGeo {
|
|
|
2436
2486
|
idField?: string;
|
|
2437
2487
|
/** Map projection. Defaults to 'albersUsa'. */
|
|
2438
2488
|
projection?: MapProjection;
|
|
2439
|
-
/**
|
|
2489
|
+
/**
|
|
2490
|
+
* Focus the camera. A feature id (or array) fits those features; `{ features, padding }`
|
|
2491
|
+
* adds breathing room; `{ points: true, padding }` fits the points layer's cluster
|
|
2492
|
+
* instead of any feature (use when points occupy a small part of a large feature, so
|
|
2493
|
+
* fitting the feature would leave the cluster small and off-center);
|
|
2494
|
+
* `{ points: { field, value }, padding }` fits only the matching point subset, so a
|
|
2495
|
+
* story can pan between sub-clusters. null clears focus from a prior story step.
|
|
2496
|
+
*/
|
|
2440
2497
|
focus?: MapFocus | null;
|
|
2441
2498
|
}
|
|
2442
2499
|
/** Encoding channels specific to map visualizations. */
|
|
2443
2500
|
interface MapEncoding {
|
|
2444
|
-
/** Join key field in the data
|
|
2445
|
-
key
|
|
2446
|
-
/** Color encoding (
|
|
2447
|
-
color
|
|
2501
|
+
/** Join key field in the data. Required for choropleth; optional in basemap-only mode (points layer with empty data). */
|
|
2502
|
+
key?: EncodingChannel;
|
|
2503
|
+
/** Color encoding (quantitative or nominal). Drives fill color of features. Optional when a points layer is present (basemap-only mode). */
|
|
2504
|
+
color?: EncodingChannel;
|
|
2448
2505
|
/** Tooltip encoding (optional). */
|
|
2449
2506
|
tooltip?: EncodingChannel | EncodingChannel[];
|
|
2450
2507
|
}
|
|
2508
|
+
/** Point/symbol layer rendered above choropleth features. */
|
|
2509
|
+
interface MapPointsLayer {
|
|
2510
|
+
/** Tabular data for the points. Independent of the choropleth data join. */
|
|
2511
|
+
data: DataRow[];
|
|
2512
|
+
/** Field holding longitude (x coordinate). */
|
|
2513
|
+
longitude: EncodingChannel;
|
|
2514
|
+
/** Field holding latitude (y coordinate). */
|
|
2515
|
+
latitude: EncodingChannel;
|
|
2516
|
+
/** Optional quantitative size encoding. Area-proportional: r proportional to sqrt(value). No size legend is rendered in v1; explain the scale in chrome.subtitle if needed. */
|
|
2517
|
+
size?: EncodingChannel;
|
|
2518
|
+
/** Optional color encoding (nominal or quantitative). Independent scale from choropleth. */
|
|
2519
|
+
color?: EncodingChannel;
|
|
2520
|
+
/** Tooltip channel(s), same shape as MapEncoding.tooltip. */
|
|
2521
|
+
tooltip?: EncodingChannel | EncodingChannel[];
|
|
2522
|
+
/** Stable id for event callbacks. Data-update transitions for points are not yet supported. */
|
|
2523
|
+
key?: EncodingChannel;
|
|
2524
|
+
/** Fill opacity for point circles. Default 0.65. Range 0-1. */
|
|
2525
|
+
opacity?: number;
|
|
2526
|
+
}
|
|
2451
2527
|
interface MapSpec {
|
|
2452
2528
|
/** Discriminant: always "map". */
|
|
2453
2529
|
type: 'map';
|
|
@@ -2467,6 +2543,8 @@ interface MapSpec {
|
|
|
2467
2543
|
darkMode?: DarkMode;
|
|
2468
2544
|
/** Whether to show the tryOpenData.ai watermark. Defaults to true. */
|
|
2469
2545
|
watermark?: boolean;
|
|
2546
|
+
/** Optional point/symbol layer rendered above choropleth features. */
|
|
2547
|
+
points?: MapPointsLayer;
|
|
2470
2548
|
/** Animation configuration for entrance animations. */
|
|
2471
2549
|
animation?: AnimationSpec;
|
|
2472
2550
|
/**
|
|
@@ -2556,7 +2634,9 @@ type SankeySpecWithoutData = Omit<SankeySpec, 'data'>;
|
|
|
2556
2634
|
/** TileMap spec without runtime data, for persistence/storage. */
|
|
2557
2635
|
type TileMapSpecWithoutData = Omit<TileMapSpec, 'data'>;
|
|
2558
2636
|
/** Map spec without runtime data, for persistence/storage. */
|
|
2559
|
-
type MapSpecWithoutData = Omit<MapSpec, 'data'
|
|
2637
|
+
type MapSpecWithoutData = Omit<MapSpec, 'data' | 'points'> & {
|
|
2638
|
+
points?: Omit<MapPointsLayer, 'data'>;
|
|
2639
|
+
};
|
|
2560
2640
|
/** BarList spec without runtime data, for persistence/storage. */
|
|
2561
2641
|
type BarListSpecWithoutData = Omit<BarListSpec, 'data'>;
|
|
2562
2642
|
/** Union of data-stripped spec types for persistence/storage. */
|
|
@@ -2900,26 +2980,36 @@ type ElementRef = {
|
|
|
2900
2980
|
type: 'annotation';
|
|
2901
2981
|
index: number;
|
|
2902
2982
|
id?: string;
|
|
2983
|
+
/** RFC 6901 JSON Pointer to the edited property in the spec. */
|
|
2984
|
+
path?: string;
|
|
2903
2985
|
} | {
|
|
2904
2986
|
type: 'chrome';
|
|
2905
2987
|
key: ChromeKey;
|
|
2988
|
+
/** RFC 6901 JSON Pointer to the edited property in the spec. */
|
|
2989
|
+
path?: string;
|
|
2906
2990
|
} | {
|
|
2907
2991
|
type: 'series-label';
|
|
2908
2992
|
series: string;
|
|
2993
|
+
/** RFC 6901 JSON Pointer to the edited property in the spec. */
|
|
2994
|
+
path?: string;
|
|
2909
2995
|
} | {
|
|
2910
2996
|
type: 'legend';
|
|
2997
|
+
/** RFC 6901 JSON Pointer to the edited property in the spec. */
|
|
2998
|
+
path?: string;
|
|
2911
2999
|
} | {
|
|
2912
3000
|
type: 'legend-entry';
|
|
2913
3001
|
series: string;
|
|
2914
3002
|
index: number;
|
|
3003
|
+
/** RFC 6901 JSON Pointer to the edited property in the spec. */
|
|
3004
|
+
path?: string;
|
|
2915
3005
|
};
|
|
2916
3006
|
/** Helper constructors for ergonomic ElementRef creation. */
|
|
2917
3007
|
declare const elementRef: {
|
|
2918
|
-
readonly annotation: (index: number, id?: string) => ElementRef;
|
|
2919
|
-
readonly chrome: (key: ChromeKey) => ElementRef;
|
|
2920
|
-
readonly seriesLabel: (series: string) => ElementRef;
|
|
2921
|
-
readonly legend: () => ElementRef;
|
|
2922
|
-
readonly legendEntry: (series: string, index: number) => ElementRef;
|
|
3008
|
+
readonly annotation: (index: number, id?: string, path?: string) => ElementRef;
|
|
3009
|
+
readonly chrome: (key: ChromeKey, path?: string) => ElementRef;
|
|
3010
|
+
readonly seriesLabel: (series: string, path?: string) => ElementRef;
|
|
3011
|
+
readonly legend: (path?: string) => ElementRef;
|
|
3012
|
+
readonly legendEntry: (series: string, index: number, path?: string) => ElementRef;
|
|
2923
3013
|
};
|
|
2924
3014
|
/**
|
|
2925
3015
|
* Discriminated union of all element edit events.
|
|
@@ -2934,21 +3024,31 @@ declare const elementRef: {
|
|
|
2934
3024
|
*/
|
|
2935
3025
|
type ElementEdit = {
|
|
2936
3026
|
type: 'annotation';
|
|
3027
|
+
element: ElementRef;
|
|
2937
3028
|
annotation: TextAnnotation;
|
|
2938
3029
|
offset: AnnotationOffset;
|
|
2939
3030
|
} | {
|
|
2940
3031
|
type: 'annotation-connector';
|
|
3032
|
+
element: ElementRef;
|
|
2941
3033
|
annotation: TextAnnotation;
|
|
2942
3034
|
endpoint: 'from' | 'to';
|
|
2943
3035
|
offset: AnnotationOffset;
|
|
2944
3036
|
} | {
|
|
2945
3037
|
type: 'range-label';
|
|
3038
|
+
element: ElementRef;
|
|
2946
3039
|
annotation: RangeAnnotation;
|
|
2947
3040
|
labelOffset: AnnotationOffset;
|
|
2948
3041
|
} | {
|
|
2949
3042
|
type: 'refline-label';
|
|
3043
|
+
element: ElementRef;
|
|
2950
3044
|
annotation: RefLineAnnotation;
|
|
2951
3045
|
labelOffset: AnnotationOffset;
|
|
3046
|
+
} | {
|
|
3047
|
+
type: 'annotation-anchor';
|
|
3048
|
+
element: ElementRef;
|
|
3049
|
+
annotation: TextAnnotation;
|
|
3050
|
+
x: string | number;
|
|
3051
|
+
y: string | number;
|
|
2952
3052
|
} | {
|
|
2953
3053
|
type: 'chrome';
|
|
2954
3054
|
key: ChromeKey;
|
|
@@ -2961,10 +3061,21 @@ type ElementEdit = {
|
|
|
2961
3061
|
} | {
|
|
2962
3062
|
type: 'legend';
|
|
2963
3063
|
offset: AnnotationOffset;
|
|
2964
|
-
}
|
|
3064
|
+
}
|
|
3065
|
+
/**
|
|
3066
|
+
* Transient legend visibility toggle. Reports the same runtime show/hide
|
|
3067
|
+
* a reader triggers; not persisted by openchart. To author default-hidden
|
|
3068
|
+
* series, set `spec.hiddenSeries` directly. Hosts building spec
|
|
3069
|
+
* persistence should generally not write legend-toggle edits back into
|
|
3070
|
+
* the authored spec. `hidden: true` means the series was just hidden.
|
|
3071
|
+
*/
|
|
3072
|
+
| {
|
|
2965
3073
|
type: 'legend-toggle';
|
|
2966
3074
|
series: string;
|
|
2967
3075
|
hidden: boolean;
|
|
3076
|
+
} | {
|
|
3077
|
+
type: 'add';
|
|
3078
|
+
annotation: TextAnnotation;
|
|
2968
3079
|
} | {
|
|
2969
3080
|
type: 'delete';
|
|
2970
3081
|
element: ElementRef;
|
|
@@ -3000,6 +3111,14 @@ interface MarkEvent {
|
|
|
3000
3111
|
* or ChartProps (React component) to receive interaction callbacks.
|
|
3001
3112
|
*/
|
|
3002
3113
|
interface ChartEventHandlers {
|
|
3114
|
+
/**
|
|
3115
|
+
* Explicitly enable or disable edit interactions (drag, select, keyboard
|
|
3116
|
+
* delete/edit). When true, the interaction layer is wired even without
|
|
3117
|
+
* onEdit. When false, all edit interactions are suppressed even when
|
|
3118
|
+
* onEdit is provided. When omitted, each interaction block uses its
|
|
3119
|
+
* existing callback-presence gate.
|
|
3120
|
+
*/
|
|
3121
|
+
editable?: boolean;
|
|
3003
3122
|
/** Called when a data mark is clicked. */
|
|
3004
3123
|
onMarkClick?: (event: MarkEvent) => void;
|
|
3005
3124
|
/** Called when the mouse enters a data mark. */
|
|
@@ -3590,6 +3709,11 @@ interface ResolvedLabel {
|
|
|
3590
3709
|
to: Point;
|
|
3591
3710
|
/** Actual data point the connector is calling out. Renderer uses this for the endpoint marker. */
|
|
3592
3711
|
endpoint?: Point;
|
|
3712
|
+
/** Author's from-end nudge, re-applied on every geometry rebuild (mirrors `endpoint` for `to`). */
|
|
3713
|
+
fromOffset?: {
|
|
3714
|
+
dx: number;
|
|
3715
|
+
dy: number;
|
|
3716
|
+
};
|
|
3593
3717
|
/** Connector line color. */
|
|
3594
3718
|
stroke: string;
|
|
3595
3719
|
/** Connector style: straight line, curved arrow, or vertical drop-line through the data point. */
|
|
@@ -3715,8 +3839,9 @@ interface BaseLegendLayout {
|
|
|
3715
3839
|
* read them silently pick whichever comes first.
|
|
3716
3840
|
*/
|
|
3717
3841
|
channel?: LegendChannel;
|
|
3718
|
-
/** Where the legend is positioned relative to the chart area.
|
|
3719
|
-
|
|
3842
|
+
/** Where the legend is positioned relative to the chart area. `'top-left'`
|
|
3843
|
+
* is a map-only overlay position (floats inside the map area). */
|
|
3844
|
+
position: 'top' | 'top-left' | 'right' | 'bottom' | 'bottom-right' | 'inline';
|
|
3720
3845
|
/** Bounding box for the legend (pixel coordinates). */
|
|
3721
3846
|
bounds: Rect;
|
|
3722
3847
|
/** Entry label style. */
|
|
@@ -4046,6 +4171,23 @@ interface YouDrawItYInvert {
|
|
|
4046
4171
|
/** Data value at the bottom pixel. */
|
|
4047
4172
|
bottomData: number;
|
|
4048
4173
|
}
|
|
4174
|
+
/**
|
|
4175
|
+
* Scale inversion anchors serialized from the engine so the vanilla layer
|
|
4176
|
+
* can convert pixel positions to data-space values without holding d3
|
|
4177
|
+
* scale objects. Generalizes the YouDrawItYInvert pattern to both axes.
|
|
4178
|
+
*/
|
|
4179
|
+
interface ScaleInvert {
|
|
4180
|
+
/** For continuous scales: two reference pixel-to-data anchor points. */
|
|
4181
|
+
topPixel: number;
|
|
4182
|
+
bottomPixel: number;
|
|
4183
|
+
topData: number;
|
|
4184
|
+
bottomData: number;
|
|
4185
|
+
/** Scale type so the vanilla layer applies the correct inverse transform. */
|
|
4186
|
+
scaleType?: 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' | 'time';
|
|
4187
|
+
/** For band/point scales: ordered domain values and their pixel centers. */
|
|
4188
|
+
domain?: (string | number)[];
|
|
4189
|
+
positions?: number[];
|
|
4190
|
+
}
|
|
4049
4191
|
/**
|
|
4050
4192
|
* Resolved geometry and config for the "you draw it" interactive format
|
|
4051
4193
|
* (`youDrawIt`). The vanilla adapter uses this to render the hatched drawing
|
|
@@ -4098,6 +4240,7 @@ interface FacetPanelLayout {
|
|
|
4098
4240
|
y: number;
|
|
4099
4241
|
fontSize: number;
|
|
4100
4242
|
fontWeight: number;
|
|
4243
|
+
textAnchor?: 'start' | 'middle' | 'end';
|
|
4101
4244
|
};
|
|
4102
4245
|
}
|
|
4103
4246
|
/** Layout for a faceted (small-multiples) chart. */
|
|
@@ -4110,6 +4253,8 @@ interface FacetLayout {
|
|
|
4110
4253
|
columns: number;
|
|
4111
4254
|
/** Whether scales are shared across panels. */
|
|
4112
4255
|
sharedScales: boolean;
|
|
4256
|
+
/** How panels are arranged: 'row' (vertical stack), 'column' (horizontal), 'wrap' (grid). */
|
|
4257
|
+
direction: 'row' | 'column' | 'wrap';
|
|
4113
4258
|
}
|
|
4114
4259
|
/**
|
|
4115
4260
|
* ChartLayout: the complete engine output for chart visualizations.
|
|
@@ -4184,6 +4329,10 @@ interface ChartLayout {
|
|
|
4184
4329
|
crosshair: boolean;
|
|
4185
4330
|
/** Real text measurement function from the adapter (for accurate SVG text wrapping). */
|
|
4186
4331
|
measureText?: MeasureTextFn;
|
|
4332
|
+
/** Scale inversion anchors for the x axis. Used by anchor drag to convert pixel to data-space. */
|
|
4333
|
+
xInvert?: ScaleInvert;
|
|
4334
|
+
/** Scale inversion anchors for the y axis. Used by anchor drag to convert pixel to data-space. */
|
|
4335
|
+
yInvert?: ScaleInvert;
|
|
4187
4336
|
/** Faceted (small-multiples) layout. When present, renderers iterate panels instead of using top-level marks/axes. */
|
|
4188
4337
|
facet?: FacetLayout;
|
|
4189
4338
|
}
|
|
@@ -4642,6 +4791,32 @@ interface MapFeatureMark {
|
|
|
4642
4791
|
/** Centroid in map-local coordinates. */
|
|
4643
4792
|
centroid: [number, number];
|
|
4644
4793
|
}
|
|
4794
|
+
/** A resolved map point mark with projected coordinates and visual properties. */
|
|
4795
|
+
interface MapPointMark {
|
|
4796
|
+
type: 'map-point';
|
|
4797
|
+
/** Projected center x in map-local coordinates. */
|
|
4798
|
+
cx: number;
|
|
4799
|
+
/** Projected center y in map-local coordinates. */
|
|
4800
|
+
cy: number;
|
|
4801
|
+
/** Radius in pixels (base radius before camera counter-scaling). */
|
|
4802
|
+
r: number;
|
|
4803
|
+
/** CSS fill color. */
|
|
4804
|
+
fill: string;
|
|
4805
|
+
/** CSS stroke color. */
|
|
4806
|
+
stroke: string;
|
|
4807
|
+
/** Stroke width in px. */
|
|
4808
|
+
strokeWidth: number;
|
|
4809
|
+
/** Fill opacity (0-1). */
|
|
4810
|
+
fillOpacity: number;
|
|
4811
|
+
/** Stable key for events. */
|
|
4812
|
+
key: string;
|
|
4813
|
+
/** Original data row. */
|
|
4814
|
+
data: Record<string, unknown>;
|
|
4815
|
+
/** Accessibility attributes. */
|
|
4816
|
+
aria: MarkAria;
|
|
4817
|
+
/** Index for stagger animation ordering. */
|
|
4818
|
+
animationIndex: number;
|
|
4819
|
+
}
|
|
4645
4820
|
/** Border paths for the map (interior borders and coastline/outline). */
|
|
4646
4821
|
interface MapBorders {
|
|
4647
4822
|
/** SVG path `d` for interior borders between features. */
|
|
@@ -4669,6 +4844,12 @@ interface MapLayout {
|
|
|
4669
4844
|
features: MapFeatureMark[];
|
|
4670
4845
|
/** Border paths (interior mesh and outline). */
|
|
4671
4846
|
borders: MapBorders;
|
|
4847
|
+
/** Resolved point marks for the symbol layer (empty array if no points layer). */
|
|
4848
|
+
pointMarks: MapPointMark[];
|
|
4849
|
+
/** Categorical legend for the point color channel (null if no point color). */
|
|
4850
|
+
pointCategoricalLegend: CategoricalLegendLayout | null;
|
|
4851
|
+
/** Continuous legend for the point color channel (null if no point color). */
|
|
4852
|
+
pointContinuousLegend: ContinuousLegendLayout | null;
|
|
4672
4853
|
/** Continuous color legend for quantitative mode (null if hidden or categorical). */
|
|
4673
4854
|
continuousLegend: ContinuousLegendLayout | null;
|
|
4674
4855
|
/** Categorical swatch legend for nominal mode (null if hidden or quantitative). */
|
|
@@ -5806,4 +5987,4 @@ declare const CSS_TOKEN_ROOT_SELECTORS: readonly string[];
|
|
|
5806
5987
|
declare const CSS_TOKENS: readonly CssTokenDef[];
|
|
5807
5988
|
declare function cssTokenDefault(name: string, mode: 'light' | 'dark'): string;
|
|
5808
5989
|
|
|
5809
|
-
export { type A11yConfig, type A11yMetadata, ACHROMATIC_RAMP, AXIS_TITLE_GAP, AXIS_TITLE_OFFSET_COMPACT, AXIS_TITLE_OFFSET_DEFAULT, AXIS_TITLE_TRAILING_PAD, type AggregateOp, type AggregateTransform, type AnimationConfig, type AnimationEase, type AnimationPhaseConfig, type AnimationSpec, type AnimationStagger, type Annotation, type AnnotationAnchor, type AnnotationFootnote, type AnnotationOffset, type AnnotationPosition, type ArcEncoding, type ArcMark, type AreaEncoding, type AreaMark, type AxisConfig, type AxisLabelDensity, type AxisLayout, type AxisTick, BRAND_FONT_SIZE, BRAND_MIN_WIDTH, BRAND_RESERVE_WIDTH, BREAKPOINT_COMPACT_MAX, BREAKPOINT_MEDIUM_MAX, type BarColumnConfig, type BarEncoding, type BarListEncoding, type BarListLayout, type BarListRowMark, type BarListSpec, type BarListSpecWithoutData, type BarTableCell, type BaseLegendLayout, type BeeswarmEncoding, type BinParams, type BinTransform, type Breakpoint, CATEGORICAL_PALETTE, COMPACT_WIDTH, CSS_TOKENS, CSS_TOKEN_ROOT_SELECTORS, type CalculateExpression, type CalculateTransform, type CalendarEncoding, type CategoricalLegendLayout, type CategoricalPalette, type CategoryColorsConfig, type CategoryTableCell, type CellStyle, type ChannelRule, type ChartBuilderOptions, type ChartEventHandlers, type ChartLayout, type ChartSpec, type ChartSpecOverride, type ChartSpecWithoutData, type Chrome, type ChromeDefaults, type ChromeKey, type ChromeMode, type ChromeText, type ChromeTextStyle, type ChromeThemeOverride, type CircleEncoding, type ColorBlindnessType, type ColumnConfig, type CompileOptions, type CompileTableOptions, type CompileWarning, type Condition, type ConditionalValueDef, type ConnectorConfig, type ConnectorType, type ContinuousLegendBin, type ContinuousLegendLayout, type ContinuousLegendTick, type CssTokenDef, DEFAULT_THEME, DIVERGING_PALETTES, type DarkMode, type DataRow, type DateGranularity, type Display, type DivergingPalette, EXTENDED_OFFSET_STRATEGIES, type ElementEdit, type ElementRef, type Encoding, type EncodingChannel, type EncodingRule, type EndpointLabelContent, type EndpointLabelEntry, type EndpointLabelsConfig, type EndpointLabelsLayout, FOOTNOTE_LINE_HEIGHT, type FacetChannel, type FacetLayout, type FacetPanelLayout, type FieldFormatContext, type FieldPredicate, type FieldRef, type FieldType, type FillPatternType, type FilterPredicate, type FilterTransform, type FlagTableCell, type FoldTransform, GRAPH_ENCODING_RULES, type GradientColorStop, type GradientDef, type GradientLegendLayout, type GradientStop, type GraphChannelRule, type GraphEdge, type GraphEdgeLayout, type GraphEncoding, type GraphEncodingChannel, type GraphLayout, type GraphLayoutConfig, type GraphNode, type GraphNodeLayout, type GraphSpec, type GraphSpecWithoutData, type Gridline, HEIGHT_CRAMPED_MAX, HEIGHT_SHORT_MAX, HPAD_COMPACT_FRACTION, HPAD_COMPACT_MIN, type HeatmapColumnConfig, type HeatmapTableCell, type HeightClass, type ImageColumnConfig, type ImageTableCell, LABEL_GAP_COMPACT, LABEL_GAP_DEFAULT, LABEL_GAP_NARROW_MAX, type LabelCandidate, type LabelConfig, type LabelDensity, type LabelMode, type LabelPriority, type LabelSpec, type LayerSpec, type LayoutStrategy, type LegendChannel, type LegendConfig, type LegendEntry, type LegendEntryPosition, type LegendLayout, type LegendPosition, type LineEncoding, type LineMark, type LinearGradient, type LogicalAnd, type LogicalNot, type LogicalOr, type LollipopEncoding, MARK_DISPLAY_NAMES, MARK_ENCODING_RULES, MARK_TYPES, MAX_LEFT_LABEL_FRACTION_COMPACT, MAX_LEFT_LABEL_FRACTION_DEFAULT, MAX_LEFT_LABEL_FRACTION_MEDIUM, MAX_LEFT_LABEL_FRACTION_MEDIUM_MAX, type MapBorders, type MapEncoding, type MapFeatureMark, type MapFocus, type MapFocusLayout, type MapGeo, type MapLayout, type MapProjection, type MapSpec, type MapSpecWithoutData, type Margins, type Mark, type MarkAria, type MarkDef, type MarkEvent, type MarkType, type MeasureTextFn, type Metric, NARROW_VIEWPORT_MAX, type NodeOverride, type NumberFormatter, OFFSET_STRATEGIES, type OffsetStrategy, type PaginationState, type ParliamentEncoding, type Point, type PointEncoding, type PointMark, type RadialGradient, type RangeAnnotation, type RangeEncoding, type Rect, type RectEncoding, type RectMark, type RefLineAnnotation, type RelativeTimeRef, type ResolveConfig, type ResolveMode, type ResolvedAnimation, type ResolvedAnimationPhase, type ResolvedAnnotation, type ResolvedChrome, type ResolvedChromeElement, type ResolvedColumn, type ResolvedFillPattern, type ResolvedLabel, type ResolvedMetricBar, type ResolvedMetricCell, type ResolvedSeriesSearch, type ResolvedTheme, type ResolvedYouDrawIt, type ResponsiveConfig, type RuleMarkLayout, SEQUENTIAL_PALETTES, SUPPORTED_SCHEME_NAMES, type SankeyEncoding, type SankeyLayout, type SankeyLinkColor, type SankeyLinkMark, type SankeyNodeAlign, type SankeyNodeMark, type SankeySpec, type SankeySpecWithoutData, type ScaleConfig, type ScaleType, type SequentialPalette, type SeriesSearchConfig, type SeriesStrategy, type SeriesStyle, type SizeLegendCircle, type SizeLegendLayout, type SortByField, type SortState, type SparklineColumnConfig, type SparklineData, type SparklineTableCell, type StoredVizSpec, TICK_LABEL_OFFSET, TICK_LINE_HEIGHT_FACTOR, TOP_PAD_EXTRA_NARROW, TOP_PAD_NARROW_MAX, type TableBuilderOptions, type TableCell, type TableCellBase, type TableLayout, type TableRow, type TableSpec, type TableSpecWithoutData, type TextAnnotation, type TextEncoding, type TextMarkLayout, type TextStyle, type TextTableCell, type Theme, type ThemeChromeDefaults, type ThemeColors, type ThemeConfig, type ThemeFontSizes, type ThemeFontWeights, type ThemeFonts, type ThemeSpacing, type TickEncoding, type TickMarkLayout, type TileMapBuilderOptions, type TileMapEncoding, type TileMapLayout, type TileMapPalette, type TileMapSpec, type TileMapSpecWithoutData, type TileMapTileMark, type TimeUnit, type TimeUnitTransform, type TokenValue, type TooltipContent, type TooltipField, type Transform, type ValueDef, type VizSpec, type WaffleEncoding, type WindowFieldDef, type WindowOp, type WindowSortField, type WindowTransform, type XAxisExtentInput, X_AXIS_BAND_HEIGHT, X_AXIS_ROTATED_EXTENT_CAP, X_AXIS_TITLE_BAND, X_AXIS_TITLE_BAND_ROTATED, type YouDrawItConfig, type YouDrawItSample, type YouDrawItYInvert, abbreviateNumber, adaptColorForDarkMode, adaptForLightLineStroke, adaptTheme, areaChart, axisTitleOffset, barChart, buildCompactStepFormatter, buildD3Formatter, buildTemporalFormatter, checkPaletteDistinguishability, columnChart, computeChrome, computeFieldFormatContext, computeLabelBounds, computeXAxisExtentFromLabels, contrastRatio, cssTokenDefault, dataTable, deepMergeSpec, defaultNumberFormatter, detectCollision, donutChart, dotChart, editorial, elementRef, essay, estimateTextWidth, findAccessibleColor, footnoteBandHeight, formatCurrency, formatDate, formatNumber, formatOrdinal, formatPercent, generateAltText, generateAriaLabels, generateDataTable, getAxisTitleOffset, getBreakpoint, getHeightClass, getLayoutStrategy, getRepresentativeColor, heuristicMeasure, inferFieldType, isAxislessMark, isBarListSpec, isChartSpec, isConditionalDef, isEncodingChannel, isGradientDef, isGraphSpec, isLayerSpec, isMapSpec, isOpaqueColor, isRangeAnnotation, isRefLineAnnotation, isSankeySpec, isTableSpec, isTextAnnotation, isTileMapSpec, isValueDef, isYearContext, lineChart, maxRotatedLabelWidth, meetsAA, overlapArea, pickLabelColor, pieChart, resolveCollisions, resolveMarkDef, resolveMarkType, resolveMeasurer, resolveNumberFormatter, resolveSchemeName, resolveTheme, scatterChart, simulateColorBlindness, textAscent, tileMap, truncateRotatedLabel, wire, wrapText };
|
|
5990
|
+
export { type A11yConfig, type A11yMetadata, ACHROMATIC_RAMP, AXIS_TITLE_GAP, AXIS_TITLE_OFFSET_COMPACT, AXIS_TITLE_OFFSET_DEFAULT, AXIS_TITLE_TRAILING_PAD, type AggregateOp, type AggregateTransform, type AnimationConfig, type AnimationEase, type AnimationPhaseConfig, type AnimationSpec, type AnimationStagger, type Annotation, type AnnotationAnchor, type AnnotationFootnote, type AnnotationOffset, type AnnotationPosition, type ArcEncoding, type ArcMark, type AreaEncoding, type AreaMark, type AxisConfig, type AxisLabelDensity, type AxisLayout, type AxisTick, BRAND_FONT_SIZE, BRAND_MIN_WIDTH, BRAND_RESERVE_WIDTH, BREAKPOINT_COMPACT_MAX, BREAKPOINT_MEDIUM_MAX, type BarColumnConfig, type BarEncoding, type BarListEncoding, type BarListLayout, type BarListRowMark, type BarListSpec, type BarListSpecWithoutData, type BarTableCell, type BaseLegendLayout, type BeeswarmEncoding, type BinParams, type BinTransform, type Breakpoint, CATEGORICAL_PALETTE, COMPACT_WIDTH, CSS_TOKENS, CSS_TOKEN_ROOT_SELECTORS, type CalculateExpression, type CalculateTransform, type CalendarEncoding, type CategoricalLegendLayout, type CategoricalPalette, type CategoryColorsConfig, type CategoryTableCell, type CellStyle, type ChannelRule, type ChartBuilderOptions, type ChartEventHandlers, type ChartLayout, type ChartSpec, type ChartSpecOverride, type ChartSpecWithoutData, type Chrome, type ChromeDefaults, type ChromeKey, type ChromeMode, type ChromeText, type ChromeTextStyle, type ChromeThemeOverride, type CircleEncoding, type ColorBlindnessType, type ColumnConfig, type CompileOptions, type CompileTableOptions, type CompileWarning, type Condition, type ConditionalValueDef, type ConnectorConfig, type ConnectorType, type ContinuousLegendBin, type ContinuousLegendLayout, type ContinuousLegendTick, type CssTokenDef, DEFAULT_THEME, DIVERGING_PALETTES, type DarkMode, type DataRow, type DateGranularity, type Display, type DivergingPalette, EXTENDED_OFFSET_STRATEGIES, type ElementEdit, type ElementRef, type Encoding, type EncodingChannel, type EncodingRule, type EndpointLabelContent, type EndpointLabelEntry, type EndpointLabelsConfig, type EndpointLabelsLayout, FOOTNOTE_LINE_HEIGHT, type FacetChannel, type FacetLayout, type FacetPanelLayout, type FieldFormatContext, type FieldPredicate, type FieldRef, type FieldType, type FillPatternType, type FilterPredicate, type FilterTransform, type FlagTableCell, type FoldTransform, GRAPH_ENCODING_RULES, type GradientColorStop, type GradientDef, type GradientLegendLayout, type GradientStop, type GraphChannelRule, type GraphEdge, type GraphEdgeLayout, type GraphEncoding, type GraphEncodingChannel, type GraphLayout, type GraphLayoutConfig, type GraphNode, type GraphNodeLayout, type GraphSpec, type GraphSpecWithoutData, type Gridline, HEIGHT_CRAMPED_MAX, HEIGHT_SHORT_MAX, HPAD_COMPACT_FRACTION, HPAD_COMPACT_MIN, type HeatmapColumnConfig, type HeatmapTableCell, type HeightClass, type ImageColumnConfig, type ImageTableCell, LABEL_GAP_COMPACT, LABEL_GAP_DEFAULT, LABEL_GAP_NARROW_MAX, type LabelCandidate, type LabelConfig, type LabelDensity, type LabelMode, type LabelPriority, type LabelSpec, type LayerSpec, type LayoutStrategy, type LegendChannel, type LegendConfig, type LegendEntry, type LegendEntryPosition, type LegendLayout, type LegendPosition, type LineEncoding, type LineMark, type LinearGradient, type LogicalAnd, type LogicalNot, type LogicalOr, type LollipopEncoding, MARK_DISPLAY_NAMES, MARK_ENCODING_RULES, MARK_TYPES, MAX_LEFT_LABEL_FRACTION_COMPACT, MAX_LEFT_LABEL_FRACTION_DEFAULT, MAX_LEFT_LABEL_FRACTION_MEDIUM, MAX_LEFT_LABEL_FRACTION_MEDIUM_MAX, type MapBorders, type MapEncoding, type MapFeatureMark, type MapFocus, type MapFocusLayout, type MapGeo, type MapLayout, type MapPointMark, type MapPointsLayer, type MapProjection, type MapSpec, type MapSpecWithoutData, type Margins, type Mark, type MarkAria, type MarkDef, type MarkEvent, type MarkType, type MeasureTextFn, type Metric, NARROW_VIEWPORT_MAX, type NodeOverride, type NumberFormatter, OFFSET_STRATEGIES, type OffsetStrategy, type PaginationState, type ParliamentEncoding, type Point, type PointEncoding, type PointMark, type RadialGradient, type RangeAnnotation, type RangeEncoding, type Rect, type RectEncoding, type RectMark, type RefLineAnnotation, type RelativeTimeRef, type ResolveConfig, type ResolveMode, type ResolvedAnimation, type ResolvedAnimationPhase, type ResolvedAnnotation, type ResolvedChrome, type ResolvedChromeElement, type ResolvedColumn, type ResolvedFillPattern, type ResolvedLabel, type ResolvedMetricBar, type ResolvedMetricCell, type ResolvedSeriesSearch, type ResolvedTheme, type ResolvedYouDrawIt, type ResponsiveConfig, type RuleMarkLayout, SEQUENTIAL_PALETTES, SUPPORTED_SCHEME_NAMES, type SankeyEncoding, type SankeyLayout, type SankeyLinkColor, type SankeyLinkMark, type SankeyNodeAlign, type SankeyNodeMark, type SankeySpec, type SankeySpecWithoutData, type ScaleConfig, type ScaleInvert, type ScaleType, type SequentialPalette, type SeriesSearchConfig, type SeriesStrategy, type SeriesStyle, type SizeLegendCircle, type SizeLegendLayout, type SortByField, type SortState, type SparklineColumnConfig, type SparklineData, type SparklineTableCell, type StoredVizSpec, TICK_LABEL_OFFSET, TICK_LINE_HEIGHT_FACTOR, TOP_PAD_EXTRA_NARROW, TOP_PAD_NARROW_MAX, type TableBuilderOptions, type TableCell, type TableCellBase, type TableLayout, type TableRow, type TableSpec, type TableSpecWithoutData, type TextAnnotation, type TextEncoding, type TextMarkLayout, type TextStyle, type TextTableCell, type Theme, type ThemeChromeDefaults, type ThemeColors, type ThemeConfig, type ThemeFontSizes, type ThemeFontWeights, type ThemeFonts, type ThemeSpacing, type TickEncoding, type TickMarkLayout, type TileMapBuilderOptions, type TileMapEncoding, type TileMapLayout, type TileMapPalette, type TileMapSpec, type TileMapSpecWithoutData, type TileMapTileMark, type TimeUnit, type TimeUnitTransform, type TokenValue, type TooltipContent, type TooltipField, type Transform, type ValueDef, type VizSpec, type WaffleEncoding, type WindowFieldDef, type WindowOp, type WindowSortField, type WindowTransform, type XAxisExtentInput, X_AXIS_BAND_HEIGHT, X_AXIS_ROTATED_EXTENT_CAP, X_AXIS_TITLE_BAND, X_AXIS_TITLE_BAND_ROTATED, type YouDrawItConfig, type YouDrawItSample, type YouDrawItYInvert, abbreviateNumber, adaptColorForDarkMode, adaptForLightLineStroke, adaptTheme, areaChart, axisTitleOffset, barChart, buildCompactStepFormatter, buildD3Formatter, buildTemporalFormatter, checkPaletteDistinguishability, columnChart, computeChrome, computeFieldFormatContext, computeLabelBounds, computeXAxisExtentFromLabels, contrastRatio, cssTokenDefault, dataTable, deepMergeSpec, defaultNumberFormatter, detectCollision, donutChart, dotChart, editorial, elementRef, essay, estimateTextWidth, findAccessibleColor, footnoteBandHeight, formatCurrency, formatDate, formatNumber, formatOrdinal, formatPercent, generateAltText, generateAriaLabels, generateDataTable, getAxisTitleOffset, getBreakpoint, getHeightClass, getLayoutStrategy, getRepresentativeColor, heuristicMeasure, inferFieldType, isAxislessMark, isBarListSpec, isChartSpec, isConditionalDef, isEncodingChannel, isGradientDef, isGraphSpec, isLayerSpec, isMapSpec, isOpaqueColor, isRangeAnnotation, isRefLineAnnotation, isSankeySpec, isTableSpec, isTextAnnotation, isTileMapSpec, isValueDef, isYearContext, lineChart, maxRotatedLabelWidth, meetsAA, overlapArea, pickLabelColor, pieChart, resolveCollisions, resolveMarkDef, resolveMarkType, resolveMeasurer, resolveNumberFormatter, resolveSchemeName, resolveTheme, scatterChart, simulateColorBlindness, textAscent, tileMap, truncateRotatedLabel, wire, wrapText };
|
package/dist/index.js
CHANGED
|
@@ -187,14 +187,31 @@ var GRAPH_ENCODING_RULES = {
|
|
|
187
187
|
|
|
188
188
|
// src/types/events.ts
|
|
189
189
|
var elementRef = {
|
|
190
|
-
annotation: (index, id) => ({
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
190
|
+
annotation: (index, id, path) => ({
|
|
191
|
+
type: "annotation",
|
|
192
|
+
index,
|
|
193
|
+
...id !== void 0 ? { id } : {},
|
|
194
|
+
...path !== void 0 ? { path } : {}
|
|
195
|
+
}),
|
|
196
|
+
chrome: (key, path) => ({
|
|
197
|
+
type: "chrome",
|
|
198
|
+
key,
|
|
199
|
+
...path !== void 0 ? { path } : {}
|
|
200
|
+
}),
|
|
201
|
+
seriesLabel: (series, path) => ({
|
|
202
|
+
type: "series-label",
|
|
203
|
+
series,
|
|
204
|
+
...path !== void 0 ? { path } : {}
|
|
205
|
+
}),
|
|
206
|
+
legend: (path) => ({
|
|
207
|
+
type: "legend",
|
|
208
|
+
...path !== void 0 ? { path } : {}
|
|
209
|
+
}),
|
|
210
|
+
legendEntry: (series, index, path) => ({
|
|
195
211
|
type: "legend-entry",
|
|
196
212
|
series,
|
|
197
|
-
index
|
|
213
|
+
index,
|
|
214
|
+
...path !== void 0 ? { path } : {}
|
|
198
215
|
})
|
|
199
216
|
};
|
|
200
217
|
|
|
@@ -1342,7 +1359,9 @@ function computeXAxisExtentFromLabels(input) {
|
|
|
1342
1359
|
);
|
|
1343
1360
|
return input.hasTitle ? rotatedHeight + X_AXIS_TITLE_BAND_ROTATED : rotatedHeight;
|
|
1344
1361
|
}
|
|
1345
|
-
|
|
1362
|
+
const tickExtent = 4 + input.tickFontSize + Math.max(11, Math.ceil(input.tickFontSize * 0.7));
|
|
1363
|
+
const flatHeight = Math.max(baseHeight, tickExtent);
|
|
1364
|
+
return input.hasTitle ? flatHeight + X_AXIS_TITLE_BAND : flatHeight;
|
|
1346
1365
|
}
|
|
1347
1366
|
function maxRotatedLabelWidth(tickAngle, tickFontSize) {
|
|
1348
1367
|
const angleRad = Math.abs(tickAngle) * (Math.PI / 180);
|