mirror of
https://github.com/Growstuff/growstuff.git
synced 2026-02-01 13:10:58 -05:00
29 lines
588 B
JavaScript
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;
|
|
|
|
}()); |