Chart crashes if there is a trendline or other "displayOnHover" component but highlight
is not set on the legend
#27
Labels
bug
Something isn't working
Provide a general summary of the issue here
If you create a chart and add a component that supports
displayOnHover
likeTrendline
orMetricRange
and setdisplayOnHover
totrue
, buthighlight
is not set orfalse
on theLegend
, then the chart crashes and burns.🤔 Expected Behavior?
You shouldn't need to have
highlight
set totrue
on the legend fordisplayOnHover
to work.😯 Current Behavior
If
highlight
is false and on the legend,displayOnHover
causes the chart to crash.💁 Possible Solution
The issue is that
getHoverRules()
inlineUtils.ts
is adding alegendRule
.This rule references the
highlighedSeries
which is a signal that gets added by the legendhighlight
prop. If that prop is false, the signal doesn't get added.This logic should be pulled out of
lineUtils.ts
and instead should live inlegendHighlightUtils.ts
. This hover rule ondisplayOnHover
components should only be added whenhighlight
istrue
on theLegend
.🔦 Context
No response
🖥️ Steps to Reproduce
In storybook dev, in
Trendline.story.tsx
, removehighlight
from theLegend
in theTrendlineStoryWithoutTooltip
.Then serve storybook and open the Trendline > Display On Hover story. No chart will appear and you will see an error in the console.
Version
0.0.1-alpha.7
What browsers are you seeing the problem on?
Chrome
If other, please specify.
No response
What operating system are you using?
Mac
🧢 Your Company/Team
Adobe/Analytics
🕷 Tracking Issue
No response
The text was updated successfully, but these errors were encountered: