@@ -215,7 +215,7 @@ export default class PlotSeries extends Model {
215215 this . domainObject ,
216216 ( data ) => {
217217 // We cannot assume that the incoming data is chronologically sound, so sorted = false
218- this . addAll ( _ ( data ) . sortBy ( this . getXVal ) , false ) ;
218+ this . addAll ( _ ( data ) . sortBy ( this . getXVal ) . value ( ) , false ) ;
219219 } ,
220220 {
221221 filters : this . filters ,
@@ -438,6 +438,7 @@ export default class PlotSeries extends Model {
438438 let insertIndex = data . length ;
439439 const currentYVal = this . getYVal ( newData ) ;
440440 const lastYVal = this . getYVal ( data [ insertIndex - 1 ] ) ;
441+ const currentXVal = this . getXVal ( newData ) ;
441442
442443 if ( this . isValueInvalid ( currentYVal ) && this . isValueInvalid ( lastYVal ) ) {
443444 console . warn ( `[Plot] Invalid Y Values detected: ${ currentYVal } ${ lastYVal } ` ) ;
@@ -446,14 +447,14 @@ export default class PlotSeries extends Model {
446447 }
447448
448449 // if the first new data point has an X value > the last data point we already have, stick it at the end.
449- const isDataInThePast = this . getXVal ( newData [ 0 ] ) <= this . getXVal ( data [ insertIndex - 1 ] ) ;
450+ const isDataInThePast = currentXVal <= this . getXVal ( data [ insertIndex - 1 ] ) ;
450451 if ( ! sorted && isDataInThePast ) {
451452 insertIndex = this . sortedIndex ( newData ) ;
452- if ( this . getXVal ( data [ insertIndex ] ) === this . getXVal ( newData ) ) {
453+ if ( this . getXVal ( data [ insertIndex ] ) === currentXVal ) {
453454 return ;
454455 }
455456
456- if ( this . getXVal ( data [ insertIndex - 1 ] ) === this . getXVal ( newData ) ) {
457+ if ( this . getXVal ( data [ insertIndex - 1 ] ) === currentXVal ) {
457458 return ;
458459 }
459460 }
0 commit comments