Skip to content

Conversation

@KavanBhavsar35
Copy link
Contributor

@KavanBhavsar35 KavanBhavsar35 commented Dec 3, 2025

Implements stacked bar chart with the following features:

  • Vertical and horizontal alignment support
  • Customizable colors for multiple categories
  • Optional legend display
  • Tooltip with stacked values
  • Value formatting support

Added preview examples:

  • stacked-bar-chart-style-default
  • stacked-bar-chart-style-horizontal
  • stacked-bar-chart-style-no-legend
  • stacked-bar-chart-style-formatted

Fixes #100

Summary by CodeRabbit

  • New Features

    • Introduced a Stacked Bar Chart component with vertical/horizontal layouts, configurable colors, tooltips, grid and legend options.
  • Documentation

    • Added a usage guide and API reference detailing props and configuration.
  • Examples

    • Added multiple preview examples (default, horizontal, no-legend, formatted) demonstrating common styles and formatting.
  • Navigation

    • Added a new "Stacked Bar Chart" entry in the Charts navigation.

✏️ Tip: You can customize this high-level summary in your review settings.

Implements stacked bar chart with the following features:
- Vertical and horizontal alignment support
- Customizable colors for multiple categories
- Optional legend display
- Tooltip with stacked values
- Value formatting support

Added preview examples:
- stacked-bar-chart-style-default
- stacked-bar-chart-style-horizontal
- stacked-bar-chart-style-no-legend
- stacked-bar-chart-style-formatted

Fixes Logging-Studio#100
@vercel
Copy link

vercel bot commented Dec 3, 2025

@KavanBhavsar35 is attempting to deploy a commit to the Retro UI Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 3, 2025

Walkthrough

Introduces a new StackedBarChart React component (Recharts) with vertical/horizontal layouts, configurable categories, colors, tooltip/legend/grid toggles, and value formatting. Adds registry, config/navigation entries, documentation, and four preview example pages demonstrating usage.

Changes

Cohort / File(s) Summary
Component & Registry
components/retroui/charts/StackedBarChart.tsx, public/r/stacked-bar-chart.json
New Recharts-based StackedBarChart component and exported StackedBarChartProps; responsive stacked bars, alignment option, custom tooltip, conditional grid/legend, per-category Bars; registry JSON added listing dependency and metadata.
Configuration & Navigation
config/components.ts, config/navigation.ts
Added core.stackedBarChart in components config and a "Stacked Bar Chart" entry under Charts in the site navigation; registered four preview examples.
Documentation
content/docs/charts/stacked-bar-chart.mdx
New MDX docs with frontmatter, installation note, usage examples (default, horizontal, no-legend, formatted), and API reference table for props.
Preview Examples
preview/charts/stacked-bar-chart-style-default.tsx, preview/charts/stacked-bar-chart-style-horizontal.tsx, preview/charts/stacked-bar-chart-style-no-legend.tsx, preview/charts/stacked-bar-chart-style-formatted.tsx
Four preview components demonstrating default vertical, horizontal alignment, legend toggled off, and formatted values (thousands suffix).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Focus review on components/retroui/charts/StackedBarChart.tsx (Recharts integration, prop types, tooltip formatting, axis/layout handling).
  • Verify public/r/stacked-bar-chart.json registry fields and declared dependency.
  • Check config/components.ts import/filePath correctness and config/navigation.ts route string.
  • Spot-check one preview example and the MDX examples for correctness of props and code samples.

"I hopped through code and colors bright,
Stacked bars rising in morning light.
Little paws coded tooltip cheer,
Bars aligned both far and near.
A carrot toast to charts tonight! 🥕"

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title clearly and concisely describes the main change: adding a StackedBarChart component. It is specific and directly related to the primary objective.
Linked Issues check ✅ Passed The PR fully implements the feature request from issue #100: StackedBarChart component with both horizontal and vertical alignment support, multiple preview examples, and customizable styling options.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the StackedBarChart feature. Component code, configuration, documentation, preview examples, and navigation updates are all in-scope and support the core objective.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6f9b0f8 and 72f7672.

📒 Files selected for processing (3)
  • components/retroui/charts/StackedBarChart.tsx (1 hunks)
  • config/components.ts (2 hunks)
  • content/docs/charts/stacked-bar-chart.mdx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • content/docs/charts/stacked-bar-chart.mdx
  • components/retroui/charts/StackedBarChart.tsx
🔇 Additional comments (2)
config/components.ts (2)

63-66: Core stackedBarChart entry looks consistent and correct.

Config for stackedBarChart matches existing chart entries (areaChart, barChart) in naming and file path structure; no issues from this file’s perspective.


267-286: Stacked bar chart example entries are wired correctly.

