d3.selectAll('line.route') .attr('x1', d => projection([d.from.lon, d.from.lat])[0]) .attr('y1', d => projection([d.from.lon, d.from.lat])[1]) .attr('x2', d => projection([d.to.lon, d.to.lat])[0]) .attr('y2', d => projection([d.to.lon, d.to.lat])[1]);
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); });
d3.select(node).select('svg') .on("mousemove", function(){ var mousex = d3.mouse(this); mousex = mousex[0] + 10; d3.selectAll('.remove').style("left", mousex + "px" ); }) .on("mouseover", function(){ var mousex = d3.mouse(this); mousex = mousex[0] + 10; d3.selectAll('.remove').style("left", mousex + "px"); });
describe('Bundle with choropleth', function() { 'use strict'; Plotly.register(PlotlyChoropleth); var mock = require('@mocks/geo_multiple-usa-choropleths.json'); beforeEach(function(done) { Plotly.plot(createGraphDiv(), mock.data, mock.layout).then(done); }); afterEach(destroyGraphDiv); it('should graph choropleth traces', function() { var nodes = d3.selectAll('g.trace.choropleth'); expect(nodes.size()).toEqual(4); }); });
function applyFunctions(){ var timeout = setTimeout(function() { d3.select("input[value=\"grouped\"]").property("checked", true).each(change); }, 2000); d3.selectAll("input").on("change", change); function change() { clearTimeout(timeout); if (this.value === "grouped") transitionGrouped(); else transitionStacked(); } }
function zoomed() { var body = d3.select('body'); var circle = d3.selectAll('circle'); var transform = d3.event.transform; circle.attr("transform", function(d) { return "translate(" + transform.applyX(d[0]) + "," + transform.applyY(d[1]) + ")"; }); }
function transitionStacked() { y.domain([0, yStackMax]); var rect = d3.selectAll("rect"); rect.transition() .duration(500) .delay(function(d, i) { return i * 10; }) .attr("y", function(d) { return y(d.y0 + d.y); }) .attr("height", function(d) { return y(d.y0) - y(d.y0 + d.y); }) .transition() .attr("x", function(d) { return x(d.x); }) .attr("width", x.rangeBand()); }
// 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); }
it('has the correct name spaces', function() { var mainSVGs = d3.selectAll('.main-svg'); mainSVGs.each(function() { var node = this; assertNamespaces(node); }); });
function countShapeLowerLayerNodes() { return d3.selectAll('.layer-below > .shapelayer').size(); }