Skip to content

Conversation

@Davont
Copy link
Member

@Davont Davont commented Jan 23, 2026

PR

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Bug Fixes
    • Fixed ring chart data retrieval to provide complete dataset information in multilevel configurations.

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

Davont and others added 30 commits May 20, 2024 04:08
@github-actions github-actions bot added the bug Something isn't working label Jan 23, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 23, 2026

Walkthrough

Modified the ring chart's getDataOrSeries function to return both series and data properties when levelFlag is true, instead of returning only series. Additionally, removed a blank line from the getLegend function.

Changes

Cohort / File(s) Summary
Ring Chart Data Handling
packages/vue/src/huicharts/huicharts-ring/src/ring.ts
Modified getDataOrSeries return value: when levelFlag is true, now returns { series, data: ... } instead of { series }. When levelFlag is false, returns { data: ... } as before. Removed blank line in getLegend function.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 Hop hop, the ring chart twirls with glee,
Now series and data dance in harmony,
No blank lines wasting precious space,
A tidy, cleaner, brighter place!
rings bell cheerfully

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(huicharts): fix the double-layer donut chart error in charts' accurately describes the main change in the PR, which fixes a double-layer ring chart issue in the huicharts-ring component by modifying how data is returned in the getDataOrSeries function.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/vue/src/huicharts/huicharts-ring/src/ring.ts (1)

263-263: Missing innerData parameter in getLegend call.

The getLegend function expects innerData in its parameters (line 198) and uses it when level is defined (line 222). However, innerData is not passed in the call at line 263, even though it's available in scope (defined at line 251). This results in legend.data being undefined for multi-layer charts.

Suggested fix
-  const ichartLegend = getLegend({ legendVisible, dimension, innerRows, legendLimit, level, limitShowNum })
+  const ichartLegend = getLegend({ legendVisible, dimension, innerRows, legendLimit, level, limitShowNum, innerData })
🤖 Fix all issues with AI agents
In `@packages/vue/src/huicharts/huicharts-ring/src/ring.ts`:
- Line 194: The call to getLegend is missing innerData, so when level is present
the function destructures innerData and ends up with ichartLegend.data
undefined; update the getLegend invocation (the one that builds ichartLegend) to
include innerData in its argument object (e.g., pass innerData along with
legendVisible, dimension, innerRows, legendLimit, level, limitShowNum) so
getLegend receives the full dataset used by getLimitData/series for multi-layer
ring charts.
🧹 Nitpick comments (1)
packages/vue/src/huicharts/huicharts-ring/src/ring.ts (1)

134-195: Consider renaming getDataOrSeries for clarity.

The function name getDataOrSeries suggests it returns either data or series (exclusive OR), but with the fix it now returns both properties when levelFlag is true. Consider renaming to something like getChartData or getDataAndSeries to better reflect its behavior.

}

return levelFlag ? { series } : { data: getLimitData(innerData) }
return levelFlag ? { series, data: getLimitData(innerData) } : { data: getLimitData(innerData) }
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# First, let's locate and examine the actual file
cat -n packages/vue/src/huicharts/huicharts-ring/src/ring.ts | sed -n '190,200p'

Repository: opentiny/tiny-vue

Length of output: 178


🏁 Script executed:

# Search for ichart library imports and type definitions
rg -n 'import.*ichart|from.*ichart' packages/vue --type=ts --type=js | head -20

Repository: opentiny/tiny-vue

Length of output: 2178


🏁 Script executed:

# Look for type definitions or interfaces related to ichart options
fd -e d.ts -e ts -path '*/node_modules/@*ichart*' 2>/dev/null | head -10

Repository: opentiny/tiny-vue

Length of output: 43


🏁 Script executed:

# Search for ichart usage with series and data properties
rg -n -C3 'series\s*:.*data\s*:' packages/vue --type=ts --type=js | head -40

Repository: opentiny/tiny-vue

Length of output: 43


🏁 Script executed:

# Check how getLegend function is used and what it expects
rg -n -B5 -A5 'getLegend' packages/vue/src/huicharts/huicharts-ring/src/ring.ts

Repository: opentiny/tiny-vue

Length of output: 796


🏁 Script executed:

# Look for other ring chart implementations to understand the pattern
find packages/vue -name "*.ts" -path "*/ring*" -o -name "*.ts" -path "*/donut*" | xargs rg -l "series.*data" 2>/dev/null

Repository: opentiny/tiny-vue

Length of output: 114


🏁 Script executed:

# Check the full getLegend function body to see if innerData is used
cat -n packages/vue/src/huicharts/huicharts-ring/src/ring.ts | sed -n '197,240p'

Repository: opentiny/tiny-vue

Length of output: 1573


🏁 Script executed:

# Check how ichartLegend and dataOrSeries are merged into ichartOption
cat -n packages/vue/src/huicharts/huicharts-ring/src/ring.ts | sed -n '270,290p'

Repository: opentiny/tiny-vue

Length of output: 687


🏁 Script executed:

# Search for other chart types that use level to see if they also return both series and data
rg -n 'levelFlag.*series.*data' packages/vue --type=ts | head -20

Repository: opentiny/tiny-vue

Length of output: 341


🏁 Script executed:

# Look for tests or examples that show how multi-layer ring charts are used
find packages/vue -name "*.test.ts" -o -name "*.spec.ts" | xargs rg -l "ring\|donut" 2>/dev/null | head -5

Repository: opentiny/tiny-vue

Length of output: 43


Pass innerData to getLegend function when calling at line 263.

The change at line 194 is correct—ichart requires both series (for layer-specific data) and data (for the full dataset) in multi-layer ring charts. However, there is a critical bug: the getLegend function (line 198) destructures innerData and uses it when level is present (line 222), but the function call at line 263 does not pass innerData as a parameter. This causes ichartLegend.data to be undefined for multi-layer charts, breaking legend rendering.

Update line 263 to:

const ichartLegend = getLegend({ legendVisible, dimension, innerRows, legendLimit, level, limitShowNum, innerData })
🤖 Prompt for AI Agents
In `@packages/vue/src/huicharts/huicharts-ring/src/ring.ts` at line 194, The call
to getLegend is missing innerData, so when level is present the function
destructures innerData and ends up with ichartLegend.data undefined; update the
getLegend invocation (the one that builds ichartLegend) to include innerData in
its argument object (e.g., pass innerData along with legendVisible, dimension,
innerRows, legendLimit, level, limitShowNum) so getLegend receives the full
dataset used by getLimitData/series for multi-layer ring charts.

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

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant