Files
growstuff/app/assets/javascripts/graphs/height_scale.js
Brenda Wallace a23e241480 Eslint clean ups
2016-12-07 12:22:33 +13:00

29 lines
588 B
JavaScript

//=require d3
/*
Height Scale is used to map the number of bars to the display size of
the svg
*/
(function(){
'use strict';
var growstuff = (window.growstuff = window.growstuff || {});
function HeightScale(data){
this._data = data;
}
HeightScale.prototype.render = function(){
var data = this._data;
var scaleType = data.height.scale;
var axisSize = data.height.size;
return d3.scale[scaleType]()
.domain(d3.range(data.bars.length))
.rangeRoundBands([0, data.height.size], 0.05, 0);
};
growstuff.HeightScale = HeightScale;
}());