Browse files

Merge branch 'fix-axis-tick-class' into 3.0.6

  • Loading branch information...
2 parents 8ad35ce + a4de685 commit 0bfa933c36fcc7ed8c625a57e28db25213f0e7b6 @mbostock mbostock committed Feb 6, 2013
Showing with 21 additions and 28 deletions.
  1. +8 −11 d3.js
  2. +4 −4 d3.min.js
  3. +3 −6 src/core/random.js
  4. +6 −7 src/svg/axis.js
View
19 d3.js
@@ -201,13 +201,10 @@ d3 = function() {
return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r);
};
},
- logNormal: function(µ, σ) {
- var n = arguments.length;
- if (n < 2) σ = 1;
- if (n < 1) µ = 0;
- var random = d3.random.normal();
+ logNormal: function() {
+ var random = d3.random.normal.apply(d3, arguments);
return function() {
- return Math.exp(µ + σ * random());
+ return Math.exp(random());
};
},
irwinHall: function(m) {
@@ -3321,13 +3318,13 @@ d3 = function() {
g.each(function() {
var g = d3.select(this);
var ticks = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain() : tickValues, tickFormat = tickFormat_ == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String : tickFormat_;
- var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide), subtick = g.selectAll(".minor").data(subticks, String), subtickEnter = subtick.enter().insert("line", "g").attr("class", "tick minor").style("opacity", 1e-6), subtickExit = d3.transition(subtick.exit()).style("opacity", 1e-6).remove(), subtickUpdate = d3.transition(subtick).style("opacity", 1);
- var tick = g.selectAll("g").data(ticks, String), tickEnter = tick.enter().insert("g", "path").style("opacity", 1e-6), tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(), tickUpdate = d3.transition(tick).style("opacity", 1), tickTransform;
- var range = d3_scaleRange(scale), path = g.selectAll(".domain").data([ 0 ]), pathUpdate = d3.transition(path);
+ var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide), subtick = g.selectAll(".tick.minor").data(subticks, String), subtickEnter = subtick.enter().insert("line", ".tick").attr("class", "tick minor").style("opacity", 1e-6), subtickExit = d3.transition(subtick.exit()).style("opacity", 1e-6).remove(), subtickUpdate = d3.transition(subtick).style("opacity", 1);
+ var tick = g.selectAll(".tick.major").data(ticks, String), tickEnter = tick.enter().insert("g", "path").attr("class", "tick major").style("opacity", 1e-6), tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(), tickUpdate = d3.transition(tick).style("opacity", 1), tickTransform;
+ var range = d3_scaleRange(scale), path = g.selectAll(".domain").data([ 0 ]), pathUpdate = (path.enter().append("path").attr("class", "domain"),
+ d3.transition(path));
var scale1 = scale.copy(), scale0 = this.__chart__ || scale1;
this.__chart__ = scale1;
- path.enter().append("path").attr("class", "domain");
- tickEnter.append("line").attr("class", "tick");
+ tickEnter.append("line");
tickEnter.append("text");
var lineEnter = tickEnter.select("line"), lineUpdate = tickUpdate.select("line"), text = tick.select("text").text(tickFormat), textEnter = tickEnter.select("text"), textUpdate = tickUpdate.select("text");
switch (orient) {
View
8 d3.min.js
4 additions, 4 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
9 src/core/random.js
@@ -13,13 +13,10 @@ d3.random = {
return µ + σ * x * Math.sqrt(-2 * Math.log(r) / r);
};
},
- logNormal: function(µ, σ) {
- var n = arguments.length;
- if (n < 2) σ = 1;
- if (n < 1) µ = 0;
- var random = d3.random.normal();
+ logNormal: function() {
+ var random = d3.random.normal.apply(d3, arguments);
return function() {
- return Math.exp(µ + σ * random());
+ return Math.exp(random());
};
},
irwinHall: function(m) {
View
13 src/svg/axis.js
@@ -20,30 +20,29 @@ d3.svg.axis = function() {
// Minor ticks.
var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide),
- subtick = g.selectAll(".minor").data(subticks, String),
- subtickEnter = subtick.enter().insert("line", "g").attr("class", "tick minor").style("opacity", 1e-6),
+ subtick = g.selectAll(".tick.minor").data(subticks, String),
+ subtickEnter = subtick.enter().insert("line", ".tick").attr("class", "tick minor").style("opacity", 1e-6),
subtickExit = d3.transition(subtick.exit()).style("opacity", 1e-6).remove(),
subtickUpdate = d3.transition(subtick).style("opacity", 1);
// Major ticks.
- var tick = g.selectAll("g").data(ticks, String),
- tickEnter = tick.enter().insert("g", "path").style("opacity", 1e-6),
+ var tick = g.selectAll(".tick.major").data(ticks, String),
+ tickEnter = tick.enter().insert("g", "path").attr("class", "tick major").style("opacity", 1e-6),
tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(),
tickUpdate = d3.transition(tick).style("opacity", 1),
tickTransform;
// Domain.
var range = d3_scaleRange(scale),
path = g.selectAll(".domain").data([0]),
- pathUpdate = d3.transition(path);
+ pathUpdate = (path.enter().append("path").attr("class", "domain"), d3.transition(path));
// Stash a snapshot of the new scale, and retrieve the old snapshot.
var scale1 = scale.copy(),
scale0 = this.__chart__ || scale1;
this.__chart__ = scale1;
- path.enter().append("path").attr("class", "domain");
- tickEnter.append("line").attr("class", "tick");
+ tickEnter.append("line");
tickEnter.append("text");
var lineEnter = tickEnter.select("line"),

0 comments on commit 0bfa933

Please sign in to comment.