Each stacked-bar example has a matching name, filePath, and lazy import path, consistent with other chart examples (e.g., bar-chart styles). This should integrate cleanly with the existing preview system.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🧹 Nitpick comments (1)
components/retroui/charts/StackedBarChart.tsx (1)

16-31: Minor: className is redundant in the interface.

className is already included in React.HTMLAttributes<HTMLDivElement>, so the explicit declaration on line 30 is unnecessary.

 interface StackedBarChartProps extends React.HTMLAttributes<HTMLDivElement> {
   data: Record<string, any>[]
   index: string
   categories: string[]
   strokeColors?: string[]
   fillColors?: string[]
   tooltipBgColor?: string
   tooltipBorderColor?: string
   gridColor?: string
   valueFormatter?: (value: number) => string
   showGrid?: boolean
   showTooltip?: boolean
   showLegend?: boolean
   alignment?: "vertical" | "horizontal"
-  className?: string
 }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b7a7dbe and 6f9b0f8.

📒 Files selected for processing (9)
  • components/retroui/charts/StackedBarChart.tsx (1 hunks)
  • config/components.ts (3 hunks)
  • config/navigation.ts (1 hunks)
  • content/docs/charts/stacked-bar-chart.mdx (1 hunks)
  • preview/charts/stacked-bar-chart-style-default.tsx (1 hunks)
  • preview/charts/stacked-bar-chart-style-formatted.tsx (1 hunks)
  • preview/charts/stacked-bar-chart-style-horizontal.tsx (1 hunks)
  • preview/charts/stacked-bar-chart-style-no-legend.tsx (1 hunks)
  • public/r/stacked-bar-chart.json (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (5)
config/navigation.ts (2)
components/SideNav.tsx (1)
  • SideNav (12-53)
components/TopNav.tsx (1)
  • TopNav (11-93)
components/retroui/charts/StackedBarChart.tsx (1)
lib/utils.ts (1)
  • cn (4-6)
preview/charts/stacked-bar-chart-style-default.tsx (1)
components/retroui/charts/StackedBarChart.tsx (1)
  • StackedBarChart (182-182)
preview/charts/stacked-bar-chart-style-horizontal.tsx (1)
components/retroui/charts/StackedBarChart.tsx (1)
  • StackedBarChart (182-182)
preview/charts/stacked-bar-chart-style-no-legend.tsx (1)
components/retroui/charts/StackedBarChart.tsx (1)
  • StackedBarChart (182-182)
🔇 Additional comments (9)
config/navigation.ts (1)

100-100: LGTM!

The navigation entry follows the established pattern and is appropriately placed after "Bar Chart" in the Chart section.

components/retroui/charts/StackedBarChart.tsx (1)

33-55: LGTM!

Good use of React.forwardRef with sensible defaults for all optional props. The CSS variable defaults for colors ensure theme consistency.

public/r/stacked-bar-chart.json (1)

1-18: LGTM!

The registry entry correctly declares the recharts dependency and follows the shadcn registry schema. The component content and target path are properly configured.

config/components.ts (2)

64-67: LGTM!

The core entry follows the established pattern for chart components in this configuration.


268-287: LGTM!

The preview entries are well-structured and follow the established pattern. All four preview variants (default, horizontal, no-legend, formatted) are properly registered.

preview/charts/stacked-bar-chart-style-default.tsx (1)

1-21: LGTM!

Clean preview implementation with sample data that demonstrates the component's default configuration. The use of CSS variables for colors ensures theme consistency.

preview/charts/stacked-bar-chart-style-no-legend.tsx (1)

1-22: Preview wiring for no‑legend variant looks good

Props line up with the documented API; index, categories, fillColors, and showLegend={false} are consistent with the “no legend” example intent. Nothing blocking here.

preview/charts/stacked-bar-chart-style-horizontal.tsx (1)

1-21: Horizontal stacked bar preview is correctly configured

alignment="horizontal" with index="category" and matching categories/fillColors looks consistent and should showcase the horizontal layout as intended.

preview/charts/stacked-bar-chart-style-formatted.tsx (1)

1-23: Formatted-values stacked bar preview is well set up

Data, index, categories, and fillColors are coherent, and valueFormatter cleanly demonstrates custom numeric formatting in thousands. No issues from a preview wiring standpoint.

@vercel
Copy link

vercel bot commented Dec 5, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
retro-ui Ready Ready Preview Comment Dec 5, 2025 8:03pm

@ariflogs
Copy link
Member

ariflogs commented Dec 5, 2025

Instead of making a separate component, what if we update the BarChart component to handle Stack option? like if we pass a stacked={true} (default will be false) and the chart will be stacked.

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.

[New Feature Request]: Please provide stacked-bar-charts for both horizontal and vertical manneer.

2 participants