-
Notifications
You must be signed in to change notification settings - Fork 66
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
LG-4764: De-emphasize other series lines when one is hovered #2650
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: ea5096c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
disabled: true, | ||
focus: 'series', | ||
}, | ||
blur: { |
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.
Is it possible to add a transition as well? If you move horizontally across the chart, it flickers a lot because of the opacity change.
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'm not sure there's a way to transition, but I actually don't know if a transition would actually help the blinking so much. I do think this is a good callout though and would be curious to get @sooachung's thoughts on this.
@sooachung Shaneeza raises a good point about how having this emphasis on the hovered line causes a great deal of blinking when the user hovers over the chart. Wanted to check in with you about this. (Example below)
Screen.Recording.2025-01-22.at.2.46.26.PM.mov
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.
Sooa is checking with Visudha on this
|
||
export function EventMarkerLine({ | ||
position, | ||
label, | ||
message, | ||
level = EventLevel.Warning, | ||
}: EventMarkerLineProps) { | ||
}: Omit<EventMarkerLineProps, 'type'>) { |
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.
Why does EventMarkerLineProps
include type
if it needs to be omitted? Is it only needed for BaseEventMarker
?
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 might be wonky but it exists so that it can be reused by BaseEventMarker
, allowing BaseEventMarker
to accept EventMarkerLineProps | EventMarkerPointProps
, which allows a check such as if (type === 'point') position[1]
in BaseEventMarker
since TS will know if position
is an array or not based on the type
.
Essentially what it amounts to is:
export interface BaseEventMarkerProps {
label?: string;
message: string;
level: EventLevel;
position: [string | number, string | number] | string | number;
type: 'line' | 'point';
}
export interface BaseEventMarkerLineProps
extends Omit<BaseEventMarkerProps, 'name' | 'theme'> {
type: 'line';
position: string | number;
}
export interface BaseEventMarkerPointProps
extends Omit<BaseEventMarkerProps, 'name' | 'theme'> {
type: 'point';
position: [string | number, string | number];
}
export interface EventMarkerLineProps extends Omit<BaseEventMarkerLineProps, 'type'> {}
export interface EventMarkerPointProps extends Omit<BaseEventMarkerPointProps, 'type'> {}
But isntead I'm inlining the bottom two interfaces.
I'm definitely open to suggestions to making this cleaner!
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.
Actually, I think being more explicit like the example I gave makes more sense since we do ultimately export EventMarkerLineProps
and EventMarkerPointProps
. So without this, it's actually currently exporting the incorrect type. Will push a fix for this
'@lg-charts/core': patch | ||
--- | ||
|
||
Fixes series emphasis on line hover by de-emphasizing other lines |
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.
Can you also add the type changes?
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 didn't add that because it doesn't actually change what's exposed, it just cleans up the type internally for the base component so that position
can be determined by type
. But the exposed types should be the same. Is this something that we'd normally note here?
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.
It might be worth noting things that have changed internally. In case something breaks, it would be easier to track it. However, I don't feel strongly about this, so if you don't see the need to add it, that's fine with me.
…charts-line-emphasis
label?: string; | ||
message: string; | ||
level: EventLevel; | ||
position: [string | number, string | number] | string | number; | ||
type: 'line' | 'point'; | ||
} | ||
|
||
export interface BaseEventMarkerLineProps | ||
extends Omit<BaseEventMarkerProps, 'name' | 'theme'> { |
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.
It doesn't look like name
and theme
are included in BaseEventMarkerProps
✍️ Proposed changes
tooltip.trigger
set toaxis
. Due to this, theemphasis
event on a series occurs when a user hovers anywhere on the chart. So setting the line to a larger width on emphasis makes it so that all lines become wider when the cursor enters the chart.EventMarkerPoint
andEventMarkerLine
by distinguishing the position prop depending on which component it is.actions
from storybook. This was a nice to have, but is causing errors since pnpm, I believe it might be a version mismatch with storybook. It didn't add a ton of value so I just removed it.🎟 Jira ticket: LG-4764
✅ Checklist
For bug fixes, new features & breaking changes
pnpm changeset
and documented my changesFor new components
🧪 How to test changes
Screenshot