@graphysdk/viz-engine 0.0.1-alpha.4 → 0.0.1-alpha.5
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.cjs +2 -2
- package/dist/index.d.ts +56 -12
- package/dist/index.mjs +1833 -1760
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export declare interface AesMapping {
|
|
|
9
9
|
alpha?: AestheticValue;
|
|
10
10
|
group?: AestheticValue;
|
|
11
11
|
strokeWidth?: AestheticValue;
|
|
12
|
+
lineType?: AestheticValue;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
export declare type AestheticKey = keyof AesMapping;
|
|
@@ -114,7 +115,6 @@ declare function area(options?: GeomOptions<'area'>): LayerInputOf<'area'>;
|
|
|
114
115
|
*/
|
|
115
116
|
export declare interface AreaGeomParams {
|
|
116
117
|
lineWidth: number | 'auto';
|
|
117
|
-
lineType: LineStyleType;
|
|
118
118
|
interpolate: InterpolateType;
|
|
119
119
|
missingValues: MissingValuesType;
|
|
120
120
|
}
|
|
@@ -323,6 +323,19 @@ export declare interface CartesianCoordSystem {
|
|
|
323
323
|
|
|
324
324
|
declare type CategoricalDataValue = string | null;
|
|
325
325
|
|
|
326
|
+
declare interface CategoricalScaleMethods<RangeValue extends number | string> {
|
|
327
|
+
/**
|
|
328
|
+
* Discrete (categorical) scale. Supports explicit `range` values.
|
|
329
|
+
* @example scale.lineType.discrete({ range: ['solid', 'dashed', 'dotted'] })
|
|
330
|
+
*/
|
|
331
|
+
discrete: (options?: DiscreteScaleOptions<RangeValue>) => DiscreteScaleInput;
|
|
332
|
+
/**
|
|
333
|
+
* Identity scale — data values used directly as visual values without transformation.
|
|
334
|
+
* @example scale.lineType.identity() // observation['lineType'] passed through
|
|
335
|
+
*/
|
|
336
|
+
identity: (options?: IdentityScaleOptions) => IdentityScaleInput;
|
|
337
|
+
}
|
|
338
|
+
|
|
326
339
|
declare interface CategoricalValueFormat {
|
|
327
340
|
type: 'text';
|
|
328
341
|
}
|
|
@@ -646,6 +659,8 @@ export declare interface CompiledLegendGuide {
|
|
|
646
659
|
items: LegendItem[];
|
|
647
660
|
/** Resolved format descriptor shared by all items in this legend */
|
|
648
661
|
valueFormat: ValueFormat;
|
|
662
|
+
/** Visual signature of the geom this legend describes */
|
|
663
|
+
swatchShape: SwatchShape;
|
|
649
664
|
}
|
|
650
665
|
|
|
651
666
|
export declare interface CompiledPanel {
|
|
@@ -1376,11 +1391,11 @@ declare interface DiscreteScaleInput {
|
|
|
1376
1391
|
padding?: number | null;
|
|
1377
1392
|
}
|
|
1378
1393
|
|
|
1379
|
-
declare type DiscreteScaleOptions = {
|
|
1394
|
+
declare type DiscreteScaleOptions<RangeValue extends number | string = number | string> = {
|
|
1380
1395
|
/**
|
|
1381
1396
|
* Explicit output values mapped to domain categories in order.
|
|
1382
1397
|
*/
|
|
1383
|
-
range?:
|
|
1398
|
+
range?: RangeValue[];
|
|
1384
1399
|
/**
|
|
1385
1400
|
* Sort order for discrete domain values.
|
|
1386
1401
|
* @default 'none'
|
|
@@ -1567,6 +1582,12 @@ export declare function getCrossAxisCoordinate(mainAxis: MainAxis, point: XYPoin
|
|
|
1567
1582
|
|
|
1568
1583
|
export declare const getGroup: (observation: Observation) => CategoricalDataValue;
|
|
1569
1584
|
|
|
1585
|
+
/**
|
|
1586
|
+
* Reads the resolved line type (stroke style) from an observation.
|
|
1587
|
+
* Falls back to `'solid'` when no `lineType` variable was derived.
|
|
1588
|
+
*/
|
|
1589
|
+
export declare function getLineType(observation: Observation): LineStyleType;
|
|
1590
|
+
|
|
1570
1591
|
/** Reads the coordinate lying on the main (independent) axis of the coord system. */
|
|
1571
1592
|
export declare function getMainAxisCoordinate(mainAxis: MainAxis, point: XYPoint): number;
|
|
1572
1593
|
|
|
@@ -2267,16 +2288,23 @@ declare type LegendDisplay = 'pill' | 'direct' | 'auto';
|
|
|
2267
2288
|
export declare interface LegendItem {
|
|
2268
2289
|
/** Raw data value (e.g., "Apples") */
|
|
2269
2290
|
value: DataValue;
|
|
2270
|
-
/**
|
|
2271
|
-
|
|
2272
|
-
* An array signals multi-swatch rendering — used when a color scale is
|
|
2273
|
-
* collapsed into a single legend item.
|
|
2274
|
-
*/
|
|
2275
|
-
visual: Partial<Record<ScaledVisualAestheticKey, string | string[]>>;
|
|
2291
|
+
/** Mapped visual values per aesthetic (e.g., { color: '#ff0000' }). */
|
|
2292
|
+
visual: LegendItemVisual;
|
|
2276
2293
|
/** Normalized y position in [0,1]. Null when display is not 'direct' or no endpoint found. */
|
|
2277
2294
|
normalizedY: number | null;
|
|
2278
2295
|
}
|
|
2279
2296
|
|
|
2297
|
+
/**
|
|
2298
|
+
* Visual values produced by a legend's scales, keyed by aesthetic.
|
|
2299
|
+
*/
|
|
2300
|
+
declare interface LegendItemVisual {
|
|
2301
|
+
color?: string | string[];
|
|
2302
|
+
size?: DataValue | DataValue[];
|
|
2303
|
+
alpha?: DataValue | DataValue[];
|
|
2304
|
+
strokeWidth?: DataValue | DataValue[];
|
|
2305
|
+
lineType?: LineStyleType | LineStyleType[];
|
|
2306
|
+
}
|
|
2307
|
+
|
|
2280
2308
|
export declare type LegendPosition = 'auto' | 'right' | 'left' | 'top' | 'bottom' | 'none';
|
|
2281
2309
|
|
|
2282
2310
|
declare function line(options?: GeomOptions<'line'>): LayerInputOf<'line'>;
|
|
@@ -2286,7 +2314,6 @@ declare function line(options?: GeomOptions<'line'>): LayerInputOf<'line'>;
|
|
|
2286
2314
|
*/
|
|
2287
2315
|
export declare interface LineGeomParams {
|
|
2288
2316
|
lineWidth: number | 'auto';
|
|
2289
|
-
lineType: LineStyleType;
|
|
2290
2317
|
/**
|
|
2291
2318
|
* Interpolation method to use for the line.
|
|
2292
2319
|
* @default 'linear'
|
|
@@ -2861,6 +2888,13 @@ declare interface ScaleAPI {
|
|
|
2861
2888
|
* @example scale.strokeWidth.identity() // use data values directly as px
|
|
2862
2889
|
*/
|
|
2863
2890
|
strokeWidth: QuantitativeScaleMethods;
|
|
2891
|
+
/**
|
|
2892
|
+
* Line type (stroke style) scale. Discrete-only — interpolation between dash
|
|
2893
|
+
* patterns is not meaningful. Mapping `lineType` to a numeric variable errors
|
|
2894
|
+
* at compile time.
|
|
2895
|
+
* @example scale.lineType.discrete({ domain: ['actual', 'forecast'], range: ['solid', 'dashed'] })
|
|
2896
|
+
*/
|
|
2897
|
+
lineType: CategoricalScaleMethods<LineStyleType>;
|
|
2864
2898
|
}
|
|
2865
2899
|
|
|
2866
2900
|
/**
|
|
@@ -2910,7 +2944,7 @@ export declare type ScaledAestheticKey = ScaledPositionAestheticKey | ScaledVisu
|
|
|
2910
2944
|
|
|
2911
2945
|
declare type ScaledPositionAestheticKey = 'x' | 'y' | 'ySecondary';
|
|
2912
2946
|
|
|
2913
|
-
declare type ScaledVisualAestheticKey = 'color' | 'size' | 'alpha' | 'strokeWidth';
|
|
2947
|
+
declare type ScaledVisualAestheticKey = 'color' | 'size' | 'alpha' | 'strokeWidth' | 'lineType';
|
|
2914
2948
|
|
|
2915
2949
|
/**
|
|
2916
2950
|
* Union type for all possible scale specifications (including inferred, pre-resolution).
|
|
@@ -3179,7 +3213,14 @@ declare class StatRegistry extends Registry<StatName, Stat> {
|
|
|
3179
3213
|
}
|
|
3180
3214
|
|
|
3181
3215
|
/**
|
|
3182
|
-
* Visual signature of
|
|
3216
|
+
* Visual signature of a geom, decoupled from `GeomName` because legends and tooltips don't care
|
|
3217
|
+
* about the geom's spec-level identity — only what shape best evokes its on-canvas mark.
|
|
3218
|
+
*
|
|
3219
|
+
* - `bar` + cartesian → `square`
|
|
3220
|
+
* - `bar` + polar → `slice` (pie / donut wedge)
|
|
3221
|
+
* - `line` → `line` (a horizontal stroke)
|
|
3222
|
+
* - `area` → `area` (filled region with a stroke accent)
|
|
3223
|
+
* - `point` → `circle`
|
|
3183
3224
|
*/
|
|
3184
3225
|
export declare type SwatchShape = 'square' | 'line' | 'circle' | 'area' | 'slice';
|
|
3185
3226
|
|
|
@@ -3221,6 +3262,8 @@ export declare interface TooltipRow {
|
|
|
3221
3262
|
swatchColor: string | null;
|
|
3222
3263
|
/** Visual signature of the row's source geom. Drives the swatch shape. */
|
|
3223
3264
|
swatchShape: SwatchShape;
|
|
3265
|
+
/** Resolved stroke style for line/area swatches. Falls back to `'solid'` when not derived. */
|
|
3266
|
+
swatchLineType: LineStyleType;
|
|
3224
3267
|
/** Row label — color value (multi-series) or layer's Y-axis title (single-series). */
|
|
3225
3268
|
label: string;
|
|
3226
3269
|
/** Formatted Y reading for this hit. */
|
|
@@ -3335,6 +3378,7 @@ export declare const VISUAL_VARIABLES: {
|
|
|
3335
3378
|
readonly size: string;
|
|
3336
3379
|
readonly alpha: string;
|
|
3337
3380
|
readonly strokeWidth: string;
|
|
3381
|
+
readonly lineType: string;
|
|
3338
3382
|
};
|
|
3339
3383
|
|
|
3340
3384
|
/**
|