File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed
Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change 405405 var diff = [ ] , ds = scope . $eval ( attrs . source ) , unbinder ;
406406 var changeHandler = function ( newValue , oldValue ) {
407407 var $chartElem = $ ( element ) , chart = $chartElem . data ( "igDataChart" ) ;
408+ if ( newValue && ( oldValue === undefined || oldValue === null ) ) {
409+ $chartElem . igDataChart ( "option" , "dataSource" , newValue ) ;
410+ return ;
411+ }
408412 /* check for a change of the data source. In this case rebind */
409- if ( chart . dataSources [ chart . _containerSourceID ] . data ( ) !== newValue ) {
413+ if ( chart . dataSources [ chart . _containerSourceID ] &&
414+ chart . dataSources [ chart . _containerSourceID ] . data ( ) !== newValue ) {
410415 $chartElem . igDataChart ( "option" , "dataSource" , newValue ) ;
411416 return ;
412417 }
413- if ( newValue . length === oldValue . length ) {
418+ if ( newValue && oldValue && newValue . length === oldValue . length ) {
414419 //attempt to optimize for value changes
415420 var equals = equalsDiff ( newValue , oldValue , diff ) ;
416421 if ( ( diff . length > 0 ) && ! equals ) {
424429 return ;
425430 }
426431 }
427- $chartElem . igDataChart ( "notifyClearItems" , newValue ) ;
432+ if ( newValue ) {
433+ $chartElem . igDataChart ( "notifyClearItems" , newValue ) ;
434+ }
428435 } ;
429436
430437 //handle push to track added data points, unbind and rebind watcher after.
You can’t perform that action at this time.
0 commit comments