Skip to content

Commit

Permalink
added config option to activate and deactivate data overlays
Browse files Browse the repository at this point in the history
  • Loading branch information
santilland committed Mar 1, 2021
1 parent 45f24fe commit 3a6076c
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion dist/graphly.min.js

Large diffs are not rendered by default.

24 changes: 22 additions & 2 deletions src/graphly.js
Original file line number Diff line number Diff line change
Expand Up @@ -6102,6 +6102,10 @@ class graphly extends EventEmitter {

const currType = overlayData[coll][keyPar][j];
const overlayType = typeDef.find((item) => item.match(currType));
if(overlayType.hasOwnProperty('active') && !overlayType.active){
continue;
}

let rC = defaultColor;

if (typeof overlayType !== 'undefined' && overlayType.hasOwnProperty('style')) {
Expand Down Expand Up @@ -7875,11 +7879,22 @@ class graphly extends EventEmitter {
if (typeof equalLabel !== 'undefined'){
return;
}

parDiv.append('div')
const textDiv = parDiv.append('div')
.style('display', 'inline')
.style('cursor', 'pointer')
.html(displayName);

textDiv.on('click', () => {
if(typedef.hasOwnProperty('active')){
typedef.active = !typedef.active;
} else {
typedef.active = false;
}
this.emit('axisChange');
this.createParameterInfo();
this.renderData();
});

// Update size of rect based on size of original div
if ( parInfEl.node() !== null ) {
let boundRect = parInfEl.node().getBoundingClientRect();
Expand All @@ -7895,6 +7910,11 @@ class graphly extends EventEmitter {
.attr('x', 153)
.text(displayName);

if(typedef.hasOwnProperty('active') && !typedef.active){
textDiv.style('text-decoration', 'line-through');
labelText.attr('text-decoration', 'line-through')
}

let labelBbox = labelText.node().getBBox();

let iconSvg = parDiv.insert('div', ':first-child')
Expand Down
3 changes: 2 additions & 1 deletion test/scripts/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ var overlaySettings = {
symbol: 'rectangle_empty',
size: 20,
color: [0, 0, 1.0, 0.8],
}
},
active: false,
},
{
match: function(val){return val === 2},
Expand Down

0 comments on commit 3a6076c

Please sign in to comment.