feat: add interactive cwe vulnerability donut chart with custom UI#42
Merged
ionfwsrijan merged 1 commit intoJun 6, 2026
Merged
Conversation
Contributor
Author
|
hi @ionfwsrijan Could you review it and let me know if any changes Required. Thanks! |
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.
Linked issue
Closes #32
What this PR does
Adds a highly interactive, premium Donut Chart to the dashboard to visualize the distribution of Common Weakness Enumeration (CWE) categories. The backend has been updated to query and group real finding data by category. The frontend features a custom Recharts implementation with dynamic center-labeling, hover-state dimming, and a custom legend utilizing horizontal percentage bars for maximum data readability.
Type of change
ML tier (if applicable)
Changes
Backend
get_cwe_distributionquery indb.pyto aggregate findings by category for the latest scan job.GET /cwe-distributionAPI endpoint inmain.py.Frontend
CweChartcomponent (cwe-chart.tsx) usingrechartsand Tailwind CSS.activeIndex) to handle synchronized hover states between the pie slices and the custom legend.getCweDistributionclient fetch logic inapi.ts.dashboard.tsxin a responsive grid alongside the Trend Chart.Testing
How did you test this?
Tested locally end-to-end. Verified that the backend correctly aggregates findings by category from the SQLite database. Confirmed the frontend successfully fetches the data, handles loading/error/empty states gracefully, and renders the dynamic hover states and custom legend without performance lag.
Checklist
console.erroror unhandled Python exceptions introducedrequirements.txt/package.jsonupdated if new dependencies added.pkl,.pt, etc.) are gitignored, not committed