Skip to content

docs(charts): add more area charts#1666

Open
aguingand wants to merge 3 commits intounovue:devfrom
aguingand:update-unovis-areas
Open

docs(charts): add more area charts#1666
aguingand wants to merge 3 commits intounovue:devfrom
aguingand:update-unovis-areas

Conversation

@aguingand
Copy link

@aguingand aguingand commented Jan 29, 2026

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

I've update Unovis to 1.7.0 (beta for now) that includes the feature to add lines to area (f5/unovis#691) . I've added missing area charts from Shadcn except from the "Stacked Expanded" one (we can't configure stack offset in Unovis yet).

PS. Unovis 1.7.0 includes performance improvements (f5/unovis#689). It has been reported in #1567

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Summary by CodeRabbit

  • New Features

    • Added five new area chart variants: Default, Linear, Stacked, Step, and configurable Legend options for enhanced data visualization flexibility.
  • Updates

    • Enhanced area chart line rendering with improved styling capabilities across chart types.
  • Dependencies

    • Updated Unovis visualization library to ^1.7.0-pre.2.

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

@coderabbitai
Copy link

coderabbitai bot commented Jan 29, 2026

📝 Walkthrough

Walkthrough

This pull request refactors existing area chart components to use Unovis's updated VisArea component with integrated line capabilities, replacing the separate VisLine component. Five new area chart variant components are added (Default, Linear, Legend, Stacked, Step) and registered in the chart constants. Unovis library versions are bumped to ^1.7.0-pre.2.

Changes

Cohort / File(s) Summary
New Area Chart Components
ChartAreaDefault.vue, ChartAreaLinear.vue, ChartAreaLegend.vue, ChartAreaStacked.vue, ChartAreaStep.vue
Five new Vue SFC components added, each implementing distinct area chart variations (default, linear curve, with legend, stacked, step curve) using Unovis VisArea, axes, tooltip, and legend primitives within Card layouts.
Existing Area Chart Refactoring
ChartAreaAxes.vue, ChartAreaGradient.vue, ChartAreaIcons.vue, ChartAreaInteractive.vue
Removed VisLine imports and usage; refactored components to render lines via VisArea with new :line, :line-color, and :line-width props, consolidating line and area rendering into a single VisArea component.
Chart Registry Update
apps/v4/constants/charts.ts
Updated to import and register the five new area chart components (ChartAreaDefault, ChartAreaLinear, ChartAreaStep, ChartAreaLegend, ChartAreaStacked) alongside existing entries in the area chart group.
Dependency Version Bump
pnpm-workspace.yaml
Bumped @unovis/ts and @unovis/vue from ^1.6.2 to ^1.7.0-pre.2 to support new VisArea line capabilities.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰✨ Five new charts bloom in the garden so bright,
VisArea now dances with lines—what a sight!
No more separate strokes, just one unified way,
Stacked, stepped, and linear—hooray, hooray!
Unovis upgraded, our palette takes flight! 🎨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title 'docs(charts): add more area charts' directly and clearly reflects the main change: adding additional area chart examples to the documentation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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

@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

🤖 Fix all issues with AI agents
In `@apps/v4/registry/new-york-v4/charts/ChartAreaDefault.vue`:
- Around line 73-75: In the tick-format arrow function bound in
ChartAreaDefault.vue, add a defensive check to avoid out-of-bounds or undefined
access on chartData[index] and its monthLabel before calling slice; update the
lambda that currently references chartData[index].monthLabel.slice(0, 3) to
first verify index is within chartData length and that
chartData[index]?.monthLabel is a string, and return a safe fallback (e.g.,
empty string or full label) when the checks fail.

In `@apps/v4/registry/new-york-v4/charts/ChartAreaLegend.vue`:
- Around line 77-79: The tick-format arrow function for the chart's ticks
accesses chartData[index].monthLabel without bounds checking; update the inline
function used in the :tick-format prop to defensively validate that chartData is
an array, index is a valid number within range, and chartData[index]?.monthLabel
exists before slicing, returning a safe fallback (e.g., empty string) when
checks fail so out-of-bounds or undefined values from Unovis cannot throw.

In `@apps/v4/registry/new-york-v4/charts/ChartAreaLinear.vue`:
- Around line 75-77: The tick-format arrow in ChartAreaLinear.vue accesses
chartData[index].monthLabel.slice(0,3) without checking bounds; update the tick
formatter (the :tick-format handler) to first ensure chartData is an array,
index is a valid number within chartData.length, and chartData[index].monthLabel
is a string before calling slice, returning a safe fallback (e.g., empty string
or full label) when checks fail; this prevents runtime exceptions for
out-of-range or undefined entries.

In `@apps/v4/registry/new-york-v4/charts/ChartAreaStep.vue`:
- Around line 75-77: The tick-format callback in ChartAreaStep.vue currently
does chartData[index].monthLabel.slice(0,3) which can throw if index is
out-of-bounds; update the tick-format function to defensively check that
chartData and chartData[index] exist and that monthLabel is a string (e.g.,
guard with chartData && chartData[index] && typeof chartData[index].monthLabel
=== 'string'), then call slice on that value, otherwise return a safe fallback
(empty string or a formatted default); this ensures the tick-format handler
won't throw when Unovis supplies indices that don't align with chartData.
🧹 Nitpick comments (10)
apps/v4/registry/new-york-v4/charts/ChartAreaStacked.vue (1)

70-80: Make X‑axis tick labels resilient to tick decimation.

Line 77-79: tick-format relies on the tick index; if ticks are reduced or the data shape changes, labels can desync. Mapping by the tick value is safer.

♻️ Suggested change
 const chartData = [
   { month: 1, monthLabel: "January", desktop: 186, mobile: 80 },
   { month: 2, monthLabel: "February", desktop: 305, mobile: 200 },
   { month: 3, monthLabel: "March", desktop: 237, mobile: 120 },
   { month: 4, monthLabel: "April", desktop: 73, mobile: 190 },
   { month: 5, monthLabel: "May", desktop: 209, mobile: 130 },
   { month: 6, monthLabel: "June", desktop: 214, mobile: 140 },
 ]
+
+const monthLabelByValue = new Map(chartData.map((d) => [d.month, d.monthLabel]))
-          :tick-format="(d: number, index: number) => {
-            return chartData[index].monthLabel.slice(0, 3)
-          }"
+          :tick-format="(d: number) => {
+            return monthLabelByValue.get(d)?.slice(0, 3) ?? ''
+          }"
pnpm-workspace.yaml (1)

