Files
growstuff/app/assets/javascripts/graphs/height_scale.js
Brenda Wallace 5584da02c3 Some js cleanups
2018-01-03 12:35:30 +13:00

32 lines
631 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 || {});
/**
* new heighscale object
*/
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;
}());