feat(web): add percentage bar annotation renderer - #104
Open
warun7 wants to merge 3 commits into
Open
Conversation
joaomarcoscrs
requested changes
Aug 27, 2026
joaomarcoscrs
left a comment
Collaborator
There was a problem hiding this comment.
I found two issues in the initialization and drawing paths.
…on top of value fill
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
Adds the
percentageBarannotation renderer tosupervision-js, providing proportional progress and confidence bar indicators anchored to detection bounding boxes.Closes #103
Motivation & Use Cases
Top,Bottom,InsideTop,InsideBottom), custom heights, border styling, padding, and dynamic fill opacity.Visual Demo
Changes
1. Core Styles & Contracts (
@supervision/core)PercentageBarStyle,PercentageBarPlacement, andPercentageBarDrawInstructioninterfaces inpackages/core/src/types/percentage-bar-style.ts.BasePercentageBarStylewith value clamping in[0, 1], geometric alignment based on placement, and configurable color/stroke options inpackages/core/src/styles/percentage-bar-style.ts.annotationRenderers.percentageBarfactory and integrated it into default presentation and source presentation registries.2. Vector Layer Scene Lowering (
@supervision/web)annotation-shape-styles.tsto lowerPercentageBarDrawInstructioninto closed rectangular polygon paths for background track and value progress.strokeoptional onClosedPathShapeInstructioninpackages/core/src/types/shape-style.tsand guarded vector layer stroke rendering inpixi-vector-layer.ts.percentageBarStylethroughMediaRendererPresentation,pixi-media-scene.ts, andmedia-renderer-core.ts.3. Documentation & Playground (
demo,docs,tools)docs/public/annotation-renderers/percentage-bar.md."percentage-bar"playground controls (Height slider, Fill Opacity slider, Placement select) indemo/src/docs-annotation-renderer.ts.tools/docs-contract.test.mjsandtools/package-smoke.test.mjs.Validation
npm run verifypassed cleanly:prettier --checkpassed.eslintpassed with 0 errors / 0 warnings.tscpassed across all workspace packages and demo.vitest runpassed all 843 tests across 103 test suites.package-boundary.test.mjspassed (7/7).docs-contract.test.mjspassed (14/14).package-smoke.test.mjspassed runtime and typing export assertions.npm run package:tarball && npm run package:tarball:smokepassed (8/8).