javascriptdc.jsinterval-tree

Interval Tree: Uncaught TypeError: Cannot read property 'mid' of null


I am trying to visualize the count of datasets that falls into particular range(Start Date and End Date). Following example from this I was able to do that. My code is here. The visualization at the bottom allow the user to filter the year range. The result of the filter shows up at the top visualization. However, if you check the console, it is giving an error as

IntervalTree.js:105 Uncaught TypeError: Cannot read property 'mid' of null

Due to which the rendering of the two visualizations are not proper. I am using Lysenko Interval Tree. I will appreciate your assistance. Example image for better clarification of problem

Example image for better clarification of problem


Solution

  • It looks like if you disable the filterHandler for the monthChart, then it fixes the problem (which I was able to reproduce, finally).

          monthChart.filterHandler(function() {});
    

    I think the problem is that the month chart is a focus chart and for whatever reason it is re-invoking the filter when it is focused. This seems like odd behavior, because the range chart has already set the filter, but probably the focus chart is not expecting this unconventional dimension.

    You aren't yet using the interval functionality in this example, so it's unclear if this is working in the larger sense, but that's the particular problem. Filtering twice also explains the weird behavior where it looked okay for a moment and then got all jagged.

    Fork of your plnkr: https://plnkr.co/edit/gNtz8glVVNneTekKrjqt?p=preview