Skip to content

Conversation

xile611
Copy link
Contributor

@xile611 xile611 commented Sep 4, 2025

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Refactoring
  • Update dependency
  • Code style optimization
  • Test Case
  • Branch merge
  • Release
  • Site / documentation update
  • Demo update
  • Workflow
  • Other (about what?)

🔗 Related issue link

🔗 Related PR link

🐞 Bugserver case id

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English
🇨🇳 Chinese

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

🚀 Summary

copilot:summary

🔍 Walkthrough

copilot:walkthrough

@xile611 xile611 added this to the 2.0.5 milestone Sep 4, 2025
@xile611 xile611 requested a review from Copilot September 4, 2025 03:11
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug where tooltip icons don't display correctly when the shape fill color is provided as a gradient string. The fix adds proper parsing of gradient strings using the GradientParser utility.

Key changes:

  • Import GradientParser and IColor type from @visactor/vrender-core
  • Add logic to detect and parse gradient strings before processing shape fill colors
  • Update the condition that determines whether to use simple string fills versus gradient objects

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/vchart/src/plugin/components/tooltip-handler/utils/svg.ts Adds gradient string parsing logic to handle tooltip shape fills correctly
common/changes/@visactor/vchart/fix-linear-gradient-string-in-tooltip_2025-09-04-02-59.json Changelog entry documenting the gradient string tooltip fix

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@@ -11,7 +11,8 @@ export function getSvgHtml(option: ITooltipShapeActual | undefined, gradientId?:
}

const styleString = `style="display:inline-block;vertical-align:middle;"`;
const { shapeType, shapeFill, shapeStroke, shapeHollow = false } = option;
const { shapeType, shapeStroke, shapeHollow = false } = option;
let shapeFill: IColor = option.shapeFill;
Copy link
Preview

Copilot AI Sep 4, 2025

Choose a reason for hiding this comment

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

The variable reassignment changes the type from the original option.shapeFill type to IColor. This could mask type issues if option.shapeFill has a more specific type. Consider using a different variable name like parsedShapeFill to make the transformation explicit.

Suggested change
let shapeFill: IColor = option.shapeFill;
const shapeFill = option.shapeFill;

Copilot uses AI. Check for mistakes.

xuefei1313
xuefei1313 previously approved these changes Sep 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants