forked from yui/yui3-gallery
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Build files for gallery-patch-350-charts-numericaxis
- Loading branch information
Showing
3 changed files
with
575 additions
and
0 deletions.
There are no files selected for viewing
287 changes: 287 additions & 0 deletions
287
build/gallery-patch-350-charts-numericaxis/gallery-patch-350-charts-numericaxis-debug.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,287 @@ | ||
YUI.add('gallery-patch-350-charts-numericaxis', function(Y) { | ||
|
||
Y.NumericAxis.prototype._roundMinAndMax = function(min, max, setMin, setMax) | ||
{ | ||
var roundingUnit, | ||
minimumRange, | ||
minGreaterThanZero = min >= 0, | ||
maxGreaterThanZero = max > 0, | ||
dataRangeGreater, | ||
maxRound, | ||
minRound, | ||
topTicks, | ||
botTicks, | ||
tempMax, | ||
tempMin, | ||
units = this.getTotalMajorUnits() - 1, | ||
alwaysShowZero = this.get("alwaysShowZero"), | ||
roundingMethod = this.get("roundingMethod"), | ||
useIntegers = (max - min)/units >= 1; | ||
if(roundingMethod) | ||
{ | ||
if(roundingMethod == "niceNumber") | ||
{ | ||
roundingUnit = this._getMinimumUnit(max, min, units); | ||
if(minGreaterThanZero && maxGreaterThanZero) | ||
{ | ||
if((alwaysShowZero || min < roundingUnit) && !setMin) | ||
{ | ||
min = 0; | ||
roundingUnit = this._getMinimumUnit(max, min, units); | ||
} | ||
else | ||
{ | ||
min = this._roundDownToNearest(min, roundingUnit); | ||
} | ||
if(setMax) | ||
{ | ||
if(!alwaysShowZero) | ||
{ | ||
min = max - (roundingUnit * units); | ||
} | ||
} | ||
else if(setMin) | ||
{ | ||
max = min + (roundingUnit * units); | ||
} | ||
else | ||
{ | ||
max = this._roundUpToNearest(max, roundingUnit); | ||
} | ||
} | ||
else if(maxGreaterThanZero && !minGreaterThanZero) | ||
{ | ||
if(alwaysShowZero) | ||
{ | ||
topTicks = Math.round(units/((-1 * min)/max + 1)); | ||
topTicks = Math.max(Math.min(topTicks, units - 1), 1); | ||
botTicks = units - topTicks; | ||
tempMax = Math.ceil( max/topTicks ); | ||
tempMin = Math.floor( min/botTicks ) * -1; | ||
|
||
if(setMin) | ||
{ | ||
while(tempMin < tempMax && botTicks >= 0) | ||
{ | ||
botTicks--; | ||
topTicks++; | ||
tempMax = Math.ceil( max/topTicks ); | ||
tempMin = Math.floor( min/botTicks ) * -1; | ||
} | ||
//if there are any bottom ticks left calcualate the maximum by multiplying by the tempMin value | ||
//if not, it's impossible to ensure that a zero is shown. skip it | ||
if(botTicks > 0) | ||
{ | ||
max = tempMin * topTicks; | ||
} | ||
else | ||
{ | ||
max = min + (roundingUnit * units); | ||
} | ||
} | ||
else if(setMax) | ||
{ | ||
while(tempMax < tempMin && topTicks >= 0) | ||
{ | ||
botTicks++; | ||
topTicks--; | ||
tempMin = Math.floor( min/botTicks ) * -1; | ||
tempMax = Math.ceil( max/topTicks ); | ||
} | ||
//if there are any top ticks left calcualate the minimum by multiplying by the tempMax value | ||
//if not, it's impossible to ensure that a zero is shown. skip it | ||
if(topTicks > 0) | ||
{ | ||
min = tempMax * botTicks * -1; | ||
} | ||
else | ||
{ | ||
min = max - (roundingUnit * units); | ||
} | ||
} | ||
else | ||
{ | ||
roundingUnit = Math.max(tempMax, tempMin); | ||
roundingUnit = this._getNiceNumber(roundingUnit); | ||
max = roundingUnit * topTicks; | ||
min = roundingUnit * botTicks * -1; | ||
} | ||
} | ||
else | ||
{ | ||
if(setMax) | ||
{ | ||
min = max - (roundingUnit * units); | ||
} | ||
else if(setMin) | ||
{ | ||
max = min + (roundingUnit * units); | ||
} | ||
else | ||
{ | ||
min = this._roundDownToNearest(min, roundingUnit); | ||
max = this._roundUpToNearest(max, roundingUnit); | ||
} | ||
} | ||
} | ||
else | ||
{ | ||
if(setMin) | ||
{ | ||
if(alwaysShowZero) | ||
{ | ||
max = 0; | ||
} | ||
else | ||
{ | ||
max = min + (roundingUnit * units); | ||
} | ||
} | ||
else if(!setMax) | ||
{ | ||
if(alwaysShowZero || max === 0 || max + roundingUnit > 0) | ||
{ | ||
max = 0; | ||
roundingUnit = this._getMinimumUnit(max, min, units); | ||
min = max - (roundingUnit * units); | ||
} | ||
else | ||
{ | ||
min = this._roundDownToNearest(min, roundingUnit); | ||
max = this._roundUpToNearest(max, roundingUnit); | ||
} | ||
} | ||
else | ||
{ | ||
min = max - (roundingUnit * units); | ||
} | ||
} | ||
} | ||
else if(roundingMethod == "auto") | ||
{ | ||
if(minGreaterThanZero && maxGreaterThanZero) | ||
{ | ||
if((alwaysShowZero || min < (max-min)/units) && !setMin) | ||
{ | ||
min = 0; | ||
} | ||
|
||
roundingUnit = (max - min)/units; | ||
if(useIntegers) | ||
{ | ||
roundingUnit = Math.ceil(roundingUnit); | ||
} | ||
max = min + (roundingUnit * units); | ||
} | ||
else if(maxGreaterThanZero && !minGreaterThanZero) | ||
{ | ||
if(alwaysShowZero) | ||
{ | ||
topTicks = Math.round( units / ( (-1 * min) /max + 1) ); | ||
topTicks = Math.max(Math.min(topTicks, units - 1), 1); | ||
botTicks = units - topTicks; | ||
|
||
if(useIntegers) | ||
{ | ||
tempMax = Math.ceil( max/topTicks ); | ||
tempMin = Math.floor( min/botTicks ) * -1; | ||
} | ||
else | ||
{ | ||
tempMax = max/topTicks; | ||
tempMin = min/botTicks * -1; | ||
} | ||
roundingUnit = Math.max(tempMax, tempMin); | ||
max = roundingUnit * topTicks; | ||
min = roundingUnit * botTicks * -1; | ||
} | ||
else | ||
{ | ||
roundingUnit = (max - min)/units; | ||
if(useIntegers) | ||
{ | ||
roundingUnit = Math.ceil(roundingUnit); | ||
} | ||
min = this._roundDownToNearest(min, roundingUnit); | ||
max = this._roundUpToNearest(max, roundingUnit); | ||
} | ||
} | ||
else | ||
{ | ||
roundingUnit = (max - min)/units; | ||
if(useIntegers) | ||
{ | ||
roundingUnit = Math.ceil(roundingUnit); | ||
} | ||
if(alwaysShowZero || max === 0 || max + roundingUnit > 0) | ||
{ | ||
max = 0; | ||
roundingUnit = (max - min)/units; | ||
if(useIntegers) | ||
{ | ||
Math.ceil(roundingUnit); | ||
} | ||
min = max - (roundingUnit * units); | ||
} | ||
else | ||
{ | ||
min = this._roundDownToNearest(min, roundingUnit); | ||
max = this._roundUpToNearest(max, roundingUnit); | ||
} | ||
|
||
} | ||
} | ||
else if(!isNaN(roundingMethod) && isFinite(roundingMethod)) | ||
{ | ||
roundingUnit = roundingMethod; | ||
minimumRange = roundingUnit * units; | ||
dataRangeGreater = (max - min) > minimumRange; | ||
minRound = this._roundDownToNearest(min, roundingUnit); | ||
maxRound = this._roundUpToNearest(max, roundingUnit); | ||
if(setMax) | ||
{ | ||
min = max - minimumRange; | ||
} | ||
else if(setMin) | ||
{ | ||
max = min + minimumRange; | ||
} | ||
else if(minGreaterThanZero && maxGreaterThanZero) | ||
{ | ||
if(alwaysShowZero || minRound <= 0) | ||
{ | ||
min = 0; | ||
} | ||
else | ||
{ | ||
min = minRound; | ||
} | ||
max = min + minimumRange; | ||
} | ||
else if(maxGreaterThanZero && !minGreaterThanZero) | ||
{ | ||
min = minRound; | ||
max = maxRound; | ||
} | ||
else | ||
{ | ||
if(alwaysShowZero || maxRound >= 0) | ||
{ | ||
max = 0; | ||
} | ||
else | ||
{ | ||
max = maxRound; | ||
} | ||
min = max - minimumRange; | ||
} | ||
} | ||
} | ||
this._dataMaximum = max; | ||
this._dataMinimum = min; | ||
}; | ||
|
||
|
||
|
||
|
||
}, '@VERSION@' ,{skinnable:false, requires:['charts-base']}); |
1 change: 1 addition & 0 deletions
1
build/gallery-patch-350-charts-numericaxis/gallery-patch-350-charts-numericaxis-min.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.