-
Notifications
You must be signed in to change notification settings - Fork 69
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
[BUGFIX] Line highlight on hover refactor using ECharts dispatch #1112
Conversation
Signed-off-by: Steven Cobb <[email protected]>
Signed-off-by: Steven Cobb <[email protected]>
Signed-off-by: Steven Cobb <[email protected]>
…s yBuffer Signed-off-by: Steven Cobb <[email protected]>
It's sort of separate from your change here, but I find our current approach to be kind of confusing in some cases like this one where you get this tooltip flicker of some items that occasionally have peaks near where you're moving the mouse left/right. I wonder if we need to have some chats with UX about the ideal behavior for tooltips/highlights/etc., so we can identify an ideal behavior for tooltip/emphasis/etc. we want to work towards. Screen.Recording.2023-04-17.at.10.56.50.AM.mov |
Separate from my previous note, the lines seem extra flicker-y with this change. My guess is that the highlight & downplay events you're triggering are still fighting with the highlight/trigger events from the axis pointer. Screen.Recording.2023-04-17.at.11.25.03.AM.mov |
Signed-off-by: Steven Cobb <[email protected]>
Signed-off-by: Steven Cobb <[email protected]>
Signed-off-by: Steven Cobb <[email protected]>
Signed-off-by: Steven Cobb <[email protected]>
Signed-off-by: Steven Cobb <[email protected]>
Using the nightly build, your fix in ECharts is definitely helping with the flicker! One downside is when we set This was something I wanted to do anyways and it makes sense to go out with the highlighting improvements, since having better highlighting makes up for cases when symbols don't render (note: HIDE_DATAPOINTS_LIMIT condition is also important since rendering too many symbols can hurt performance). |
I've adjusted variables that control how many series show and added a new SHOW_MORE_NEARBY_SERIES_LIMIT condition that will help with this. Now when there are 5 or less series, it will almost always show all 5, but when there are more series than will fit in the tooltip (w/o pinning and scrolling), the yBuffer area is smaller. It doesn't completely address your concern, but between that and fixing the line color flicker using triggerEmphasis, it is a big improvement. I am planning to add panel options to override default tooltip behavior in the future. I need to sync with Mohit again, but these options could make sense:
|
ui/panels-plugin/src/plugins/time-series-chart/utils/data-transform.ts
Outdated
Show resolved
Hide resolved
@@ -55,6 +57,14 @@ export function getLineSeries( | |||
): EChartsTimeSeries { | |||
const lineWidth = visual.line_width ?? DEFAULT_LINE_WIDTH; | |||
const pointRadius = visual.point_radius ?? DEFAULT_POINT_RADIUS; | |||
|
|||
// Shows datapoint symbols when selected time range is roughly 15 minutes or less | |||
let showPoints = data.length <= HIDE_DATAPOINTS_LIMIT; |
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.
What are datapoint symbols?
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 think this is the little circle shown at points. It's called a "symbol" because you can use a variety of shapes. @sjcobb, correct me if I got that wrong.
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.
Still seeing a bit of flickering when you hover directly over lines. Any idea of that's something that can be worked around easily with some of the series emphasis settings? If not, I don't think it's too bad and can be revisited later. Screen.Recording.2023-05-01.at.3.09.09.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.
A couple small nits from me and Christine, but generally LGTM! Can you double-check with other folks that they're also ok with using the nightly before merging this?
ui/panels-plugin/src/plugins/time-series-chart/utils/data-transform.ts
Outdated
Show resolved
Hide resolved
Signed-off-by: Steven Cobb <[email protected]>
I'm seeing a tiny of flicker locally with that same graph, but it isn't nearly as bad as in your recording 😕 |
… using defaults Signed-off-by: Steven Cobb <[email protected]>
Signed-off-by: Steven Cobb <[email protected]>
Signed-off-by: Steven Cobb <[email protected]>
Signed-off-by: Steven Cobb <[email protected]>
Signed-off-by: Steven Cobb <[email protected]>
Signed-off-by: Steven Cobb <[email protected]>
…eries do not get out of sync with tooltip data Signed-off-by: Steven Cobb <[email protected]>
Signed-off-by: Steven Cobb <[email protected]>
…n getNearbySeries Signed-off-by: Steven Cobb <[email protected]>
…inter.triggerEmphasis prop fixes perf issues seen previously Signed-off-by: Steven Cobb <[email protected]>
Signed-off-by: Steven Cobb <[email protected]>
Signed-off-by: Steven Cobb <[email protected]>
…ocused series Signed-off-by: Steven Cobb <[email protected]>
…ighted series Signed-off-by: Steven Cobb <[email protected]>
Signed-off-by: Steven Cobb <[email protected]>
Signed-off-by: Steven Cobb <[email protected]>
TBD - need to fix flicker issue due to limitation described in: apache/echarts#18495UPDATE: Flicker issue is fixed now using Julie's
axisPointer.triggerEmphasis
approach, this PR is ready for review!Overview
Early on in the Perses project, we decided to build a custom tooltip with React so that we could have full control. This allows us to only show nearby series in the tooltip, better performance with 1000+ series, and ability to easily format the tooltip differently depending on the number of focused series. Since we went down this path, that also means we need to build custom highlighting behavior since the number of focused series can vary depending on what is set in our
yBuffer
param in thegetNearbySeries
function.This PR improves the implementation by using EChart's dispatch API so we can trigger custom highlight and downplay actions depending on seriesIndex conditions and which series are currently in the
currentFocusedData
array.Now hover styles are applied correctly so that only the focused series showing in the tooltip are emphasized!
The blur workaround in #1107 is also no longer needed.
Screen Recordings
Loom demo showing changes and ECharts dispatch API docs
Local example 1
https://user-images.githubusercontent.com/9369625/232504585-8ee1b0fd-41da-4f00-8238-4d4435668c71.mp4
Local example 2
https://user-images.githubusercontent.com/9369625/232507723-7a4c1088-2283-49ae-8cac-7b6fe33c3755.mp4
Checklist
[<catalog_entry>] <commit message>
naming convention using one of the followingcatalog_entry
values:FEATURE
,ENHANCEMENT
,BUGFIX
,BREAKINGCHANGE
,IGNORE
.UI Changes