Hello
I am trying to add RolloverModifier to my chart. I want it to be enabled when any of the FastLineRenderableSeries is selected. I managed to do this with onSelectedChanged property. I simply set
it like: rolloverModifier.isEnabled = isSelected;
But there’s one problem – when the RolloverModifier is disabled on selecting the series the vertical line stays attached to the chart, it doesn’t move with cursor and doesn’t show tooltips, but it’s on the chart.
I would really appreciate help with that.
Maybe there’s a way to “manually” detach the line?
- Cezary Szymanski asked 2 months ago
- last edited 2 months ago
- You must login to post comments
Hi
At the moment, all isEnabled on RolloverModifier actually does is stop it receiving new mouse events, effectively locking it in place but not removing it. To stop and hide it without actually removing it (which is the ideal) you need to do
rolloverModifier.isEnabled = false;
rolloverModifier.showRolloverLine = false;
rolloverModifier.showTooltip = false;
If you want to do this when any series is selected, you should drive it off the SeriesSelectionModifier’s onSelectionChanged. eg
new SeriesSelectionModifier({ onSelectionChanged: (data) => {
const enabled = data.selectedSeries.length > 0;
rolloverModifier.isEnabled = enabled;
rolloverModifier.showRolloverLine = enabled;
rolloverModifier.showTooltip = enabled;
})
This fires once per mouse event, whereas series.onSelectedChanged will fire for the selected and deselected series, so depending on the order you may not end up in the state you expect.
Regards
David
- David Burleigh answered 2 months ago
- You must login to post comments
Please login first to submit.