[vislib/data] drop value postfix from #getYMinValue and @getYMaxValue

This commit is contained in:
Spencer Alger 2015-02-06 10:25:00 -07:00
parent 55e472bf1d
commit b35a3d9867
7 changed files with 22 additions and 24 deletions

View file

@ -329,13 +329,13 @@ define(function (require) {
};
/**
* Calculates the min y value from this.dataArray
* for each object in the dataArray.
* Calculates the lowest Y value across all charts, taking
* stacking into consideration.
*
* @method getYMinValue
* @method gitYMin
* @returns {Number} Min y axis value
*/
Data.prototype.getYMinValue = function () {
Data.prototype.gitYMin = function () {
var self = this;
var arr = [];
@ -363,15 +363,13 @@ define(function (require) {
};
/**
* Calculate the max y value from this.dataArray
* for each object in the dataArray,
* push the calculated y value to the initialized array (arr)
* return the largest value from the array
* Calculates the highest Y value across all charts, taking
* stacking into consideration.
*
* @method getYMaxValue
* @method gitYMax
* @returns {Number} Max y axis value
*/
Data.prototype.getYMaxValue = function () {
Data.prototype.gitYMax = function () {
var self = this;
var arr = [];

View file

@ -43,8 +43,8 @@ define(function (require) {
alerts: new Alerts(vis, data, opts.alerts),
yAxis: new YAxis({
el : vis.el,
yMin : data.getYMinValue(),
yMax : data.getYMaxValue(),
yMin : data.gitYMin(),
yMax : data.gitYMax(),
_attr: vis._attr
})
});
@ -67,7 +67,7 @@ define(function (require) {
msg: 'Positive and negative values are not accurately represented by stacked ' +
'area charts. The line chart is better suited for this type of data.',
test: function (vis, data) {
return vis._attr.mode === 'stacked' && data.getYMaxValue() > 0 && data.getYMinValue() < 0;
return vis._attr.mode === 'stacked' && data.gitYMax() > 0 && data.gitYMin() < 0;
}
}
]

View file

@ -252,7 +252,7 @@ define(function (require) {
it('should return all points from every series', testLength(colsData));
});
describe('getYMinValue method', function () {
describe('gitYMin method', function () {
var Data;
var dataSeries;
var stackedDataSeries;
@ -285,8 +285,8 @@ define(function (require) {
// date range. It also has the largest y value. This value should be excluded
// when calculating the Y max value since it falls outside of the range.
it('should return the Y domain min value', function () {
expect(visData.getYMinValue()).to.be(minValue);
expect(stackedVisData.getYMinValue()).to.be(stackedMinValue);
expect(visData.gitYMin()).to.be(minValue);
expect(stackedVisData.gitYMin()).to.be(stackedMinValue);
});
it('should have a minimum date value that is greater than the max value within the date range', function () {
@ -295,7 +295,7 @@ define(function (require) {
});
});
describe('getYMaxValue method', function () {
describe('gitYMax method', function () {
var Data;
var dataSeries;
var stackedDataSeries;
@ -328,8 +328,8 @@ define(function (require) {
// date range. It also has the largest y value. This value should be excluded
// when calculating the Y max value since it falls outside of the range.
it('should return the Y domain min value', function () {
expect(visData.getYMaxValue()).to.be(maxValue);
expect(stackedVisData.getYMaxValue()).to.be(stackedMaxValue);
expect(visData.gitYMax()).to.be(maxValue);
expect(stackedVisData.gitYMax()).to.be(stackedMaxValue);
});
it('should have a minimum date value that is greater than the max value within the date range', function () {

View file

@ -72,8 +72,8 @@ define(function (require) {
yAxis = new YAxis({
el: node,
yMin: dataObj.getYMinValue(),
yMax: dataObj.getYMaxValue(),
yMin: dataObj.gitYMin(),
yMax: dataObj.gitYMax(),
_attr: {
margin: { top: 0, right: 0, bottom: 0, left: 0 }
}

View file

@ -268,7 +268,7 @@ define(function (require) {
it('should return yAxis extents equal to data extents', function () {
vis.handler.charts.forEach(function (chart) {
var yAxis = chart.handler.yAxis;
var yVals = [vis.handler.data.getYMinValue(), vis.handler.data.getYMaxValue()];
var yVals = [vis.handler.data.gitYMin(), vis.handler.data.gitYMax()];
expect(yAxis.yMin).to.equal(yVals[0]);
expect(yAxis.yMax).to.equal(yVals[1]);

View file

@ -206,7 +206,7 @@ define(function (require) {
it('should return yAxis extents equal to data extents', function () {
vis.handler.charts.forEach(function (chart) {
var yAxis = chart.handler.yAxis;
var yVals = [vis.handler.data.getYMinValue(), vis.handler.data.getYMaxValue()];
var yVals = [vis.handler.data.gitYMin(), vis.handler.data.gitYMax()];
expect(yAxis.yMin).to.equal(yVals[0]);
expect(yAxis.yMax).to.equal(yVals[1]);

View file

@ -182,7 +182,7 @@ define(function (require) {
it('should return yAxis extents equal to data extents', function () {
vis.handler.charts.forEach(function (chart) {
var yAxis = chart.handler.yAxis;
var yVals = [vis.handler.data.getYMinValue(), vis.handler.data.getYMaxValue()];
var yVals = [vis.handler.data.gitYMin(), vis.handler.data.gitYMax()];
expect(yAxis.yMin).to.equal(yVals[0]);
expect(yAxis.yMax).to.equal(yVals[1]);