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

Add hoverColor option #141

Merged
merged 5 commits into from
Oct 23, 2020
Merged

Add hoverColor option #141

merged 5 commits into from
Oct 23, 2020

Conversation

Techn1x
Copy link

@Techn1x Techn1x commented Nov 22, 2018

Discussed here: #95

display is set to true by default. Setting to false will hide either all annotations, or the individual annotation. Hiding the annotation essentially just makes it invisible, so that events will still trigger (useful for hover events, for example)

@Techn1x Techn1x mentioned this pull request Nov 22, 2018
src/types/box.js Outdated Show resolved Hide resolved
src/types/line.js Outdated Show resolved Hide resolved
@Techn1x
Copy link
Author

Techn1x commented Dec 14, 2018

Thanks, fixed now

@benmccann benmccann closed this Dec 14, 2018
@benmccann benmccann reopened this Dec 14, 2018
@benmccann
Copy link
Collaborator

Is there a reason we want events to fire still? That seems non-intuitive to me and I'm wondering if that could be disabled

@benmccann
Copy link
Collaborator

@Techn1x this PR will need to be rebased

@Techn1x
Copy link
Author

Techn1x commented Jan 24, 2019

Yes, in my case, I hide/show annotations when they are hovered on and off, so still need events to fire.

Perhaps the option could be renamed to be more clear, and/or have a second option named something else that removes the whole annotation (but that would probably be a different PR)

@amiedavis
Copy link

Hi, I'm about to add chartjs-plugin-annotation to a project and I would like this functionality (I need to conditionally add a line depending on where the chart is rendered from), is this PR likely to be merged soon?

@benmccann
Copy link
Collaborator

It seems unintuitive to me that you can hover over a hidden object to make it appear. I think it'd be confusing if things just started magically appearing. How would you know where you're supposed to hover?

@Techn1x
Copy link
Author

Techn1x commented Jan 30, 2019

I use it to highlight intervals in a Band Chart, without needing to use a billion ticks

untitled project
(ignore the slowness in the gif, it's due to the RDP session I was recording through, not the chart itself)

What about something like...
display: none/hidden/visible

@Techn1x
Copy link
Author

Techn1x commented Jan 30, 2019

@amiedavis Conditionally adding and removing annotations can currently be done by adding/removing them from the annotations array, it doesn't necessarily need this PR

@amiedavis
Copy link

@Techn1x thanks, that's how I'm doing it at the moment I just thought it might be neater if this was available. I will continue on without it :)

@benmccann
Copy link
Collaborator

That feature is pretty cool, but I think it's probably a bit outside the scope of the plugin, so I'm going to close this PR for now

@benmccann benmccann closed this Jan 30, 2019
@benmccann
Copy link
Collaborator

To clarify, I'm fine with the display option, but I think if an annotation is hidden it should not fire events. We can reopen if you're interested in pursuing that

@benmccann benmccann added the status: implement externally Better suited as code in the user's project or a separate plugin label Jan 30, 2019
@Techn1x
Copy link
Author

Techn1x commented Jan 31, 2019

Fair enough. So we're agreed that at least a display: true/false (either shows or removes annotation completely) is a good idea

With regards to hidden annotations, would you support either of these approaches?

  1. transparent: true/false (annotation is always in chart, but if true then all colours used in the annnotation are switched to transparent)
    OR
  2. hoverColor: rgba() etc. (each color-related attribute has a related hover attr, which is the color used when the annotation is hovered)

Setting an annotation to transparent could be done externally by setting each color, but is tedious if managing several annotations which could have different colors to remember & reapply each time you want to change the transparency

I think approach 2 is interesting because it could allow implementations other than my own, and is somewhat consistent with chart.js

@benmccann
Copy link
Collaborator

hoverColor sounds fine to me

I'll reopen this PR and you can decide whether to update this one or start a new one. Feel free to close it again in the latter case

@benmccann benmccann reopened this Jan 31, 2019
@benmccann benmccann removed the status: implement externally Better suited as code in the user's project or a separate plugin label Jan 31, 2019
@benmccann
Copy link
Collaborator

@Techn1x will you have a chance to update this PR?

@benmccann benmccann changed the title Add display option Add hoverColor option Jun 24, 2019
@Techn1x
Copy link
Author

Techn1x commented Oct 30, 2019

@benmccann I'm very sorry, shortly after january I switched employment and no longer use chartjs, and that knowledge has mostly evacuated my brain :)

@kurkle kurkle changed the base branch from master to v2 October 23, 2020 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants