Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Commit

Permalink
fix(Time Series): null check on glyph lookup. fixes #299
Browse files Browse the repository at this point in the history
  • Loading branch information
rashley-iqt committed May 6, 2019
1 parent df008aa commit 18c71de
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 15 deletions.
6 changes: 3 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,19 +364,19 @@ class App extends Component {
<div className={classNames({ [style.key]: true, [style.hidden]: datasetCount < 2 }) }>
<svg width="100%" height="60">
<g>
<g class="viz-isAdded-fixed">
<g className="viz-isAdded-fixed">
<circle cx="15" cy="15" r="10"/>
</g>
<text x="30" y="15">Added</text>
</g>
<g>
<g class="viz-isChanged-fixed">
<g className="viz-isChanged-fixed">
<circle cx="100" cy="15" r="10"/>
</g>
<text x="115" y="15">Changed</text>
</g>
<g>
<g class="viz-isRemoved-fixed">
<g className="viz-isRemoved-fixed">
<circle cx="200" cy="15" r="10"/>
</g>
<text x="215" y="15">Removed</text>
Expand Down
48 changes: 36 additions & 12 deletions src/features/visualization/d3-viz/setup-annotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,22 @@ const setupAnnotations = ({packedData, annotationRoot}) =>{

const childGlyphs = selectAll(`g.${className("isAdded-fixed")}`)
.filter((e) =>{
const ancestors = e.ancestors();
return ancestors.findIndex( a => datumKey(a) === dk) !== -1;
if(e){
const ancestors = e.ancestors();
return ancestors.findIndex( a => datumKey(a) === dk) !== -1;
}
else
return false;
});

const added = selectAll(`g.${className("isAdded")}`)
.filter((e) =>{
const ancestors = e.ancestors();
return ancestors.findIndex( a => datumKey(a) === dk) !== -1;
if(e){
const ancestors = e.ancestors();
return ancestors.findIndex( a => datumKey(a) === dk) !== -1;
}
else
return false;
});

if(!added.empty()){
Expand Down Expand Up @@ -241,14 +249,22 @@ const setupAnnotations = ({packedData, annotationRoot}) =>{

const childGlyphs = selectAll(`g.${className("isChanged-fixed")}`)
.filter((e) =>{
const ancestors = e.ancestors();
return ancestors.findIndex( a => datumKey(a) === dk) !== -1;
if(e){
const ancestors = e.ancestors();
return ancestors.findIndex( a => datumKey(a) === dk) !== -1;
}
else
return false;
});

const changed = selectAll(`g.${className("isChanged")}`)
.filter((e) =>{
const ancestors = e.ancestors();
return ancestors.findIndex( a => datumKey(a) === dk) !== -1;
if(e){
const ancestors = e.ancestors();
return ancestors.findIndex( a => datumKey(a) === dk) !== -1;
}
else
return false;
});

if(!changed.empty()){
Expand Down Expand Up @@ -295,14 +311,22 @@ const setupAnnotations = ({packedData, annotationRoot}) =>{

const childGlyphs = selectAll(`g.${className("isRemoved-fixed")}`)
.filter((e) =>{
const ancestors = e.ancestors();
return ancestors.findIndex( a => datumKey(a) === dk) !== -1;
if(e){
const ancestors = e.ancestors();
return ancestors.findIndex( a => datumKey(a) === dk) !== -1;
}
else
return false;
});

const removed = selectAll(`g.${className("isRemoved")}`)
.filter((e) =>{
const ancestors = e.ancestors();
return ancestors.findIndex( a => datumKey(a) === dk) !== -1;
if(e){
const ancestors = e.ancestors();
return ancestors.findIndex( a => datumKey(a) === dk) !== -1;
}
else
return false;
});

if(!removed.empty()){
Expand Down

0 comments on commit 18c71de

Please sign in to comment.