cal-heatmap icon indicating copy to clipboard operation
cal-heatmap copied to clipboard

When I jumpTo and highlight afterwards i sometime get some error

Open vladlep opened this issue 10 years ago • 4 comments

If i use jumpTo function to change the domain and the highlight function afterwards to highlight then new date

$MONTH_CALENDAR.jumpTo(newDate);
$MONTH_CALENDAR.highlight(newDate);

i sometime get an error: Uncaught TypeError: Cannot read property 'length' of undefined;

Uncaught TypeError: Cannot read property 'length' of undefined d3.js:763
bind d3.js:763
d3_selectionPrototype.data d3.js:818
CalHeatMap.fill cal-heatmap.js:1354
CalHeatMap.highlight cal-heatmap.js:2825
setDayOnMonthCalendar hours_add.js:163
(anonymous function) hours_add.js:319
jQuery.event.dispatch jquery-1.10.0.js:5107
elemData.handle

The error shows in the d3 library because wrong data is passed, I presume, and group is undefined:

  function bind(group, groupData) {
       var i, n = group.length, 

vladlep avatar Jul 14 '14 15:07 vladlep

Care to share a sample of the data in order to reproduce this issue ?

wa0x6e avatar Nov 13 '14 05:11 wa0x6e

Sorry, I actually migrated my calendar to standard Jquery.

I remember the data was one month of hours logs. So i would have timestamps for each day of the month and totals (2 decimal entries) for that day. E.g.: { timestamp(01-11-2014) : 8.00, timestamp(02-11-2014): 7.50, ...... timestamp(30-11-2014):7.80}

I realize this is not much help. I guess you can close the issue if you can not reproduce the error and somebody will report it if it appears again.

vladlep avatar Nov 15 '14 14:11 vladlep

I also got such issue, and I think it may be reproduced by triggering something like

cal.update(data);
cal.options.data = data;

while previous domain change animation is still active. At least I was able to eliminate the issue by preventing the update during animation.

Yurko-Fedoriv avatar Oct 20 '16 14:10 Yurko-Fedoriv

@Yurko-Fedoriv is right... this error occurs if an update is attempted while an animation is still in progress. I prevented it by wrapping the update in a timeout equal to the animationDuration if a jumpTo was necessary

Luiz-N avatar Nov 16 '16 00:11 Luiz-N

Merged into v4

wa0x6e avatar Nov 07 '22 04:11 wa0x6e