diff --git a/src/components/DagComponent.js b/src/components/DagComponent.js index 6d38945e..541f6689 100644 --- a/src/components/DagComponent.js +++ b/src/components/DagComponent.js @@ -228,18 +228,10 @@ class DagComponent extends React.Component { .append('g') .attr('class', 'link') .append('line') - .attr('x1', function(d) { - return d.source.x; - }) - .attr('y1', function(d) { - return d.source.y; - }) - .attr('x2', function(d) { - return d.target.x; - }) - .attr('y2', function(d) { - return d.target.y; - }); + .attr('x1', d => d.source.x) + .attr('y1', d => d.source.y) + .attr('x2', d => d.target.x) + .attr('y2', d => d.target.y); this.link = this.gLinks.selectAll('line'); } @@ -252,9 +244,7 @@ class DagComponent extends React.Component { .selectAll() .data(txs) .enter() - .filter(function(d) { - return !d.isBlock; - }) + .filter(d => !d.isBlock) .append('g') .attr('class', 'tx'); @@ -294,9 +284,7 @@ class DagComponent extends React.Component { .attr('y', d => { return d.y; }) - .text(function(d) { - return d.id.substring(0, 4); - }); + .text(d => d.id.substring(0, 4)); this.tx = this.gTxs.selectAll('circle'); } @@ -309,9 +297,7 @@ class DagComponent extends React.Component { .selectAll() .data(blocks) .enter() - .filter(function(d) { - return d.isBlock; - }) + .filter(d => d.isBlock) .append('g') .attr('class', 'block'); @@ -344,9 +330,7 @@ class DagComponent extends React.Component { // Add text to show block info block - .filter(function(d) { - return d.isBlock; - }) + .filter(d => d.isBlock) .append('text') .append('tspan') .attr('class', 'block-text') @@ -358,9 +342,7 @@ class DagComponent extends React.Component { .attr('y', d => { return d.y + this.blockHeight / 2; }) - .text(function(d) { - return d.id.substring(0, 4); - }); + .text(d => d.id.substring(0, 4)); this.block = this.gBlocks.selectAll('rect'); } @@ -435,7 +417,7 @@ class DagComponent extends React.Component { /** Data from the tx being hovered */ const d = mouseEvent.currentTarget.__data__; if (this.tx) { - this.tx.style('stroke-opacity', function(o) { + this.tx.style('stroke-opacity', function changeStrokeOpacity(o) { const thisOpacity = d.links.indexOf(o.id) > -1 || d.id === o.id ? 1 : opacity; this.setAttribute('fill-opacity', thisOpacity); return thisOpacity; @@ -443,7 +425,7 @@ class DagComponent extends React.Component { } if (this.block) { - this.block.style('stroke-opacity', function(o) { + this.block.style('stroke-opacity', function changeStrokeOpacity(o) { const thisOpacity = d.links.indexOf(o.id) > -1 || d.id === o.id ? 1 : opacity; this.setAttribute('fill-opacity', thisOpacity); return thisOpacity;