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

Improve group focus indicator #84

Open
frankelavsky opened this issue Aug 30, 2023 · 2 comments
Open

Improve group focus indicator #84

frankelavsky opened this issue Aug 30, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed needs investigation This item needs to be looked into, additional content from issue submitter would help as well. question Further information is requested

Comments

@frankelavsky
Copy link

Hi!

The group focus indicator isn't great (especially for scatter, line, and clustered bars).

I'm talking about this:
Screenshot 2023-08-30 at 7 26 52 PM

I've got a suggested solution: filters. You're already using them for text and geometries - it's the dual-outline strategy (and white outline on text). We can use that same strategy to create some great looking group focus indicators. On focus, you'd apply the filter to a special group appended at the end of the chart (the group doesn't need to be appended on focus, just change the href values).

This "top" group contains <use> elements, which simply reference the group or element you want to duplicate:
Screenshot 2023-08-30 at 7 02 51 PM

Like this:

<g filter="url(#VCL-t-s-f-COOL-NEW-FILTER-scatter-plot-LabelCollision)">
    <use href=""></use>
    <use href=""></use>
</g>

Here's what it would look like if you group stuff up like this and apply a filter to the group:
Screenshot 2023-08-30 at 7 13 03 PM

The code for the filter looks like this:

<filter id="VCL-t-s-f-COOL-NEW-FILTER-scatter-plot-LabelCollision" class="VCL-t-s-f-COOL-NEW-FILTER-scatter-plot-LabelCollision">
    <feMorphology in="SourceAlpha" result="dilatedText" operator="dilate" radius="10"></feMorphology>
    <feFlood flood-color="#ffffff" flood-opacity="1" result="whiteTextFlood"></feFlood>
    <feComposite in="whiteTextFlood" in2="dilatedText" operator="in" result="textOutline"></feComposite>

    <feMorphology in="SourceAlpha" result="dilatedBlack" operator="dilate" radius="11.5"></feMorphology>
    <feFlood flood-color="#000" flood-opacity="1" result="blackFlood"></feFlood>
    <feComposite in="blackFlood" in2="dilatedBlack" operator="in" result="blackOutline"></feComposite>

    <feMerge>
        <feMergeNode in="blackOutline"></feMergeNode>
        <feMergeNode in="textOutline"></feMergeNode>
        <feMergeNode in="SourceGraphic"></feMergeNode>
    </feMerge>
</filter>

You can obviously change the radius values to whatever:
Screenshot 2023-08-30 at 7 16 11 PM

Here are some examples:
Screenshot 2023-08-30 at 7 08 01 PM
Screenshot 2023-08-30 at 7 11 45 PM
Screenshot 2023-08-30 at 7 14 18 PM

Of course, you can just show the filter effect on only the geometry group if you want, just don't add a <use> element for the text:
Screenshot 2023-08-30 at 7 15 02 PM

And for line, you have 3 elements (line, dot group, text):
Screenshot 2023-08-30 at 7 23 27 PM

I think this is quite an aesthetic improvement and also improves accessibility. The bounding-box style focus indicator just isn't great (I wonder who designed that...).

(Oh, and as a note: when we hover and get that dotted line effect? The components are currently accomplishing this with filters and fill effects on a duplicated element. It would actually be an improvement to copy my above solution and have a <g> element that contains <use> elements here too, and you just have to update the reference id (and add the fancy fill/filter effects to the <use> element). It's not a big deal, since the current system works. But this reduces render/draw time and only requires a paint update instead.)

@david-kutas
Copy link
Contributor

hi Frank. Thanks for this suggestion. We are looking into this.

@david-kutas david-kutas self-assigned this Sep 5, 2023
@david-kutas david-kutas added enhancement New feature or request help wanted Extra attention is needed question Further information is requested needs investigation This item needs to be looked into, additional content from issue submitter would help as well. labels Sep 5, 2023
@frankelavsky
Copy link
Author

Thanks David! I think some of the cool things about this are also totally open to design critique, as they may not always be a good choice:

  • placing the focused group on top of all other geometries
  • removing the visual overlap with other geometries
  • creating a "merged" visual effect between geometries within the group

But that being said, I do think the focus indicator as it currently works isn't great! It's quite hard to see what exactly is included in a focused group.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed needs investigation This item needs to be looked into, additional content from issue submitter would help as well. question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants