-
Notifications
You must be signed in to change notification settings - Fork 19.6k
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
fix(tooltip): get opacity from series visual #19552
base: release
Are you sure you want to change the base?
Conversation
Thanks for your contribution! The pull request is marked to be |
The changes brought by this PR can be previewed at: https://echarts.apache.org/examples/editor?version=PR-19552@77c707a |
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.
LGTM other than a small typo.
@@ -48,7 +48,7 @@ export function defaultSeriesFormatTooltip(opt: { | |||
const value = series.getRawValue(dataIndex) as any; | |||
const isValueArr = isArray(value); | |||
const markerColor = retrieveVisualColorForTooltipMarker(series, dataIndex); | |||
const markerOpacity = retrieveVisualOpacityForTooltipMarker(series, dataIndex); | |||
const markerOpacity = retrieveVisualOpacityForTooltipMarker(series); ; |
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.
Duplicated ;
here.
): number { | ||
const style = series.getData().getItemVisual(dataIndex, 'style'); | ||
const style = series.getData().getVisual('style'); |
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.
This may not be correct. With this change, the opacity in the tooltip of pie series cannot use series.data.itemStyle.opacity
.
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.
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.
I don't think so. The color should remain the same just as emphasis
color should not be used when hovered.
Brief Information
This pull request is in the type of:
fix bug introduced from #18921
What does this PR do?
before:
after:
Fixed issues
Details
Before: What was the problem?
get opacity from realtime visual color
After: How does it behave after the fixing?
Gets the series visual opacity like the legend, but the legend gets the opacity from
legendLineStyle
whendrawType
is stroke, so the legend markers are opaque in parallel series, and the default opacity of parallel series is 0.45, so the tooltip The marker's opacity is also 0.45.https://github.com/apache/echarts/blob/master/src/component/legend/LegendView.ts#L610-L615
If we set the opacity of lineStyle, the legend will respect these opacity.
demo
But for the parallel series, we set the opacity of lineStyle. At this time, the legend ignores the opacity in lineStyle.
demo
I'm not sure this is the appropriate way to fix this error, could you give me some suggestions?@Ovilia
Document Info
One of the following should be checked.
Misc
ZRender Changes
Related test cases or examples to use the new APIs
N.A.
Others
Merging options
Other information