feat: count data visuals separately from decorative elements#111
Merged
Conversation
"Visuals" counts now mean what users mean — charts, tables, cards, slicers, maps, AI visuals, and custom visuals. Shapes, textboxes, images, action buttons, page navigators, and visual groups no longer inflate the per-page or overall totals. - report-scanner: add isDataVisual predicate (denylist of non-data visualType strings) and a per-visual flag on ScannedVisual; track dataVisualCount per PageMeta and across the scan. - data-builder: surface PageData.dataVisualCount, allPages entries, and FullData.totals.dataVisuals. - md-generator + client: switch the user-facing counters (header KPI, per-page stats, page index bullets, hidden-page table, Pages table in the data-quality MD) to the data-only count. The raw count (visualCount) stays as the source for the wireframe view and the empty-state check that distinguishes "blank page" from "decorative only". - PhysicalSourceEntry.visualCount already counts only binding-derived visuals, so the Sources tab and Sources.md were already correct. Tests - New report-scanner.test.ts with a minimal PBIR fixture: 1 chart + 1 shape + 1 textbox + 1 image + 1 button + 1 unknown custom visual. Asserts visualCount=6, dataVisualCount=2 (chart + custom), and that each ScannedVisual is tagged correctly. Plus defensive cases for the predicate (case/whitespace/missing visualType). - Updated factory totals in 6 existing test files to include the new dataVisuals field. - Updated md-tier1 page-section assertion to read dataVisualCount. - Updated render-xss-fuzz PageData / allPages fixtures.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Visual counts now reflect what users mean by "visuals" — only data-bound canvas elements (charts, tables, cards, slicers, maps, AI visuals, custom visuals). Decorative shapes, textboxes, images, action buttons, page navigators, and visual groups no longer inflate the totals.
What changed
isDataVisualpredicate (denylist of non-datavisualTypestrings) and a per-visual flag onScannedVisual. TrackdataVisualCountperPageMetaand across the whole scan.PageData.dataVisualCount,allPagesentries, andFullData.totals.dataVisuals.visualCountas the source for the wireframe (needs every shape to render the layout) and the empty-state check that distinguishes "blank page" from "decorative only".PhysicalSourceEntry.visualCountwas already binding-derived (counts only visuals consuming model fields), so it was already correct.Why a denylist not a binding check
Considered "count if has bindings" but went with a
visualTypedenylist:shape, basicShape, textbox, image, actionButton, pageNavigator, bookmarkNavigator, groupTests
tests/report-scanner.test.tswith a minimal PBIR fixture undertests/fixtures/scanner-pbir/: 1 chart + 1 shape + 1 textbox + 1 image + 1 button + 1 unknown custom visual. AssertsvisualCount=6,dataVisualCount=2(chart + custom), and eachScannedVisualcarries the rightisDataVisualflag. Plus defensive cases on the predicate (case/whitespace/missing).totalsin 6 existing test files for the newdataVisualsfield.md-tier1.test.tspage-section assertion to readdataVisualCount.render-xss-fuzz.test.tsPageData/allPagesfixtures.375/375 tests green. Browser bundle rebuilt (
docs/index.html+ bakeddocs/sample-data.json).Test plan
docs/index.htmllocally — confirm the header Visuals KPI drops vs. the previous main (sample has decorative elements on at least one page).