Sha256: 75d78b4a476756af84b7ae351ab1b3a2b4d788df0e8c71edadc7c4181f376b72

Contents?: true

Size: 1.55 KB

Versions: 13

Compression:

Stored size: 1.55 KB

Contents

;(function(Kiddo, d3){
  Kiddo.Axes = function(){
    var self = this;

    var makeXAxis = function(){
      return d3.svg.axis()
        .scale(self.x)
        .orient("bottom")
        .ticks(6);
    }

    var makeYAxis = function(){
      return d3.svg.axis()
        .scale(self.y)
        .orient("left")
        .tickFormat(d3.format(',d'));
    }

    var xAxis = makeXAxis();
    var yAxis = makeYAxis();

    return {
      x: xAxis,
      y: yAxis,
      render: function(svg, yTitle){
          svg.append("g")
              .attr("class", "grid")
              .attr("transform", "translate(" + self.margin_left + "," + self.height + ")")
              .call(makeXAxis().tickSize(-self.height, 0, 0).tickFormat(""));

          svg.append("g")
              .attr("class", "grid")
              .attr("transform", "translate(" + self.margin_left + ",0)")
              .call(makeYAxis().tickSize(-self.width, 0, 0).tickFormat(""));

          svg.append("g")
              .attr("class", "x axis")
              .attr("transform", "translate(" + self.margin_left + "," + self.height + ")")
              .call(xAxis);

          svg.append("g")
              .attr("class", "y axis")
              .attr("transform", "translate(" + self.margin_left + ",0)")
              .call(yAxis);
              //.append("text")
              //.attr("transform", "rotate(-90)")
              //.attr("y", 6)
              //.attr("dy", ".71em")
              //.style("text-anchor", "end")
              //.text(yTitle);

      }
    };
  };
})(window.Kiddo = window.Kiddo || {}, d3)

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
kanaui-4.0.2 app/assets/javascripts/kanaui/kiddo/axes.js
kanaui-4.0.1 app/assets/javascripts/kanaui/kiddo/axes.js
kanaui-2.2.1 app/assets/javascripts/kanaui/kiddo/axes.js
kanaui-4.0.0 app/assets/javascripts/kanaui/kiddo/axes.js
kanaui-2.1.3 app/assets/javascripts/kanaui/kiddo/axes.js
kanaui-2.1.2 app/assets/javascripts/kanaui/kiddo/axes.js
kanaui-2.1.1 app/assets/javascripts/kanaui/kiddo/axes.js
kanaui-2.1.0 app/assets/javascripts/kanaui/kiddo/axes.js
kanaui-2.0.0 app/assets/javascripts/kanaui/kiddo/axes.js
kanaui-1.0.0 app/assets/javascripts/kanaui/kiddo/axes.js
kanaui-0.6.1 app/assets/javascripts/kanaui/kiddo/axes.js
kanaui-0.6.0 app/assets/javascripts/kanaui/kiddo/axes.js
kanaui-0.5.1 app/assets/javascripts/kanaui/kiddo/axes.js