wefra/lib/d3-v6-oop/axis.js

28 lines
832 B
JavaScript
Raw Normal View History

Axis = {
addAxis: function(svg, axis, xTranslate, yTranslate){
return svg.append("g")
.attr("transform", "translate("+xTranslate+", "+yTranslate+")")
.call(axis);
},
addTop: function(svg, scale, xTranslate, yTranslate){
var axis = d3.axisTop(scale);
return this.addAxis(svg, axis, xTranslate, yTranslate);
},
addRight: function(svg, scale, xTranslate, yTranslate){
var axis = d3.axisRight(scale);
return this.addAxis(svg, axis, xTranslate, yTranslate);
},
addBottom: function(svg, scale, xTranslate, yTranslate){
var axis = d3.axisBottom(scale);
return this.addAxis(svg, axis, xTranslate, yTranslate);
},
addLeft: function(svg, scale, xTranslate, yTranslate){
var axis = d3.axisLeft(scale);
return this.addAxis(svg, axis, xTranslate, yTranslate);
}
};