Skip to content

Fix compliance dashboard chart visualisation#291

Open
Brook4747 wants to merge 1 commit into
Hardhat-Enterprises:tailwindcss-mainfrom
Brook4747:feature/dashboard-chart-visualisation-YiFeng
Open

Fix compliance dashboard chart visualisation#291
Brook4747 wants to merge 1 commit into
Hardhat-Enterprises:tailwindcss-mainfrom
Brook4747:feature/dashboard-chart-visualisation-YiFeng

Conversation

@Brook4747
Copy link
Copy Markdown
Collaborator

@Brook4747 Brook4747 commented Jun 3, 2026

Summary

This PR has fixed the custom chart visualization feature of the dashboard.
Users can now select different chart types when viewing compliance results. Previously, due to an error, the charts were not visible and the available chart types were:

  • Pie chart
  • Doughnut chart
  • Bar chart

Type of Change

  • Added chart type selector dropdown
  • Added chart type state management
  • Updated ComplianceChart to support multiple chart types
  • Added fallback handling for empty datasets
  • Maintained dark mode compatibility

Affected Components

  • /backend-api
  • /frontend
  • /engine (collectors / policies)
  • /security
  • /infrastructure
  • /.github/workflows
  • /docs

Motivation

Testing

Manually tested:

  • Dashboard loads successfully
  • Pie Chart renders correctly
  • Doughnut Chart renders correctly
  • Bar Chart renders correctly
  • Chart switching works without page crashes
  • Dark mode display remains functional

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5e04acab3e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +20 to +21
const safeLabels = labels.length > 0 ? labels : ["No data"];
const safeValues = values.length > 0 ? values : [0];
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Treat zero-total pie data as no data

When the selected scan has no results yet (for example, a first-run dashboard, a pending/running scan, or a scan whose counts are all zero), Dashboard still passes labels=["Pass", "Fail"] and values=[0, 0], so this length-only fallback is skipped. The pie/doughnut chart is then asked to render an all-zero series instead of the intended No data state, leaving empty dashboards with a blank or invalid chart rather than the fallback this component is trying to provide.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant