this is for holding javascript data
Adrian Price-Whelan axes now transition nicely
over 10 years ago
Commit id: 9ce16c45bd9f2b72ec2676673ce41bc4c71eead8
deletions | additions
diff --git a/js/d3po.js b/js/d3po.js
index fd721b9..c75b4b1 100644
--- a/js/d3po.js
+++ b/js/d3po.js
...
cells.enter().append("g")
.attr("class", "cell");
cells.exit().remove();
cells.transition()
.duration(500)
.ease('quad-out') cells.transition().duration(500).ease('quad-out')
.attr("transform", function(p) { return "translate(" + xPlotTranslator(p) + ","
+ yPlotTranslator(p) + ")"; })
.each(plot);
// Define the brush object
var brush = d3.svg.brush()
.x(xScaler)
.y(yScaler) .x(xScaler).y(yScaler)
.on("brushstart", brushstart)
.on("brush", brushmove)
.on("brushend", brushend);
// have the cells call the brush
cells.call(brush);
// Add axes to the plots
// TODO: figure out how to give user better control over ticks?
var
xAxis xAxisD3 = d3.svg.axis()
.scale(xScaler)
.orient("bottom")
.ticks(5); .ticks(5)
.tickSize(dTickSize);
var
yAxis yAxisD3 = d3.svg.axis()
.scale(yScaler)
.orient("left")
.ticks(5);
xAxis.tickSize(dTickSize);
yAxis.tickSize(dTickSize); .ticks(5)
.tickSize(dTickSize);
// TODO: fix the axes here. should really pass in full data info, so i know about grid position, etc...
svg.selectAll(".x.axis")
.data(state["plots"])
.enter().append("g") var xAxis = d3.select("svg").selectAll(".x.axis")
.data(state["plots"]);
xAxis.enter().append("g")
.attr("class", "x axis")
xAxis.exit().remove();
xAxis.transition().duration(500).ease('quad-out')
.attr("transform", function(p, i) {
return "translate(" + xPlotTranslator(p) + ","
+ (yPlotTranslator(p) + plotSize['height'] + 15) + ")";
})
.each(function(p) }).each(function(p) {
xScaler.domain(columnDomains[p['xAxis']]);
d3.select(this).call(xAxis); d3.select(this).call(xAxisD3);
});
svg.selectAll(".y.axis")
.data(state["plots"])
.enter().append("g") var yAxis = d3.select("svg").selectAll(".y.axis")
.data(state["plots"]);
yAxis.enter().append("g")
.attr("class", "y axis")
yAxis.exit().remove();
yAxis.transition().duration(500).ease('quad-out')
.attr("transform", function(p, i) {
return "translate(" + (xPlotTranslator(p) + plotSpacing['horizontal']/2 + 10) + ","
+ yPlotTranslator(p) + ")";
})
.each(function(p) }).each(function(p) {
yScaler.domain(columnDomains[p['yAxis']]);
d3.select(this).call(yAxis); d3.select(this).call(yAxisD3);
});
// add axis labels
svg.selectAll(".x-label")
.data(state["plots"])