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

hightlight when hovered over #409

Closed
hz2018tv opened this issue Dec 20, 2020 · 6 comments
Closed

hightlight when hovered over #409

hz2018tv opened this issue Dec 20, 2020 · 6 comments
Labels
question Further information is requested

Comments

@hz2018tv
Copy link

in the high-low-band demo, is it possible to make the middle dotted line highlighted when cursor hovers over, e.g. thicker but kept the same color? thanks

I am not sure if it is part of the non-features.

@leeoniya
Copy link
Owner

sounds like another vote for #403?

@hz2018tv
Copy link
Author

kind of. the hightlight can be done by width/rad change, or color change, or style change or combos of aboves, or some other ways. also the target may not be lines, it could also be group of dots or others.

@leeoniya
Copy link
Owner

the hightlight can be done by width/rad change, or color change, or style change or combos of aboves

i assume you've seen https://leeoniya.github.io/uPlot/demos/focus-cursor.html which can be enabled for the band demo as well. there's probably not a way currently to isolate this behavior to just a single series.

also the target may not be lines, it could also be group of dots or others

when scatter/bubble is implemented (#107), then probably there will have to be support for hovering points/circles as well. however, there is no plan to add more complex hover detection. unlike html & svg, canvas does not provide these things out of the box, so everything has to be done in javascript, which adds a ton of code and complexity for not a lot of benefit. if you need something more complex, then an svg-based charting library is probably more suitable for your use-case.

@hz2018tv
Copy link
Author

hz2018tv commented Dec 20, 2020

points taken. agree with you that we want to keep this lib lean and clean.

back to this issue. what I am currently doing is that, for an obj that is pushed into a drawing array, I assign a groupId, so that when an element is hovered, I will search for all objs with same groupId, then changes their line width, then redraw. not many lines of codes though. just feel like it could be useful to put these in a lib, say, adding groupId field, adding group callback function handle upon hovering events so users can put their own implementations like change color, rad, etc.

BTW, just took a look at the focus_cursor demo, it does get very close to the goal. the seriesIdx is close to the groupId, also it reports the group event which is the hovering in/out, then what we need is the group event function that will have default behavior (could be dummy for nothing) and can be overloaded by users' own implementations.

@leeoniya
Copy link
Owner

i think this is a bit too case-specific to add to the core, since it takes very little effort to do externally, i'm going to leave it as-is.

as for dynamic line width, it actually turns out that handling this consistently across the full API is not a simple change, but if you're okay with just increasing the line width and not affecting point sizes, then it's very easy to do externally. i've added this behavior to the focus-cursor demo. please see #403 (comment) for more details.

@leeoniya leeoniya added the question Further information is requested label Dec 21, 2020
@hz2018tv
Copy link
Author

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants