lib/data/d3.js
function brush(g) {
    g.each(function() {
      var g = d3.select(this),
          bg = g.selectAll(".background").data([0]),
          fg = g.selectAll(".extent").data([0]),
          tz = g.selectAll(".resize").data(resizes, String),
          e;

      // Prepare the brush container for events.
      g
          .style("pointer-events", "all")
          .on("mousedown.brush", brushstart)
          .on("touchstart.brush", brushstart);

      // An invisible, mouseable area for starting a new brush.
      bg.enter().append("rect")
          .attr("class", "background")
          .style("visibility", "hidden")
          .style("cursor", "crosshair");

      // The visible brush extent; style this as you like!
      fg.enter().append("rect")
          .attr("class", "extent")
          .style("cursor", "move");

      // More invisible rects for resizing the extent.
      tz.enter().append("g")
          .attr("class", function(d) { return "resize " + d; })
          .style("cursor", function(d) { return d3_svg_brushCursor[d]; })
        .append("rect")
          .attr("x", function(d) { return /[ew]$/.test(d) ? -3 : null; })
          .attr("y", function(d) { return /^[ns]/.test(d) ? -3 : null; })
          .attr("width", 6)
          .attr("height", 6)
          .style("visibility", "hidden");

      // Show or hide the resizers.
      tz.style("display", brush.empty() ? "none" : null);

      // Remove any superfluous resizers.
      tz.exit().remove();

      // Initialize the background to fill the defined range.
      // If the range isn't defined, you can post-process.
      if (x) {
        e = d3_scaleRange(x);
        bg.attr("x", e[0]).attr("width", e[1] - e[0]);
        redrawX(g);
      }
      if (y) {
        e = d3_scaleRange(y);
        bg.attr("y", e[0]).attr("height", e[1] - e[0]);
        redrawY(g);
      }
      redraw(g);
    });
  }
function brush(g) {
    g.each(function() {
      var g = d3.select(this),
          bg = g.selectAll(".background").data([0]),
          fg = g.selectAll(".extent").data([0]),
          tz = g.selectAll(".resize").data(resizes, String),
          e;

      // Prepare the brush container for events.
      g
          .style("pointer-events", "all")
          .on("mousedown.brush", brushstart)
          .on("touchstart.brush", brushstart);

      // An invisible, mouseable area for starting a new brush.
      bg.enter().append("rect")
          .attr("class", "background")
          .style("visibility", "hidden")
          .style("cursor", "crosshair");

      // The visible brush extent; style this as you like!
      fg.enter().append("rect")
          .attr("class", "extent")
          .style("cursor", "move");

      // More invisible rects for resizing the extent.
      tz.enter().append("g")
          .attr("class", function(d) { return "resize " + d; })
          .style("cursor", function(d) { return d3_svg_brushCursor[d]; })
        .append("rect")
          .attr("x", function(d) { return /[ew]$/.test(d) ? -3 : null; })
          .attr("y", function(d) { return /^[ns]/.test(d) ? -3 : null; })
          .attr("width", 6)
          .attr("height", 6)
          .style("visibility", "hidden");

      // Show or hide the resizers.
      tz.style("display", brush.empty() ? "none" : null);

      // Remove any superfluous resizers.
      tz.exit().remove();

      // Initialize the background to fill the defined range.
      // If the range isn't defined, you can post-process.
      if (x) {
        e = d3_scaleRange(x);
        bg.attr("x", e[0]).attr("width", e[1] - e[0]);
        redrawX(g);
      }
      if (y) {
        e = d3_scaleRange(y);
        bg.attr("y", e[0]).attr("height", e[1] - e[0]);
        redrawY(g);
      }
      redraw(g);
    });
  }
function brush ( g ) { g . each ( function ( ) { var g = d3 . select ( this ) , bg = g . selectAll ( ".background" ) . data ( [ 0 ] ) , fg = g . selectAll ( ".extent" ) . data ( [ 0 ] ) , tz = g . selectAll ( ".resize" ) . data ( resizes , String ) , e ; // Prepare the brush container for events. g . style ( "pointer-events" , "all" ) . on ( "mousedown.brush" , brushstart ) . on ( "touchstart.brush" , brushstart ) ; // An invisible, mouseable area for starting a new brush. bg . enter ( ) . append ( "rect" ) . attr ( "class" , "background" ) . style ( "visibility" , "hidden" ) . style ( "cursor" , "crosshair" ) ; // The visible brush extent; style this as you like! fg . enter ( ) . append ( "rect" ) . attr ( "class" , "extent" ) . style ( "cursor" , "move" ) ; // More invisible rects for resizing the extent. tz . enter ( ) . append ( "g" ) . attr ( "class" , function ( d ) { return "resize " + d ; } ) . style ( "cursor" , function ( d ) { return d3_svg_brushCursor [ d ] ; } ) . append ( "rect" ) . attr ( "x" , function ( d ) { return / [ew]$ / . test ( d ) ? - 3 : null ; } ) . attr ( "y" , function ( d ) { return / ^[ns] / . test ( d ) ? - 3 : null ; } ) . attr ( "width" , 6 ) . attr ( "height" , 6 ) . style ( "visibility" , "hidden" ) ; // Show or hide the resizers. tz . style ( "display" , brush . empty ( ) ? "none" : null ) ; // Remove any superfluous resizers. tz . exit ( ) . remove ( ) ; // Initialize the background to fill the defined range. // If the range isn't defined, you can post-process. if ( x ) { e = d3_scaleRange ( x ) ; bg . attr ( "x" , e [ 0 ] ) . attr ( "width" , e [ 1 ] - e [ 0 ] ) ; redrawX ( g ) ; } if ( y ) { e = d3_scaleRange ( y ) ; bg . attr ( "y" , e [ 0 ] ) . attr ( "height" , e [ 1 ] - e [ 0 ] ) ; redrawY ( g ) ; } redraw ( g ) ; } ) ; }
the extent in data space, lazily created
the extent in data space lazily created