-
Notifications
You must be signed in to change notification settings - Fork 0
feat: accessibility + editor/radar fixes #186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ec704b6
feat(component): accessibility improvements — ARIA, keyboard nav, con…
alfredorubin96 d6305d8
fix(component,app): bracket wrapping in code editor + radar chart scale
alfredorubin96 5c166f6
chore: add Chart Catalog seed dashboard with full feature showcase
alfredorubin96 6dd50c9
fix(component): resolve nested button hydration error in CrossFilterTag
alfredorubin96 f31270f
chore: expand Chart Catalog to cover ALL chart options comprehensively
alfredorubin96 943834a
chore: add Map Chart page with geo data (filming locations + birthpla…
alfredorubin96 b7513f0
fix: markdown newlines and iframe URL in Chart Catalog seed
alfredorubin96 89dbb1d
fix: markdown table rendering, graph performance, and query typo
alfredorubin96 57b05f0
fix(component): prevent graph chart nodes clumping on initial render
alfredorubin96 bbea43b
feat(component): add number formatting to single value and tooltips
alfredorubin96 8e4a745
fix(ci): add missing ECharts component mocks for CI
alfredorubin96 3b02566
fix: aria description merge order and dependency array
alfredorubin96 357b181
fix: radar max fallback, seed data shape, and markdown ReDoS
alfredorubin96 1c04d9c
fix(e2e): use keyboard fallback when CM6 editor reports readonly
alfredorubin96 33fcfe1
fix: resolve TypeScript compilation errors
alfredorubin96 8592737
Merge remote-tracking branch 'origin/fix/editor-brackets-radar-scale'…
alfredorubin96 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| import { describe, it, expect } from "vitest"; | ||
| import { formatNumber, buildTooltipFormatter } from "../chart-utils"; | ||
|
|
||
| describe("formatNumber", () => { | ||
| it("returns plain number by default", () => { | ||
| expect(formatNumber(1234)).toBe("1234"); | ||
| }); | ||
|
|
||
| it("respects decimalPlaces", () => { | ||
| expect(formatNumber(3.14159, { decimalPlaces: 2 })).toBe("3.14"); | ||
| }); | ||
|
|
||
| it("pads with zeros when decimalPlaces exceeds precision", () => { | ||
| expect(formatNumber(5, { decimalPlaces: 2 })).toBe("5.00"); | ||
| }); | ||
|
|
||
| it("applies comma formatting", () => { | ||
| expect(formatNumber(1234567, { numberFormat: "comma" })).toBe("1,234,567"); | ||
| }); | ||
|
|
||
| it("applies comma formatting with decimalPlaces", () => { | ||
| expect(formatNumber(1234567.891, { numberFormat: "comma", decimalPlaces: 2 })).toBe("1,234,567.89"); | ||
| }); | ||
|
|
||
| it("applies compact notation", () => { | ||
| const result = formatNumber(1500000, { numberFormat: "compact" }); | ||
| expect(result).toMatch(/1\.5M/i); | ||
| }); | ||
|
|
||
| it("applies compact notation with decimalPlaces", () => { | ||
| const result = formatNumber(1234, { numberFormat: "compact", decimalPlaces: 1 }); | ||
| expect(result).toMatch(/1\.2K/i); | ||
| }); | ||
|
|
||
| it("applies percent format", () => { | ||
| expect(formatNumber(75, { numberFormat: "percent" })).toBe("75%"); | ||
| }); | ||
|
|
||
| it("applies percent format with decimalPlaces", () => { | ||
| expect(formatNumber(75.678, { numberFormat: "percent", decimalPlaces: 1 })).toBe("75.7%"); | ||
| }); | ||
|
|
||
| it("adds prefix", () => { | ||
| expect(formatNumber(100, { prefix: "$" })).toBe("$100"); | ||
| }); | ||
|
|
||
| it("adds suffix", () => { | ||
| expect(formatNumber(100, { suffix: " items" })).toBe("100 items"); | ||
| }); | ||
|
|
||
| it("combines prefix, suffix, decimalPlaces, and comma", () => { | ||
| expect(formatNumber(9876.5, { prefix: "$", suffix: "M", numberFormat: "comma", decimalPlaces: 1 })).toBe("$9,876.5M"); | ||
| }); | ||
|
|
||
| it("handles zero", () => { | ||
| expect(formatNumber(0, { decimalPlaces: 2 })).toBe("0.00"); | ||
| }); | ||
|
|
||
| it("handles negative numbers", () => { | ||
| expect(formatNumber(-42.567, { decimalPlaces: 1 })).toBe("-42.6"); | ||
| }); | ||
|
|
||
| it("returns string values unchanged", () => { | ||
| expect(formatNumber("N/A" as unknown as number)).toBe("N/A"); | ||
| }); | ||
| }); | ||
|
|
||
| describe("buildTooltipFormatter", () => { | ||
| it("returns a function", () => { | ||
| const formatter = buildTooltipFormatter({}); | ||
| expect(typeof formatter).toBe("function"); | ||
| }); | ||
|
|
||
| it("formats a single value with config", () => { | ||
| const formatter = buildTooltipFormatter({ decimalPlaces: 1, prefix: "$" }); | ||
| // ECharts tooltip params shape for axis trigger | ||
| const result = formatter({ | ||
| seriesName: "Revenue", | ||
| value: 1234.56, | ||
| name: "Jan", | ||
| marker: '<span style="color:#3b82f6">●</span>', | ||
| }); | ||
| expect(result).toContain("$1,234.6"); | ||
| expect(result).toContain("Revenue"); | ||
| }); | ||
|
|
||
| it("handles array params (axis trigger with multiple series)", () => { | ||
| const formatter = buildTooltipFormatter({ decimalPlaces: 0 }); | ||
| const result = formatter([ | ||
| { seriesName: "A", value: 100.7, name: "Jan", marker: "●" }, | ||
| { seriesName: "B", value: 200.3, name: "Jan", marker: "●" }, | ||
| ]); | ||
| expect(result).toContain("101"); | ||
| expect(result).toContain("200"); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make explicit radar maxima deterministic across repeated indicators.
The new
!indicatorExplicitMax.has(indName)check means the first validmaxwins. In long-format radar data, the same indicator usually appears once per series, so conflicting valid maxima now make the rendered axis depend on row order.Suggested fix
if (maxKey) { const explicitMax = Number(r[maxKey]); - if (Number.isFinite(explicitMax) && explicitMax > 0 && !indicatorExplicitMax.has(indName)) { - indicatorExplicitMax.set(indName, explicitMax); + if (Number.isFinite(explicitMax) && explicitMax > 0) { + indicatorExplicitMax.set( + indName, + Math.max(indicatorExplicitMax.get(indName) ?? 0, explicitMax), + ); } }🤖 Prompt for AI Agents