-
I'm having trouble loading the crosshair plugin (1.1.6) on Chart.js 3.3.0 (the plugin generates many errors such as type errors for undefined items when adding non-interpolated items). I also tried just using the interpolation portion of crosshair but it fails at the same points so I thought to try and write a very simple custom one. However, using the crosshair as an example I don't seem to be returning the points correctly because chart.js itself crashes out. I'm using the min version so the location is: chart.3.3.0.min.js:13:147205 so the specific text of the code is {label:a,value:r}=s.getLabelAndValue(o); and the browser reports that s is null. I believe this is line 119 in src/plugins/plugin.tooltip.js The only thing I want to do is interpolate points on all visible datasets to use in a custom tooltip because some of the datasets are sparse compared to others so I want to be able to get an intermediate value. The available interaction modes don't do this or gather the wrong values and without crosshair working I don't have access to its interpolation routine. Here are the critical parts of the code I've written thus far based on what is in crosshair (skipping the calculations which I know work since I've single stepped through that part) so I'd appreciate help figuring out what should truly go into a point to be returned to chart.js that will make it happy.
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 13 replies
-
The croshair plugin is not compatible with chart.js version 3 at the moment |
Beta Was this translation helpful? Give feedback.
-
Chart.js v3 line has build in interpolation. Passing that to the tooltip is not straight forward, but can be done: https://codepen.io/kurkle/pen/WNpdwgE (updated for not interpolating hidden lines) |
Beta Was this translation helpful? Give feedback.
-
@kurkle |
Beta Was this translation helpful? Give feedback.
Chart.js v3 line has build in interpolation. Passing that to the tooltip is not straight forward, but can be done: https://codepen.io/kurkle/pen/WNpdwgE (updated for not interpolating hidden lines)