updatePanes() { this.left.style.width = this.sepLeft + 'px'; this.resizerLeft.style('left', this.sepLeft + 'px'); this.right.style.width = (document.body.getBoundingClientRect().width - this.sepRight) + 'px'; this.resizerRight.style('right', (document.body.getBoundingClientRect().width - this.sepRight - 1) + 'px'); this.updateRangesPane(); this.panesUpdatedCallback(); }
viewGraphRegion(minX, minY, maxX, maxY) { const [width, height] = this.getSvgViewDimensions(); const dx = maxX - minX; const dy = maxY - minY; const x = (minX + maxX) / 2; const y = (minY + maxY) / 2; const scale = Math.min(width / dx, height / dy) * 0.9; this.svg .transition().duration(120).call(this.panZoom.scaleTo, scale) .transition().duration(120).call(this.panZoom.translateTo, x, y); }
// This function will be triggered on load function transition() { d3.selectAll("path") .data(function() { var d = layers1; layers1 = layers0; return layers0 = d; }) .transition() .duration(2500) .attr("d", area); }
s.each(function(d) { // put xp and yp into d if pixel scaling is already done var x = d.xp || xa.c2p(d.x), y = d.yp || ya.c2p(d.y), p = d3.select(this); if(isNumeric(x) && isNumeric(y)) { // for multiline text this works better if(this.nodeName === 'text') p.attr('x', x).attr('y', y); else p.attr('transform', 'translate(' + x + ',' + y + ')'); } else p.remove(); });
it('has the correct name spaces', function() { var mainSVGs = d3.selectAll('.main-svg'); mainSVGs.each(function() { var node = this; assertNamespaces(node); }); });
// could use transparent gradient overlay to vary raindrop color svg.selectAll("path") .data(d3.range(2000)) .enter().append("path") .attr("class", "pathRD") .attr("fill", "url(#gradient)") .attr("d", function() { return raindrop(10 + Math.random() * 250); }) .attr("transform", function(d) { return "rotate(" + d + ")" + "translate(" + (height / 3.8 + Math.random() * height / 5.2) + ",0)" + "rotate(90)"; });
it('has as many *point* nodes as there are traces', function() { var nodes = d3.selectAll('path.point'); var Npts = 0; mock.data.forEach(function(trace) { Npts += trace.x.length; }); expect(nodes.size()).toEqual(Npts); });