Replies: 3 comments 11 replies
-
I was wrong sort of. It does fix how the data is sent to the tooltip but it doesn't hide the line graph itself. So I'm still in search of where this problem should be fixed so that the tooltip receives the right set of data. Original reply: the if (!filterVisible || meta.visible) trips up as soon as you hide datasets and doesn't push all the sets. I took out the if statement and just let the push execute for all items. Then I just filter for the hidden property within the code generating the tooltip. Is there a place in the configuration where I can set filterVisible to true instead of editing the code? _getSortedDatasetMetas(filterVisible) { |
Beta Was this translation helpful? Give feedback.
-
I'd suspect your tooltip generating code to use wrong index to determine which datasets are visible. But without a reproduce thst is all I'm going to do. |
Beta Was this translation helpful? Give feedback.
-
Ok, to reproduce the problem, create a chart of multiple lines (N) and then add a very simple tooltip label callback: And assign to the tooltip (I did it as a default): This will generate a blank tooltip when hovering but the console will show the numbers 0 through N-1 for the total number of lines. Now hide one line by clicking the legend and try again. The output will be the numbers 0 through N-2 with values unrelated to the datasets themselves. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I've got a custom HTML tooltip working just fine when all my datasets are enabled/shown. However, if I hide a dataset by clicking on the legend, the tooltip code isn't given all of the possible datasets.
AssumeI have six datasets on a chart with these labels/names:
Line1, Line2, Line3, Line4, Line5, Line6
Also assume that I've instrumented the tooltip label callback with a console.log() to print out the dataset label.
When hovering over the chart and all datasets are enabled, the console shows me the six dataset labels:
Line1
Line2
Line3
Line4
Line5
Line6
Now hide dataset Line3 by clicking on its name in the legend. The legend shows the name with a strikethrough font and the line on the chart disappears. Hover over the chart again and this appears in the console:
Line1
Line2
Line3
Line4
Line5
It skips Line6. Now hide another dataset, for example Line2, and you get this:
Line1
Line2
Line3
Line4
So instead of iterating over all the lines it's apparently counting how many are visible and iterating over only that many.
There are some other oddities, too, like hiding only Line4 will result in four entries. There's nothing special in my tooltip code, it processes everything that is handed to it and I don't have any other customizations so I'm not sure where the data is stopping.
Where do I go in the code to fix this problem?
Beta Was this translation helpful? Give feedback.
All reactions