27-28: Consider pinning the Unovis pre-release to avoid unexpected version drift.

Lines 27-28: ^1.7.0-pre.2 allows minor and patch updates within the pre-release sequence. Once a stable 1.7.0 is released, the caret could permit upgrades to the final version, potentially shifting behavior. For consistent pre-release behavior, pin the exact version.

🔧 Suggested pinning
-  '@unovis/ts': ^1.7.0-pre.2
-  '@unovis/vue': ^1.7.0-pre.2
+  '@unovis/ts': 1.7.0-pre.2
+  '@unovis/vue': 1.7.0-pre.2
apps/v4/registry/new-york-v4/charts/ChartAreaStep.vue (2)

6-6: Remove commented-out import.

This commented-out recharts import is dead code. Since the PR transitions to Unovis, this leftover should be cleaned up.

🧹 Suggested cleanup
-// import { Area, AreaChart, CartesianGrid, XAxis, YAxis } from "recharts"

27-27: Unused description variable.

The description constant is defined but never used in the template or exposed. Consider removing it or using it (e.g., for accessibility attributes or meta purposes).

apps/v4/registry/new-york-v4/charts/ChartAreaLegend.vue (2)

5-5: Remove commented-out import.

Dead code from the recharts migration should be cleaned up.

🧹 Suggested cleanup
-// import { Area, AreaChart, CartesianGrid, XAxis, YAxis } from "recharts"

26-26: Unused description variable.

Same as other chart files - this variable is declared but never used.

apps/v4/registry/new-york-v4/charts/ChartAreaDefault.vue (2)

5-5: Remove commented-out import.

Dead code from the recharts migration.

🧹 Suggested cleanup
-// import { Area, AreaChart, CartesianGrid, XAxis, YAxis } from "recharts"

26-26: Unused description variable.

Declared but not used in the component.

apps/v4/registry/new-york-v4/charts/ChartAreaLinear.vue (2)

6-6: Remove commented-out import.

Dead code from the recharts migration.

🧹 Suggested cleanup
-// import { Area, AreaChart, CartesianGrid, XAxis, YAxis } from "recharts"

27-27: Unused description variable.

Declared but not used in the component.

Comment on lines +73 to +75
:tick-format="(d: number, index: number) => {
return chartData[index].monthLabel.slice(0, 3)
}"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add defensive check for array index access.

🛡️ Suggested defensive fix
             :tick-format="(d: number, index: number) => {
-              return chartData[index].monthLabel.slice(0, 3)
+              return chartData[index]?.monthLabel?.slice(0, 3) ?? ''
             }"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
