feat(react-charts): vega lite schema support#35546
feat(react-charts): vega lite schema support#35546AtishayMsft wants to merge 44 commits intomicrosoft:masterfrom
Conversation
📊 Bundle size report✅ No changes found |
|
Pull request demo site: URL |
| @@ -0,0 +1,247 @@ | |||
| # Vega-Lite Schema Integration Summary | |||
There was a problem hiding this comment.
🕵🏾♀️ visual changes to review in the Visual Change Report
vr-tests-react-components/CalendarCompat 4 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/CalendarCompat.multiDayView - High Contrast.default.chromium.png | 675 | Changed |
| vr-tests-react-components/CalendarCompat.multiDayView - Dark Mode.default.chromium.png | 551 | Changed |
| vr-tests-react-components/CalendarCompat.multiDayView - RTL.default.chromium.png | 390 | Changed |
| vr-tests-react-components/CalendarCompat.multiDayView.default.chromium_1.png | 478 | Changed |
vr-tests-react-components/Charts-DonutChart 1 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/Charts-DonutChart.Dynamic - RTL.default.chromium.png | 5570 | Changed |
vr-tests-react-components/Positioning 2 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/Positioning.Positioning end.chromium.png | 722 | Changed |
| vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png | 29 | Changed |
There were 1 duplicate changes discarded. Check the build logs for more information.
- Use resetIdsForTests() from @fluentui/react-utilities (same as Plotly tests) - Update snapshots with deterministic IDs - Update schema count test from >100 to 25 (after schema reduction) - All VegaDeclarativeChart tests now pass Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Use resetIdsForTests() from @fluentui/react-utilities (same as Plotly tests) - Update snapshots with deterministic IDs - Update schema count test from >100 to 25 (after schema reduction) - All VegaDeclarativeChart tests now pass Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…ayMsft/fluentui into usr/atisjai/vegaLiteFluent
There was a problem hiding this comment.
Are these change summary reports needed?
| /** | ||
| * Helper to compare two arrays for equality | ||
| */ | ||
| function arraysEqual(a: string[], b: string[]): boolean { |
There was a problem hiding this comment.
This function can be imported from the utilities:
fluentui/packages/charts/react-charts/library/src/utilities/utilities.ts
Lines 1978 to 1991 in 72fa991
There was a problem hiding this comment.
Would it be better to keep these adapters inside the VegaDeclarativeChart folder?
| // Inline schemas (25 total covering various chart types) | ||
| // These are the default schemas shown in "show few" mode | ||
| const ALL_SCHEMAS: Record<string, any> = { | ||
| adCtrScatter: { |
There was a problem hiding this comment.
These schemas can be stringified to reduce LOC.
| // These are the default schemas shown in "show few" mode | ||
| const ALL_SCHEMAS: Record<string, any> = { | ||
| adCtrScatter: { | ||
| $schema: 'https://vega.github.io/schema/vega-lite/v5.json', |
There was a problem hiding this comment.
Would it be helpful to include the recommended Vega schema version in the JSDoc comments and the example docs?
| ALL_OPTIONS.sort((a, b) => { | ||
| if (a.category !== b.category) { | ||
| // Priority order for categories | ||
| const categoryOrder = [ |
There was a problem hiding this comment.
Can be extracted for reuse
| name.includes('expense') || | ||
| name.includes('roi') || | ||
| name.includes('financial') || | ||
| name.includes('dividend') |
There was a problem hiding this comment.
Can be simplified to:
['stock', 'portfolio', 'profit', 'revenue', 'cashflow', 'budget', 'expense', 'roi', 'financial', 'dividend'].some(keyword => name.includes(keyword))There was a problem hiding this comment.
Would it be better to combine these 3 test files into 1 since they all contain component tests?
| /** | ||
| * Hook to determine if dark theme is active | ||
| */ | ||
| function useIsDarkTheme(): boolean { |
There was a problem hiding this comment.
useIsDarkTheme and useColorMapping hooks can be extracted for reuse.
| | 'donut' | ||
| | 'heatmap' | ||
| | 'histogram' | ||
| | 'polar'; |
There was a problem hiding this comment.
Can’t we use the same mapping as DeclarativeChart?
| const chartProps = transformer(spec, colorMap, isDarkTheme) as any; | ||
|
|
||
| // Special handling for charts with different prop patterns | ||
| if (chartType.type === 'donut') { |
There was a problem hiding this comment.
These conditions may not be needed since legendProps and componentRef are available on all charts.
| * @param encoding - Vega-Lite encoding with polar axis settings | ||
| * @returns Object with projected x, y arrays and metadata | ||
| */ | ||
| function projectPolarToCartesian( |
There was a problem hiding this comment.
projectPolarToCartesian, transformVegaLiteToPolarLineChartProps and transformVegaLiteToPolarScatterChartProps functions can be removed.
| @@ -0,0 +1,27 @@ | |||
| { | |||
| "$schema": "https://vega.github.io/schema/vega-lite/v5.json", | |||
There was a problem hiding this comment.
Are these json files being used. Remove if not.
| "description": "Multi-series line chart with category10 color scheme", | ||
| "mark": "line", | ||
| "data": { | ||
| "values": [ |
There was a problem hiding this comment.
Are these json files being used. Remove if not
| /** | ||
| * Selected legends (used for multi-select legend interaction) | ||
| */ | ||
| selectedLegends?: string[]; |
There was a problem hiding this comment.
revert this change. Looks to be a merge conflict
Previous Behavior
New Behavior
Related Issue(s)