From c77595232c8585379d57a59f8142a478ee4991cf Mon Sep 17 00:00:00 2001 From: AnSavvides Date: Fri, 14 Nov 2014 14:41:28 +0000 Subject: [PATCH] Update source files too --- src/domain.js | 5 +++-- src/util.js | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/domain.js b/src/domain.js index 9e81929..025378f 100644 --- a/src/domain.js +++ b/src/domain.js @@ -66,8 +66,8 @@ c3_chart_internal_fn.getYDomain = function (targets, axisId, xDomain) { yTargets = xDomain ? $$.filterByXDomain(targetsByAxisId, xDomain) : targetsByAxisId, yMin = axisId === 'y2' ? config.axis_y2_min : config.axis_y_min, yMax = axisId === 'y2' ? config.axis_y2_max : config.axis_y_max, - yDomainMin = isValue(yMin) ? yMin : $$.getYDomainMin(yTargets), - yDomainMax = isValue(yMax) ? yMax : $$.getYDomainMax(yTargets), + yDomainMin = isNumber(yMin) ? yMin : $$.getYDomainMin(yTargets), + yDomainMax = isNumber(yMax) ? yMax : $$.getYDomainMax(yTargets), domainLength, padding, padding_top, padding_bottom, center = axisId === 'y2' ? config.axis_y2_center : config.axis_y_center, yDomainAbs, lengths, diff, ratio, isAllPositive, isAllNegative, @@ -142,6 +142,7 @@ c3_chart_internal_fn.getYDomain = function (targets, axisId, xDomain) { if (isAllPositive) { padding_bottom = yDomainMin; } if (isAllNegative) { padding_top = -yDomainMax; } } + yDomainMin = yDomainMin === 0 ? yDomainMin : yDomainMin - padding_bottom; return [yDomainMin - padding_bottom, yDomainMax + padding_top]; }; c3_chart_internal_fn.getXDomainMin = function (targets) { diff --git a/src/util.js b/src/util.js index 91cb48b..ae78cb8 100644 --- a/src/util.js +++ b/src/util.js @@ -1,6 +1,9 @@ var isValue = c3_chart_internal_fn.isValue = function (v) { - return v || v === 0; -}, + return v || v === 0; + }, + isNumber = c3_chart_internal_fn.isNumber = function (v) { + return !isNaN(parseFloat(v)) && isFinite(v); + }, isFunction = c3_chart_internal_fn.isFunction = function (o) { return typeof o === 'function'; },