Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

nearestX ruleX sometimes disappears when parameter is a selection #508

Closed
frtennis1 opened this issue Aug 29, 2024 · 2 comments
Closed

nearestX ruleX sometimes disappears when parameter is a selection #508

frtennis1 opened this issue Aug 29, 2024 · 2 comments

Comments

@frtennis1
Copy link
Contributor

I'm working with spec that is a simplified version of the normalized stocks example from the docs and seeing some unexpected behavior:

spec = {
    "plot": [
        {
            "mark": "lineY",
            "data": {"from": "df"},
            "x": "Date",
            "y": "AdjClose",
        },
        {"select": "nearestX", "as": "$point"},
        {"mark": "ruleX", "x": "$point"},
        {
            "mark": "textX",
            "text": "$point",
            "x": "$point",
            "frameAnchor": "top",
            "lineAnchor": "bottom",
            "dy": -7,
        },
    ],
    "yLabel": "AdjClose",
    "params": {"point": {"select": "crossfilter"}},
    # "params": {"point": {"date": "2015-01-01"}},
}

When $point is a Param, the ruleX is always visible even when the mouse leaves the plot area (desirable). HoweverX when $point is a selection, about half the time when the mouse leaves the plot area, the ruleX disappears. I think I can trigger the (undesirable) disappearing behavior more often when I move the mouse quickly.

(For context, for my purpose I'm trying to get the nearestX interactor to relay into another crossfilter while also being visually displayed with the ruleX, hence why I think I need to use a selection and not a Param)

@jheer
Copy link
Member

jheer commented Sep 13, 2024

Two things going on here:

  1. There are currently some small semantic differences between Params and Selections in the nearest interactor implementation. I'll patch that up.
  2. Whether or not a nearest selection "persists" when the mouse cursor goes far away is a function of the maxRadius parameter, which defaults to 40. If you set maxRadius to a large value (like 10000) you should be able to make the rule+label persist.

@jheer
Copy link
Member

jheer commented Sep 13, 2024

Differences between params and selections fixed by 9531916.

@jheer jheer closed this as completed Sep 13, 2024
@jheer jheer mentioned this issue Sep 16, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants