Skip to content
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

Draft
wants to merge 1 commit into
base: release
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/component/tooltip/seriesFormatTooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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); ;
Copy link
Contributor

Choose a reason for hiding this comment

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

Duplicated ; here.


// Complicated rule for pretty tooltip.
let inlineValue;
Expand Down
3 changes: 1 addition & 2 deletions src/component/tooltip/tooltipMarkup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,9 +480,8 @@ export function retrieveVisualColorForTooltipMarker(

export function retrieveVisualOpacityForTooltipMarker(
series: SeriesModel,
dataIndex: number
): number {
const style = series.getData().getItemVisual(dataIndex, 'style');
const style = series.getData().getVisual('style');
Copy link
Contributor

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

After some testing, I found that the brush operation changes the colour of the graphic item, which will result in a colour change when tooltip is used, so would it also make sense for the brush operation to change the opacity of the tooltip?

Copy link
Contributor

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.

const opacity = style.opacity;
return opacity;
}
Expand Down