:tick-format="(d: number, index: number) => {
return chartData[index].monthLabel.slice(0, 3)
}"
:tick-format="(d: number, index: number) => {
return chartData[index]?.monthLabel?.slice(0, 3) ?? ''
}"
🤖 Prompt for AI Agents
In `@apps/v4/registry/new-york-v4/charts/ChartAreaDefault.vue` around lines 73 -
75, In the tick-format arrow function bound in ChartAreaDefault.vue, add a
defensive check to avoid out-of-bounds or undefined access on chartData[index]
and its monthLabel before calling slice; update the lambda that currently
references chartData[index].monthLabel.slice(0, 3) to first verify index is
within chartData length and that chartData[index]?.monthLabel is a string, and
return a safe fallback (e.g., empty string or full label) when the checks fail.

Comment on lines +77 to +79
:tick-format="(d: number, index: number) => {
return chartData[index].monthLabel.slice(0, 3)
}"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add defensive check for array index access.

Same potential out-of-bounds issue as other chart files when Unovis passes unexpected index values.

🛡️ Suggested defensive fix
             :tick-format="(d: number, index: number) => {
-              return chartData[index].monthLabel.slice(0, 3)
+              return chartData[index]?.monthLabel?.slice(0, 3) ?? ''
             }"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
:tick-format="(d: number, index: number) => {
return chartData[index].monthLabel.slice(0, 3)
}"
:tick-format="(d: number, index: number) => {
return chartData[index]?.monthLabel?.slice(0, 3) ?? ''
}"
🤖 Prompt for AI Agents
In `@apps/v4/registry/new-york-v4/charts/ChartAreaLegend.vue` around lines 77 -
79, The tick-format arrow function for the chart's ticks accesses
chartData[index].monthLabel without bounds checking; update the inline function
used in the :tick-format prop to defensively validate that chartData is an
array, index is a valid number within range, and chartData[index]?.monthLabel
exists before slicing, returning a safe fallback (e.g., empty string) when
checks fail so out-of-bounds or undefined values from Unovis cannot throw.

Comment on lines +75 to +77
:tick-format="(d: number, index: number) => {
return chartData[index].monthLabel.slice(0, 3)
}"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Add defensive check for array index access.

🛡️ Suggested defensive fix
             :tick-format="(d: number, index: number) => {
-              return chartData[index].monthLabel.slice(0, 3)
+              return chartData[index]?.monthLabel?.slice(0, 3) ?? ''
             }"
🤖 Prompt for AI Agents
In `@apps/v4/registry/new-york-v4/charts/ChartAreaLinear.vue` around lines 75 -
77, The tick-format arrow in ChartAreaLinear.vue accesses
chartData[index].monthLabel.slice(0,3) without checking bounds; update the tick
formatter (the :tick-format handler) to first ensure chartData is an array,
index is a valid number within chartData.length, and chartData[index].monthLabel
is a string before calling slice, returning a safe fallback (e.g., empty string
or full label) when checks fail; this prevents runtime exceptions for
out-of-range or undefined entries.

Comment on lines +75 to +77
:tick-format="(d: number, index: number) => {
return chartData[index].monthLabel.slice(0, 3)
}"
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Potential index out-of-bounds access in tick formatter.

The tick-format callback accesses chartData[index] directly. If Unovis passes an index outside the array bounds (e.g., during interpolation or when num-ticks doesn't align with data length), this will throw a runtime error.

🛡️ Suggested defensive fix
             :tick-format="(d: number, index: number) => {
-              return chartData[index].monthLabel.slice(0, 3)
+              return chartData[index]?.monthLabel?.slice(0, 3) ?? ''
             }"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
:tick-format="(d: number, index: number) => {
return chartData[index].monthLabel.slice(0, 3)
}"
:tick-format="(d: number, index: number) => {
return chartData[index]?.monthLabel?.slice(0, 3) ?? ''
}"
🤖 Prompt for AI Agents
In `@apps/v4/registry/new-york-v4/charts/ChartAreaStep.vue` around lines 75 - 77,
The tick-format callback in ChartAreaStep.vue currently does
chartData[index].monthLabel.slice(0,3) which can throw if index is
out-of-bounds; update the tick-format function to defensively check that
chartData and chartData[index] exist and that monthLabel is a string (e.g.,
guard with chartData && chartData[index] && typeof chartData[index].monthLabel
=== 'string'), then call slice on that value, otherwise return a safe fallback
(empty string or a formatted default); this ensures the tick-format handler
won't throw when Unovis supplies indices that don't align with chartData.

@lucasbois1
Copy link
Contributor

@aguingand i have updated it, works like a charm now ⚡🚀

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.

2 participants