-
Notifications
You must be signed in to change notification settings - Fork 201
Fix/linear gradient string in tooltip #4183
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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
andIColor
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; |
There was a problem hiding this comment.
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.
let shapeFill: IColor = option.shapeFill; | |
const shapeFill = option.shapeFill; |
Copilot uses AI. Check for mistakes.
[中文版模板 / Chinese template]
🤔 This is a ...
🔗 Related issue link
🔗 Related PR link
🐞 Bugserver case id
💡 Background and solution
📝 Changelog
☑️ Self-Check before Merge
🚀 Summary
copilot:summary
🔍 Walkthrough
copilot:walkthrough