@fluentui/react-charts 9.3.12 → 9.3.14
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/CHANGELOG.md +25 -2
- package/dist/index.d.ts +859 -0
- package/lib/VegaDeclarativeChart.js +1 -0
- package/lib/VegaDeclarativeChart.js.map +1 -0
- package/lib/components/LineChart/LineChart.js +47 -7
- package/lib/components/LineChart/LineChart.js.map +1 -1
- package/lib/components/ScatterChart/ScatterChart.js +12 -12
- package/lib/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib/components/VegaDeclarativeChart/VegaDeclarativeChart.js +405 -0
- package/lib/components/VegaDeclarativeChart/VegaDeclarativeChart.js.map +1 -0
- package/lib/components/VegaDeclarativeChart/VegaDeclarativeChartHooks.js +20 -0
- package/lib/components/VegaDeclarativeChart/VegaDeclarativeChartHooks.js.map +1 -0
- package/lib/components/VegaDeclarativeChart/VegaLiteColorAdapter.js +415 -0
- package/lib/components/VegaDeclarativeChart/VegaLiteColorAdapter.js.map +1 -0
- package/lib/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.js +537 -0
- package/lib/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.js.map +1 -0
- package/lib/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.js +3279 -0
- package/lib/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.js.map +1 -0
- package/lib/components/VegaDeclarativeChart/VegaLiteTypes.js +28 -0
- package/lib/components/VegaDeclarativeChart/VegaLiteTypes.js.map +1 -0
- package/lib/components/VegaDeclarativeChart/index.js +1 -0
- package/lib/components/VegaDeclarativeChart/index.js.map +1 -0
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js +5 -2
- package/lib/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/utilities/utilities.js +41 -0
- package/lib/utilities/utilities.js.map +1 -1
- package/lib-commonjs/VegaDeclarativeChart.js +6 -0
- package/lib-commonjs/VegaDeclarativeChart.js.map +1 -0
- package/lib-commonjs/components/LineChart/LineChart.js +46 -6
- package/lib-commonjs/components/LineChart/LineChart.js.map +1 -1
- package/lib-commonjs/components/ScatterChart/ScatterChart.js +11 -11
- package/lib-commonjs/components/ScatterChart/ScatterChart.js.map +1 -1
- package/lib-commonjs/components/VegaDeclarativeChart/VegaDeclarativeChart.js +274 -0
- package/lib-commonjs/components/VegaDeclarativeChart/VegaDeclarativeChart.js.map +1 -0
- package/lib-commonjs/components/VegaDeclarativeChart/VegaDeclarativeChartHooks.js +35 -0
- package/lib-commonjs/components/VegaDeclarativeChart/VegaDeclarativeChartHooks.js.map +1 -0
- package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteColorAdapter.js +412 -0
- package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteColorAdapter.js.map +1 -0
- package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.js +533 -0
- package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteExpressionEvaluator.js.map +1 -0
- package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.js +3214 -0
- package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteSchemaAdapter.js.map +1 -0
- package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteTypes.js +31 -0
- package/lib-commonjs/components/VegaDeclarativeChart/VegaLiteTypes.js.map +1 -0
- package/lib-commonjs/components/VegaDeclarativeChart/index.js +6 -0
- package/lib-commonjs/components/VegaDeclarativeChart/index.js.map +1 -0
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js +4 -1
- package/lib-commonjs/components/VerticalStackedBarChart/VerticalStackedBarChart.js.map +1 -1
- package/lib-commonjs/index.js +1 -0
- package/lib-commonjs/index.js.map +1 -1
- package/lib-commonjs/utilities/utilities.js +33 -0
- package/lib-commonjs/utilities/utilities.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -4421,6 +4421,865 @@ declare interface TitleStyles {
|
|
|
4421
4421
|
};
|
|
4422
4422
|
}
|
|
4423
4423
|
|
|
4424
|
+
/**
|
|
4425
|
+
* VegaDeclarativeChart - Render Vega-Lite specifications with Fluent UI styling
|
|
4426
|
+
*
|
|
4427
|
+
* Supported chart types:
|
|
4428
|
+
* - Line charts: mark: 'line' or 'point'
|
|
4429
|
+
* - Area charts: mark: 'area'
|
|
4430
|
+
* - Scatter charts: mark: 'point', 'circle', or 'square'
|
|
4431
|
+
* - Vertical bar charts: mark: 'bar' with nominal/ordinal x-axis
|
|
4432
|
+
* - Stacked bar charts: mark: 'bar' with color encoding
|
|
4433
|
+
* - Grouped bar charts: mark: 'bar' with color encoding (via configuration)
|
|
4434
|
+
* - Horizontal bar charts: mark: 'bar' with nominal/ordinal y-axis
|
|
4435
|
+
* - Donut/Pie charts: mark: 'arc' with theta encoding
|
|
4436
|
+
* - Heatmaps: mark: 'rect' with x, y, and color (quantitative) encodings
|
|
4437
|
+
* - Combo charts: Layered specs with bar + line marks render as VerticalStackedBarChart with line overlays
|
|
4438
|
+
*
|
|
4439
|
+
* Multi-plot Support:
|
|
4440
|
+
* - Horizontal concatenation (hconcat): Multiple charts side-by-side
|
|
4441
|
+
* - Vertical concatenation (vconcat): Multiple charts stacked vertically
|
|
4442
|
+
* - Shared data and encoding are merged from parent spec to each subplot
|
|
4443
|
+
*
|
|
4444
|
+
* Limitations:
|
|
4445
|
+
* - Most layered specifications (multiple chart types) are not fully supported
|
|
4446
|
+
* - Bar + Line combinations ARE supported and will render properly
|
|
4447
|
+
* - For other composite charts, only the first layer will be rendered
|
|
4448
|
+
* - Faceting and repeat operators are not yet supported
|
|
4449
|
+
* - Funnel charts are not a native Vega-Lite mark type. The conversion_funnel.json example
|
|
4450
|
+
* uses a horizontal bar chart (y: nominal, x: quantitative) which is the standard way to
|
|
4451
|
+
* represent funnel data in Vega-Lite. For specialized funnel visualizations with tapering
|
|
4452
|
+
* shapes, consider using Plotly's native funnel chart type instead.
|
|
4453
|
+
*
|
|
4454
|
+
* Note: Sankey, Gantt, and Gauge charts are not standard Vega-Lite marks.
|
|
4455
|
+
* These specialized visualizations would require custom extensions or alternative approaches.
|
|
4456
|
+
*
|
|
4457
|
+
* @example Line Chart
|
|
4458
|
+
* ```tsx
|
|
4459
|
+
* import { VegaDeclarativeChart } from '@fluentui/react-charts';
|
|
4460
|
+
*
|
|
4461
|
+
* const spec = {
|
|
4462
|
+
* mark: 'line',
|
|
4463
|
+
* data: { values: [{ x: 1, y: 10 }, { x: 2, y: 20 }] },
|
|
4464
|
+
* encoding: {
|
|
4465
|
+
* x: { field: 'x', type: 'quantitative' },
|
|
4466
|
+
* y: { field: 'y', type: 'quantitative' }
|
|
4467
|
+
* }
|
|
4468
|
+
* };
|
|
4469
|
+
*
|
|
4470
|
+
* <VegaDeclarativeChart chartSchema={{ vegaLiteSpec: spec }} />
|
|
4471
|
+
* ```
|
|
4472
|
+
*
|
|
4473
|
+
* @example Area Chart
|
|
4474
|
+
* ```tsx
|
|
4475
|
+
* const areaSpec = {
|
|
4476
|
+
* mark: 'area',
|
|
4477
|
+
* data: { values: [{ date: '2023-01', value: 100 }, { date: '2023-02', value: 150 }] },
|
|
4478
|
+
* encoding: {
|
|
4479
|
+
* x: { field: 'date', type: 'temporal' },
|
|
4480
|
+
* y: { field: 'value', type: 'quantitative' }
|
|
4481
|
+
* }
|
|
4482
|
+
* };
|
|
4483
|
+
*
|
|
4484
|
+
* <VegaDeclarativeChart chartSchema={{ vegaLiteSpec: areaSpec }} />
|
|
4485
|
+
* ```
|
|
4486
|
+
*
|
|
4487
|
+
* @example Scatter Chart
|
|
4488
|
+
* ```tsx
|
|
4489
|
+
* const scatterSpec = {
|
|
4490
|
+
* mark: 'point',
|
|
4491
|
+
* data: { values: [{ x: 10, y: 20, size: 100 }, { x: 15, y: 30, size: 200 }] },
|
|
4492
|
+
* encoding: {
|
|
4493
|
+
* x: { field: 'x', type: 'quantitative' },
|
|
4494
|
+
* y: { field: 'y', type: 'quantitative' },
|
|
4495
|
+
* size: { field: 'size', type: 'quantitative' }
|
|
4496
|
+
* }
|
|
4497
|
+
* };
|
|
4498
|
+
*
|
|
4499
|
+
* <VegaDeclarativeChart chartSchema={{ vegaLiteSpec: scatterSpec }} />
|
|
4500
|
+
* ```
|
|
4501
|
+
*
|
|
4502
|
+
* @example Vertical Bar Chart
|
|
4503
|
+
* ```tsx
|
|
4504
|
+
* const barSpec = {
|
|
4505
|
+
* mark: 'bar',
|
|
4506
|
+
* data: { values: [{ cat: 'A', val: 28 }, { cat: 'B', val: 55 }] },
|
|
4507
|
+
* encoding: {
|
|
4508
|
+
* x: { field: 'cat', type: 'nominal' },
|
|
4509
|
+
* y: { field: 'val', type: 'quantitative' }
|
|
4510
|
+
* }
|
|
4511
|
+
* };
|
|
4512
|
+
*
|
|
4513
|
+
* <VegaDeclarativeChart chartSchema={{ vegaLiteSpec: barSpec }} />
|
|
4514
|
+
* ```
|
|
4515
|
+
*
|
|
4516
|
+
* @example Stacked Bar Chart
|
|
4517
|
+
* ```tsx
|
|
4518
|
+
* const stackedSpec = {
|
|
4519
|
+
* mark: 'bar',
|
|
4520
|
+
* data: { values: [
|
|
4521
|
+
* { cat: 'A', group: 'G1', val: 28 },
|
|
4522
|
+
* { cat: 'A', group: 'G2', val: 15 }
|
|
4523
|
+
* ]},
|
|
4524
|
+
* encoding: {
|
|
4525
|
+
* x: { field: 'cat', type: 'nominal' },
|
|
4526
|
+
* y: { field: 'val', type: 'quantitative' },
|
|
4527
|
+
* color: { field: 'group', type: 'nominal' }
|
|
4528
|
+
* }
|
|
4529
|
+
* };
|
|
4530
|
+
*
|
|
4531
|
+
* <VegaDeclarativeChart chartSchema={{ vegaLiteSpec: stackedSpec }} />
|
|
4532
|
+
* ```
|
|
4533
|
+
*
|
|
4534
|
+
* @example Donut Chart
|
|
4535
|
+
* ```tsx
|
|
4536
|
+
* const donutSpec = {
|
|
4537
|
+
* mark: 'arc',
|
|
4538
|
+
* data: { values: [{ category: 'A', value: 30 }, { category: 'B', value: 70 }] },
|
|
4539
|
+
* encoding: {
|
|
4540
|
+
* theta: { field: 'value', type: 'quantitative' },
|
|
4541
|
+
* color: { field: 'category', type: 'nominal' }
|
|
4542
|
+
* }
|
|
4543
|
+
* };
|
|
4544
|
+
*
|
|
4545
|
+
* <VegaDeclarativeChart chartSchema={{ vegaLiteSpec: donutSpec }} />
|
|
4546
|
+
* ```
|
|
4547
|
+
*
|
|
4548
|
+
* @example Heatmap
|
|
4549
|
+
* ```tsx
|
|
4550
|
+
* const heatmapSpec = {
|
|
4551
|
+
* mark: 'rect',
|
|
4552
|
+
* data: { values: [
|
|
4553
|
+
* { x: 'A', y: 'Mon', value: 28 },
|
|
4554
|
+
* { x: 'B', y: 'Mon', value: 55 },
|
|
4555
|
+
* { x: 'A', y: 'Tue', value: 43 }
|
|
4556
|
+
* ]},
|
|
4557
|
+
* encoding: {
|
|
4558
|
+
* x: { field: 'x', type: 'nominal' },
|
|
4559
|
+
* y: { field: 'y', type: 'nominal' },
|
|
4560
|
+
* color: { field: 'value', type: 'quantitative' }
|
|
4561
|
+
* }
|
|
4562
|
+
* };
|
|
4563
|
+
*
|
|
4564
|
+
* <VegaDeclarativeChart chartSchema={{ vegaLiteSpec: heatmapSpec }} />
|
|
4565
|
+
* ```
|
|
4566
|
+
*/
|
|
4567
|
+
export declare const VegaDeclarativeChart: React_2.ForwardRefExoticComponent<VegaDeclarativeChartProps & React_2.RefAttributes<HTMLDivElement>>;
|
|
4568
|
+
|
|
4569
|
+
/**
|
|
4570
|
+
* Props for VegaDeclarativeChart component
|
|
4571
|
+
*/
|
|
4572
|
+
export declare interface VegaDeclarativeChartProps {
|
|
4573
|
+
/**
|
|
4574
|
+
* Vega-Lite chart schema
|
|
4575
|
+
*/
|
|
4576
|
+
chartSchema: VegaSchema;
|
|
4577
|
+
/**
|
|
4578
|
+
* Callback when schema changes (e.g., legend selection)
|
|
4579
|
+
*/
|
|
4580
|
+
onSchemaChange?: (newSchema: VegaSchema) => void;
|
|
4581
|
+
/**
|
|
4582
|
+
* Additional CSS class name
|
|
4583
|
+
*/
|
|
4584
|
+
className?: string;
|
|
4585
|
+
/**
|
|
4586
|
+
* Additional inline styles
|
|
4587
|
+
*/
|
|
4588
|
+
style?: React_2.CSSProperties;
|
|
4589
|
+
}
|
|
4590
|
+
|
|
4591
|
+
/**
|
|
4592
|
+
* Vega-Lite axis configuration
|
|
4593
|
+
*/
|
|
4594
|
+
declare interface VegaLiteAxis {
|
|
4595
|
+
/**
|
|
4596
|
+
* Axis title
|
|
4597
|
+
*/
|
|
4598
|
+
title?: string | null;
|
|
4599
|
+
/**
|
|
4600
|
+
* Format string for axis tick labels
|
|
4601
|
+
* Uses d3-format for quantitative and d3-time-format for temporal
|
|
4602
|
+
*/
|
|
4603
|
+
format?: string;
|
|
4604
|
+
/**
|
|
4605
|
+
* Tick values to display
|
|
4606
|
+
*/
|
|
4607
|
+
values?: number[] | string[];
|
|
4608
|
+
/**
|
|
4609
|
+
* Number of ticks
|
|
4610
|
+
*/
|
|
4611
|
+
tickCount?: number;
|
|
4612
|
+
/**
|
|
4613
|
+
* Grid visibility
|
|
4614
|
+
*/
|
|
4615
|
+
grid?: boolean;
|
|
4616
|
+
}
|
|
4617
|
+
|
|
4618
|
+
/**
|
|
4619
|
+
* Vega-Lite binning configuration
|
|
4620
|
+
*/
|
|
4621
|
+
declare interface VegaLiteBin {
|
|
4622
|
+
/**
|
|
4623
|
+
* Maximum number of bins
|
|
4624
|
+
*/
|
|
4625
|
+
maxbins?: number;
|
|
4626
|
+
/**
|
|
4627
|
+
* Exact step size between bins
|
|
4628
|
+
*/
|
|
4629
|
+
step?: number;
|
|
4630
|
+
/**
|
|
4631
|
+
* Extent [min, max] for binning
|
|
4632
|
+
*/
|
|
4633
|
+
extent?: [number, number];
|
|
4634
|
+
/**
|
|
4635
|
+
* Base for nice bin values (e.g., 10 for powers of 10)
|
|
4636
|
+
*/
|
|
4637
|
+
base?: number;
|
|
4638
|
+
/**
|
|
4639
|
+
* Whether to include the boundary in bins
|
|
4640
|
+
*/
|
|
4641
|
+
anchor?: number;
|
|
4642
|
+
}
|
|
4643
|
+
|
|
4644
|
+
/**
|
|
4645
|
+
* Vega-Lite color encoding channel
|
|
4646
|
+
*/
|
|
4647
|
+
declare interface VegaLiteColorEncoding {
|
|
4648
|
+
/**
|
|
4649
|
+
* Field name for color differentiation
|
|
4650
|
+
*/
|
|
4651
|
+
field?: string;
|
|
4652
|
+
/**
|
|
4653
|
+
* Data type
|
|
4654
|
+
*/
|
|
4655
|
+
type?: VegaLiteType;
|
|
4656
|
+
/**
|
|
4657
|
+
* Legend configuration
|
|
4658
|
+
*/
|
|
4659
|
+
legend?: VegaLiteLegend | null;
|
|
4660
|
+
/**
|
|
4661
|
+
* Scale configuration
|
|
4662
|
+
*/
|
|
4663
|
+
scale?: VegaLiteScale | null;
|
|
4664
|
+
/**
|
|
4665
|
+
* Fixed color value
|
|
4666
|
+
*/
|
|
4667
|
+
value?: string;
|
|
4668
|
+
/**
|
|
4669
|
+
* Conditional color encoding with a test expression
|
|
4670
|
+
*/
|
|
4671
|
+
condition?: {
|
|
4672
|
+
test: string;
|
|
4673
|
+
value: string;
|
|
4674
|
+
};
|
|
4675
|
+
}
|
|
4676
|
+
|
|
4677
|
+
/**
|
|
4678
|
+
* Vega-Lite inline data
|
|
4679
|
+
*/
|
|
4680
|
+
declare interface VegaLiteData {
|
|
4681
|
+
/**
|
|
4682
|
+
* Inline data values (array of objects)
|
|
4683
|
+
*/
|
|
4684
|
+
values?: Array<Record<string, unknown>>;
|
|
4685
|
+
/**
|
|
4686
|
+
* URL to load data from
|
|
4687
|
+
* TODO: Implement remote data loading
|
|
4688
|
+
*/
|
|
4689
|
+
url?: string;
|
|
4690
|
+
/**
|
|
4691
|
+
* Named dataset reference
|
|
4692
|
+
* TODO: Implement named dataset resolution
|
|
4693
|
+
*/
|
|
4694
|
+
name?: string;
|
|
4695
|
+
/**
|
|
4696
|
+
* Data format specification
|
|
4697
|
+
* TODO: Implement format parsing (csv, json, etc.)
|
|
4698
|
+
*/
|
|
4699
|
+
format?: {
|
|
4700
|
+
type?: 'json' | 'csv' | 'tsv';
|
|
4701
|
+
parse?: Record<string, string>;
|
|
4702
|
+
};
|
|
4703
|
+
}
|
|
4704
|
+
|
|
4705
|
+
/**
|
|
4706
|
+
* Vega-Lite encoding channels
|
|
4707
|
+
*/
|
|
4708
|
+
declare interface VegaLiteEncoding {
|
|
4709
|
+
/**
|
|
4710
|
+
* X-axis encoding
|
|
4711
|
+
*/
|
|
4712
|
+
x?: VegaLitePositionEncoding;
|
|
4713
|
+
/**
|
|
4714
|
+
* Y-axis encoding
|
|
4715
|
+
*/
|
|
4716
|
+
y?: VegaLitePositionEncoding;
|
|
4717
|
+
/**
|
|
4718
|
+
* Color encoding for series differentiation
|
|
4719
|
+
*/
|
|
4720
|
+
color?: VegaLiteColorEncoding;
|
|
4721
|
+
/**
|
|
4722
|
+
* Size encoding for point marks
|
|
4723
|
+
*/
|
|
4724
|
+
size?: VegaLiteSizeEncoding;
|
|
4725
|
+
/**
|
|
4726
|
+
* Shape encoding for point marks
|
|
4727
|
+
*/
|
|
4728
|
+
shape?: VegaLiteShapeEncoding;
|
|
4729
|
+
/**
|
|
4730
|
+
* Theta encoding for pie/donut charts and polar coordinates
|
|
4731
|
+
*/
|
|
4732
|
+
theta?: VegaLiteThetaEncoding;
|
|
4733
|
+
/**
|
|
4734
|
+
* Radius encoding for polar charts
|
|
4735
|
+
*/
|
|
4736
|
+
radius?: VegaLiteRadiusEncoding;
|
|
4737
|
+
/**
|
|
4738
|
+
* X2 encoding for interval marks (rect, rule, bar with ranges)
|
|
4739
|
+
*/
|
|
4740
|
+
x2?: VegaLitePositionEncoding;
|
|
4741
|
+
/**
|
|
4742
|
+
* Y2 encoding for interval marks (rect, rule, bar with ranges)
|
|
4743
|
+
*/
|
|
4744
|
+
y2?: VegaLitePositionEncoding;
|
|
4745
|
+
/**
|
|
4746
|
+
* Text encoding for text marks
|
|
4747
|
+
*/
|
|
4748
|
+
text?: VegaLiteTextEncoding;
|
|
4749
|
+
/**
|
|
4750
|
+
* xOffset encoding for grouped bar charts
|
|
4751
|
+
*/
|
|
4752
|
+
xOffset?: VegaLitePositionEncoding;
|
|
4753
|
+
/**
|
|
4754
|
+
* Tooltip encoding (single field or array of fields)
|
|
4755
|
+
*/
|
|
4756
|
+
tooltip?: any;
|
|
4757
|
+
}
|
|
4758
|
+
|
|
4759
|
+
/**
|
|
4760
|
+
* Vega-Lite interpolation method
|
|
4761
|
+
*/
|
|
4762
|
+
declare type VegaLiteInterpolate = 'linear' | 'linear-closed' | 'step' | 'step-before' | 'step-after' | 'basis' | 'cardinal' | 'monotone' | 'natural';
|
|
4763
|
+
|
|
4764
|
+
/**
|
|
4765
|
+
* Vega-Lite legend configuration
|
|
4766
|
+
*/
|
|
4767
|
+
declare interface VegaLiteLegend {
|
|
4768
|
+
/**
|
|
4769
|
+
* Legend title
|
|
4770
|
+
*/
|
|
4771
|
+
title?: string | null;
|
|
4772
|
+
/**
|
|
4773
|
+
* Hide the legend
|
|
4774
|
+
*/
|
|
4775
|
+
disable?: boolean;
|
|
4776
|
+
}
|
|
4777
|
+
|
|
4778
|
+
/**
|
|
4779
|
+
* Vega-Lite mark types
|
|
4780
|
+
*/
|
|
4781
|
+
declare type VegaLiteMark = 'line' | 'point' | 'circle' | 'square' | 'bar' | 'area' | 'rect' | 'rule' | 'text' | 'arc';
|
|
4782
|
+
|
|
4783
|
+
/**
|
|
4784
|
+
* Vega-Lite mark definition (can be string or object)
|
|
4785
|
+
*/
|
|
4786
|
+
declare type VegaLiteMarkDef = VegaLiteMark | {
|
|
4787
|
+
type: VegaLiteMark;
|
|
4788
|
+
/**
|
|
4789
|
+
* Mark color
|
|
4790
|
+
*/
|
|
4791
|
+
color?: string;
|
|
4792
|
+
/**
|
|
4793
|
+
* Line interpolation method
|
|
4794
|
+
*/
|
|
4795
|
+
interpolate?: VegaLiteInterpolate;
|
|
4796
|
+
/**
|
|
4797
|
+
* Point marker visibility
|
|
4798
|
+
*/
|
|
4799
|
+
point?: boolean | {
|
|
4800
|
+
filled?: boolean;
|
|
4801
|
+
size?: number;
|
|
4802
|
+
};
|
|
4803
|
+
/**
|
|
4804
|
+
* Stroke width
|
|
4805
|
+
*/
|
|
4806
|
+
strokeWidth?: number;
|
|
4807
|
+
/**
|
|
4808
|
+
* Stroke dash pattern (e.g., [5, 5] for dashed, [2, 2] for dotted)
|
|
4809
|
+
*/
|
|
4810
|
+
strokeDash?: number[];
|
|
4811
|
+
/**
|
|
4812
|
+
* Fill opacity
|
|
4813
|
+
*/
|
|
4814
|
+
fillOpacity?: number;
|
|
4815
|
+
/**
|
|
4816
|
+
* Stroke opacity
|
|
4817
|
+
*/
|
|
4818
|
+
strokeOpacity?: number;
|
|
4819
|
+
/**
|
|
4820
|
+
* Overall opacity
|
|
4821
|
+
*/
|
|
4822
|
+
opacity?: number;
|
|
4823
|
+
/**
|
|
4824
|
+
* Inner radius for arc/pie/donut marks (0-1 or pixel value)
|
|
4825
|
+
*/
|
|
4826
|
+
innerRadius?: number;
|
|
4827
|
+
/**
|
|
4828
|
+
* Outer radius for arc/pie marks (pixel value)
|
|
4829
|
+
*/
|
|
4830
|
+
outerRadius?: number;
|
|
4831
|
+
};
|
|
4832
|
+
|
|
4833
|
+
/**
|
|
4834
|
+
* Vega-Lite position encoding channel (x or y)
|
|
4835
|
+
*/
|
|
4836
|
+
declare interface VegaLitePositionEncoding {
|
|
4837
|
+
/**
|
|
4838
|
+
* Field name in data
|
|
4839
|
+
*/
|
|
4840
|
+
field?: string;
|
|
4841
|
+
/**
|
|
4842
|
+
* Data type
|
|
4843
|
+
*/
|
|
4844
|
+
type?: VegaLiteType;
|
|
4845
|
+
/**
|
|
4846
|
+
* Axis configuration
|
|
4847
|
+
*/
|
|
4848
|
+
axis?: VegaLiteAxis | null;
|
|
4849
|
+
/**
|
|
4850
|
+
* Constant value for encoding (for reference lines and annotations)
|
|
4851
|
+
*/
|
|
4852
|
+
value?: number | string | Date;
|
|
4853
|
+
/**
|
|
4854
|
+
* Datum value for encoding (alternative to value)
|
|
4855
|
+
*/
|
|
4856
|
+
datum?: number | string | Date;
|
|
4857
|
+
/**
|
|
4858
|
+
* Scale configuration
|
|
4859
|
+
*/
|
|
4860
|
+
scale?: VegaLiteScale | null;
|
|
4861
|
+
/**
|
|
4862
|
+
* Sort order for categorical axes
|
|
4863
|
+
* Supports: 'ascending', 'descending', null, array of values, or object with field/op/order
|
|
4864
|
+
*/
|
|
4865
|
+
sort?: VegaLiteSort;
|
|
4866
|
+
/**
|
|
4867
|
+
* Binning configuration for histograms
|
|
4868
|
+
* Set to true for default binning or provide custom bin parameters
|
|
4869
|
+
*/
|
|
4870
|
+
bin?: boolean | VegaLiteBin;
|
|
4871
|
+
/**
|
|
4872
|
+
* Stack configuration for area/bar charts
|
|
4873
|
+
* - null: disable stacking
|
|
4874
|
+
* - 'zero': stack from zero baseline (default for area charts)
|
|
4875
|
+
* - 'center': center stack
|
|
4876
|
+
* - 'normalize': normalize to 100%
|
|
4877
|
+
*/
|
|
4878
|
+
stack?: null | 'zero' | 'center' | 'normalize';
|
|
4879
|
+
/**
|
|
4880
|
+
* Aggregate function
|
|
4881
|
+
*/
|
|
4882
|
+
aggregate?: 'count' | 'sum' | 'mean' | 'average' | 'median' | 'min' | 'max';
|
|
4883
|
+
/**
|
|
4884
|
+
* Axis title (shorthand alternative to axis.title)
|
|
4885
|
+
*/
|
|
4886
|
+
title?: string;
|
|
4887
|
+
/**
|
|
4888
|
+
* Time unit for temporal fields (e.g., 'yearmonth', 'month', 'day')
|
|
4889
|
+
*/
|
|
4890
|
+
timeUnit?: string;
|
|
4891
|
+
}
|
|
4892
|
+
|
|
4893
|
+
/**
|
|
4894
|
+
* Vega-Lite radius encoding channel for polar charts
|
|
4895
|
+
*/
|
|
4896
|
+
declare interface VegaLiteRadiusEncoding {
|
|
4897
|
+
/**
|
|
4898
|
+
* Field name
|
|
4899
|
+
*/
|
|
4900
|
+
field?: string;
|
|
4901
|
+
/**
|
|
4902
|
+
* Data type
|
|
4903
|
+
*/
|
|
4904
|
+
type?: VegaLiteType;
|
|
4905
|
+
/**
|
|
4906
|
+
* Aggregate function
|
|
4907
|
+
*/
|
|
4908
|
+
aggregate?: 'count' | 'sum' | 'mean' | 'average' | 'median' | 'min' | 'max';
|
|
4909
|
+
/**
|
|
4910
|
+
* Axis configuration
|
|
4911
|
+
*/
|
|
4912
|
+
axis?: VegaLiteAxis | null;
|
|
4913
|
+
/**
|
|
4914
|
+
* Scale configuration
|
|
4915
|
+
*/
|
|
4916
|
+
scale?: VegaLiteScale | null;
|
|
4917
|
+
}
|
|
4918
|
+
|
|
4919
|
+
/**
|
|
4920
|
+
* Vega-Lite scale configuration
|
|
4921
|
+
*/
|
|
4922
|
+
declare interface VegaLiteScale {
|
|
4923
|
+
/**
|
|
4924
|
+
* Scale type
|
|
4925
|
+
*/
|
|
4926
|
+
type?: VegaLiteScaleType;
|
|
4927
|
+
/**
|
|
4928
|
+
* Domain values [min, max]
|
|
4929
|
+
*/
|
|
4930
|
+
domain?: (number | string)[];
|
|
4931
|
+
/**
|
|
4932
|
+
* Range values [min, max]
|
|
4933
|
+
*/
|
|
4934
|
+
range?: [number | string, number | string] | string[];
|
|
4935
|
+
/**
|
|
4936
|
+
* Color scheme name (e.g., 'category10', 'tableau10')
|
|
4937
|
+
*/
|
|
4938
|
+
scheme?: string;
|
|
4939
|
+
/**
|
|
4940
|
+
* Whether scale domain should include zero
|
|
4941
|
+
*/
|
|
4942
|
+
zero?: boolean;
|
|
4943
|
+
/**
|
|
4944
|
+
* Whether to reverse the scale
|
|
4945
|
+
*/
|
|
4946
|
+
reverse?: boolean;
|
|
4947
|
+
}
|
|
4948
|
+
|
|
4949
|
+
/**
|
|
4950
|
+
* Vega-Lite scale type
|
|
4951
|
+
*/
|
|
4952
|
+
declare type VegaLiteScaleType = 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' | 'time' | 'utc' | 'ordinal' | 'band' | 'point';
|
|
4953
|
+
|
|
4954
|
+
/**
|
|
4955
|
+
* Vega-Lite shape encoding channel
|
|
4956
|
+
*/
|
|
4957
|
+
declare interface VegaLiteShapeEncoding {
|
|
4958
|
+
/**
|
|
4959
|
+
* Field name for shape encoding
|
|
4960
|
+
*/
|
|
4961
|
+
field?: string;
|
|
4962
|
+
/**
|
|
4963
|
+
* Data type
|
|
4964
|
+
*/
|
|
4965
|
+
type?: VegaLiteType;
|
|
4966
|
+
/**
|
|
4967
|
+
* Fixed shape value
|
|
4968
|
+
*/
|
|
4969
|
+
value?: string;
|
|
4970
|
+
}
|
|
4971
|
+
|
|
4972
|
+
/**
|
|
4973
|
+
* Vega-Lite size encoding channel
|
|
4974
|
+
*/
|
|
4975
|
+
declare interface VegaLiteSizeEncoding {
|
|
4976
|
+
/**
|
|
4977
|
+
* Field name for size encoding
|
|
4978
|
+
*/
|
|
4979
|
+
field?: string;
|
|
4980
|
+
/**
|
|
4981
|
+
* Data type
|
|
4982
|
+
*/
|
|
4983
|
+
type?: VegaLiteType;
|
|
4984
|
+
/**
|
|
4985
|
+
* Fixed size value
|
|
4986
|
+
*/
|
|
4987
|
+
value?: number;
|
|
4988
|
+
}
|
|
4989
|
+
|
|
4990
|
+
/**
|
|
4991
|
+
* Vega-Lite sort specification
|
|
4992
|
+
*/
|
|
4993
|
+
declare type VegaLiteSort = 'ascending' | 'descending' | null | {
|
|
4994
|
+
field?: string;
|
|
4995
|
+
op?: 'count' | 'sum' | 'mean' | 'average' | 'median' | 'min' | 'max';
|
|
4996
|
+
order?: 'ascending' | 'descending';
|
|
4997
|
+
} | string[];
|
|
4998
|
+
|
|
4999
|
+
/**
|
|
5000
|
+
* Top-level Vega-Lite specification
|
|
5001
|
+
*/
|
|
5002
|
+
export declare interface VegaLiteSpec {
|
|
5003
|
+
/**
|
|
5004
|
+
* Schema version
|
|
5005
|
+
*/
|
|
5006
|
+
$schema?: string;
|
|
5007
|
+
/**
|
|
5008
|
+
* Chart title - can be a string or a detailed title configuration
|
|
5009
|
+
*/
|
|
5010
|
+
title?: string | VegaLiteTitleParams;
|
|
5011
|
+
/**
|
|
5012
|
+
* Chart description
|
|
5013
|
+
*/
|
|
5014
|
+
description?: string;
|
|
5015
|
+
/**
|
|
5016
|
+
* Chart width
|
|
5017
|
+
*/
|
|
5018
|
+
width?: number | 'container';
|
|
5019
|
+
/**
|
|
5020
|
+
* Chart height
|
|
5021
|
+
*/
|
|
5022
|
+
height?: number | 'container';
|
|
5023
|
+
/**
|
|
5024
|
+
* Data specification (for single/layer specs)
|
|
5025
|
+
*/
|
|
5026
|
+
data?: VegaLiteData;
|
|
5027
|
+
/**
|
|
5028
|
+
* Mark type (for single view)
|
|
5029
|
+
*/
|
|
5030
|
+
mark?: VegaLiteMarkDef;
|
|
5031
|
+
/**
|
|
5032
|
+
* Encoding channels (for single view)
|
|
5033
|
+
*/
|
|
5034
|
+
encoding?: VegaLiteEncoding;
|
|
5035
|
+
/**
|
|
5036
|
+
* Horizontal concatenation for multi-plot layouts
|
|
5037
|
+
*/
|
|
5038
|
+
hconcat?: VegaLiteSpec[];
|
|
5039
|
+
/**
|
|
5040
|
+
* Vertical concatenation for multi-plot layouts
|
|
5041
|
+
*/
|
|
5042
|
+
vconcat?: VegaLiteSpec[];
|
|
5043
|
+
/**
|
|
5044
|
+
* Layer specification
|
|
5045
|
+
*/
|
|
5046
|
+
layer?: VegaLiteUnitSpec[];
|
|
5047
|
+
/**
|
|
5048
|
+
* Data transformations
|
|
5049
|
+
* TODO: Implement transform pipeline
|
|
5050
|
+
*/
|
|
5051
|
+
transform?: Array<Record<string, unknown>>;
|
|
5052
|
+
/**
|
|
5053
|
+
* Background color
|
|
5054
|
+
*/
|
|
5055
|
+
background?: string;
|
|
5056
|
+
/**
|
|
5057
|
+
* Padding configuration
|
|
5058
|
+
*/
|
|
5059
|
+
padding?: number | {
|
|
5060
|
+
top?: number;
|
|
5061
|
+
bottom?: number;
|
|
5062
|
+
left?: number;
|
|
5063
|
+
right?: number;
|
|
5064
|
+
};
|
|
5065
|
+
/**
|
|
5066
|
+
* Auto-size configuration
|
|
5067
|
+
*/
|
|
5068
|
+
autosize?: string | {
|
|
5069
|
+
type?: string;
|
|
5070
|
+
contains?: string;
|
|
5071
|
+
};
|
|
5072
|
+
/**
|
|
5073
|
+
* Configuration overrides
|
|
5074
|
+
* TODO: Implement config resolution
|
|
5075
|
+
*/
|
|
5076
|
+
config?: Record<string, unknown>;
|
|
5077
|
+
/**
|
|
5078
|
+
* Interactive selection definitions
|
|
5079
|
+
* TODO: Implement selection support
|
|
5080
|
+
*/
|
|
5081
|
+
selection?: Record<string, unknown>;
|
|
5082
|
+
/**
|
|
5083
|
+
* Facet specification for small multiples
|
|
5084
|
+
* TODO: Implement facet support
|
|
5085
|
+
*/
|
|
5086
|
+
facet?: Record<string, unknown>;
|
|
5087
|
+
/**
|
|
5088
|
+
* Repeat specification for small multiples
|
|
5089
|
+
* TODO: Implement repeat support
|
|
5090
|
+
*/
|
|
5091
|
+
repeat?: Record<string, unknown>;
|
|
5092
|
+
/**
|
|
5093
|
+
* Scale resolution configuration
|
|
5094
|
+
* Controls whether scales are shared or independent across views
|
|
5095
|
+
*/
|
|
5096
|
+
resolve?: {
|
|
5097
|
+
scale?: {
|
|
5098
|
+
x?: 'shared' | 'independent';
|
|
5099
|
+
y?: 'shared' | 'independent';
|
|
5100
|
+
color?: 'shared' | 'independent';
|
|
5101
|
+
opacity?: 'shared' | 'independent';
|
|
5102
|
+
size?: 'shared' | 'independent';
|
|
5103
|
+
shape?: 'shared' | 'independent';
|
|
5104
|
+
};
|
|
5105
|
+
axis?: {
|
|
5106
|
+
x?: 'shared' | 'independent';
|
|
5107
|
+
y?: 'shared' | 'independent';
|
|
5108
|
+
};
|
|
5109
|
+
legend?: {
|
|
5110
|
+
color?: 'shared' | 'independent';
|
|
5111
|
+
opacity?: 'shared' | 'independent';
|
|
5112
|
+
size?: 'shared' | 'independent';
|
|
5113
|
+
shape?: 'shared' | 'independent';
|
|
5114
|
+
};
|
|
5115
|
+
};
|
|
5116
|
+
}
|
|
5117
|
+
|
|
5118
|
+
/**
|
|
5119
|
+
* Vega-Lite text encoding channel
|
|
5120
|
+
*/
|
|
5121
|
+
declare interface VegaLiteTextEncoding {
|
|
5122
|
+
/**
|
|
5123
|
+
* Field name
|
|
5124
|
+
*/
|
|
5125
|
+
field?: string;
|
|
5126
|
+
/**
|
|
5127
|
+
* Data type
|
|
5128
|
+
*/
|
|
5129
|
+
type?: VegaLiteType;
|
|
5130
|
+
/**
|
|
5131
|
+
* Fixed text value
|
|
5132
|
+
*/
|
|
5133
|
+
value?: string;
|
|
5134
|
+
/**
|
|
5135
|
+
* Datum value for text encoding
|
|
5136
|
+
*/
|
|
5137
|
+
datum?: string | number;
|
|
5138
|
+
}
|
|
5139
|
+
|
|
5140
|
+
/**
|
|
5141
|
+
* Vega-Lite theta encoding channel for pie/donut charts and polar coordinates
|
|
5142
|
+
*/
|
|
5143
|
+
declare interface VegaLiteThetaEncoding {
|
|
5144
|
+
/**
|
|
5145
|
+
* Field name
|
|
5146
|
+
*/
|
|
5147
|
+
field?: string;
|
|
5148
|
+
/**
|
|
5149
|
+
* Data type
|
|
5150
|
+
*/
|
|
5151
|
+
type?: VegaLiteType;
|
|
5152
|
+
/**
|
|
5153
|
+
* Aggregate function
|
|
5154
|
+
*/
|
|
5155
|
+
aggregate?: 'count' | 'sum' | 'mean' | 'average' | 'median' | 'min' | 'max';
|
|
5156
|
+
/**
|
|
5157
|
+
* Axis configuration for polar charts
|
|
5158
|
+
*/
|
|
5159
|
+
axis?: VegaLiteAxis | null;
|
|
5160
|
+
/**
|
|
5161
|
+
* Scale configuration for polar charts
|
|
5162
|
+
*/
|
|
5163
|
+
scale?: VegaLiteScale | null;
|
|
5164
|
+
}
|
|
5165
|
+
|
|
5166
|
+
/**
|
|
5167
|
+
* Vega-Lite title configuration with styling options
|
|
5168
|
+
*/
|
|
5169
|
+
declare interface VegaLiteTitleParams {
|
|
5170
|
+
/**
|
|
5171
|
+
* Title text
|
|
5172
|
+
*/
|
|
5173
|
+
text: string;
|
|
5174
|
+
/**
|
|
5175
|
+
* Subtitle text
|
|
5176
|
+
*/
|
|
5177
|
+
subtitle?: string;
|
|
5178
|
+
/**
|
|
5179
|
+
* Font for the title
|
|
5180
|
+
*/
|
|
5181
|
+
font?: string;
|
|
5182
|
+
/**
|
|
5183
|
+
* Font size for the title
|
|
5184
|
+
*/
|
|
5185
|
+
fontSize?: number;
|
|
5186
|
+
/**
|
|
5187
|
+
* Font style for the title (e.g., 'normal', 'italic')
|
|
5188
|
+
*/
|
|
5189
|
+
fontStyle?: string;
|
|
5190
|
+
/**
|
|
5191
|
+
* Font weight for the title (e.g., 'normal', 'bold', 100-900)
|
|
5192
|
+
*/
|
|
5193
|
+
fontWeight?: string | number;
|
|
5194
|
+
/**
|
|
5195
|
+
* Color of the title text
|
|
5196
|
+
*/
|
|
5197
|
+
color?: string;
|
|
5198
|
+
/**
|
|
5199
|
+
* Horizontal anchor position for the title
|
|
5200
|
+
* - 'start': left-aligned
|
|
5201
|
+
* - 'middle': centered
|
|
5202
|
+
* - 'end': right-aligned
|
|
5203
|
+
*/
|
|
5204
|
+
anchor?: 'start' | 'middle' | 'end';
|
|
5205
|
+
/**
|
|
5206
|
+
* Vertical offset from the top of the chart
|
|
5207
|
+
*/
|
|
5208
|
+
offset?: number;
|
|
5209
|
+
/**
|
|
5210
|
+
* Additional padding around the subtitle
|
|
5211
|
+
*/
|
|
5212
|
+
subtitlePadding?: number;
|
|
5213
|
+
}
|
|
5214
|
+
|
|
5215
|
+
/**
|
|
5216
|
+
* Vega-Lite TypeScript interfaces for declarative chart specifications.
|
|
5217
|
+
* This is a minimal subset focused on line/point charts with basic encodings.
|
|
5218
|
+
*
|
|
5219
|
+
* RECOMMENDED: For full type coverage, install the official vega-lite package:
|
|
5220
|
+
* ```
|
|
5221
|
+
* npm install vega-lite
|
|
5222
|
+
* ```
|
|
5223
|
+
* Then import `TopLevelSpec` from 'vega-lite' for complete schema support.
|
|
5224
|
+
*
|
|
5225
|
+
* The types provided here are a lightweight alternative that covers common use cases
|
|
5226
|
+
* without requiring the full vega-lite dependency (~5.8MB unpacked).
|
|
5227
|
+
*
|
|
5228
|
+
* Full Vega-Lite spec: https://vega.github.io/vega-lite/docs/
|
|
5229
|
+
*
|
|
5230
|
+
* TODO: Add support for:
|
|
5231
|
+
* - Transform operations (filter, aggregate, calculate, etc.)
|
|
5232
|
+
* - Remote data sources (url, named datasets)
|
|
5233
|
+
* - Facet and concatenation for multi-view layouts
|
|
5234
|
+
* - Selection interactions
|
|
5235
|
+
* - Additional mark types (bar, area, etc.)
|
|
5236
|
+
* - Conditional encodings
|
|
5237
|
+
* - Tooltip customization
|
|
5238
|
+
*/
|
|
5239
|
+
/**
|
|
5240
|
+
* Vega-Lite data type for field encodings
|
|
5241
|
+
*/
|
|
5242
|
+
declare type VegaLiteType = 'quantitative' | 'temporal' | 'ordinal' | 'nominal' | 'geojson';
|
|
5243
|
+
|
|
5244
|
+
/**
|
|
5245
|
+
* Base Vega-Lite spec unit (single view)
|
|
5246
|
+
*/
|
|
5247
|
+
declare interface VegaLiteUnitSpec {
|
|
5248
|
+
/**
|
|
5249
|
+
* Mark type
|
|
5250
|
+
*/
|
|
5251
|
+
mark: VegaLiteMarkDef;
|
|
5252
|
+
/**
|
|
5253
|
+
* Encoding channels
|
|
5254
|
+
*/
|
|
5255
|
+
encoding?: VegaLiteEncoding;
|
|
5256
|
+
/**
|
|
5257
|
+
* Data specification
|
|
5258
|
+
*/
|
|
5259
|
+
data?: VegaLiteData;
|
|
5260
|
+
/**
|
|
5261
|
+
* Data transformations
|
|
5262
|
+
* TODO: Implement transform pipeline
|
|
5263
|
+
*/
|
|
5264
|
+
transform?: Array<Record<string, unknown>>;
|
|
5265
|
+
}
|
|
5266
|
+
|
|
5267
|
+
/**
|
|
5268
|
+
* Schema for VegaDeclarativeChart component
|
|
5269
|
+
*/
|
|
5270
|
+
export declare interface VegaSchema {
|
|
5271
|
+
/**
|
|
5272
|
+
* Vega-Lite specification
|
|
5273
|
+
*
|
|
5274
|
+
* @see https://vega.github.io/vega-lite/docs/spec.html
|
|
5275
|
+
*/
|
|
5276
|
+
vegaLiteSpec: VegaLiteSpec;
|
|
5277
|
+
/**
|
|
5278
|
+
* Selected legends for filtering
|
|
5279
|
+
*/
|
|
5280
|
+
selectedLegends?: string[];
|
|
5281
|
+
}
|
|
5282
|
+
|
|
4424
5283
|
/**
|
|
4425
5284
|
* VerticalBarchart component
|
|
4426
5285
|
* {@docCategory VerticalBarChart}
|