|
|
|
@ -31,7 +31,10 @@
|
|
|
|
|
function Chart(config) { |
|
|
|
|
var $$ = this.internal = new ChartInternal(this); |
|
|
|
|
$$.loadConfig(config); |
|
|
|
|
|
|
|
|
|
$$.beforeInit(); |
|
|
|
|
$$.init(); |
|
|
|
|
$$.afterInit(); |
|
|
|
|
|
|
|
|
|
// bind "this" to nested API
|
|
|
|
|
(function bindThis(fn, target, argThis) { |
|
|
|
@ -71,6 +74,12 @@
|
|
|
|
|
c3_chart_internal_fn = c3.chart.internal.fn; |
|
|
|
|
c3_chart_internal_axis_fn = c3.chart.internal.axis.fn; |
|
|
|
|
|
|
|
|
|
c3_chart_internal_fn.beforeInit = function () { |
|
|
|
|
// can do something
|
|
|
|
|
}; |
|
|
|
|
c3_chart_internal_fn.afterInit = function () { |
|
|
|
|
// can do something
|
|
|
|
|
}; |
|
|
|
|
c3_chart_internal_fn.init = function () { |
|
|
|
|
var $$ = this, config = $$.config; |
|
|
|
|
|
|
|
|
@ -4582,14 +4591,15 @@
|
|
|
|
|
.text(this.textForY2AxisLabel.bind(this)); |
|
|
|
|
}; |
|
|
|
|
Axis.prototype.getPadding = function getPadding(padding, key, defaultValue, domainLength) { |
|
|
|
|
if (!isValue(padding[key])) { |
|
|
|
|
var p = typeof padding === 'number' ? padding : padding[key]; |
|
|
|
|
if (!isValue(p)) { |
|
|
|
|
return defaultValue; |
|
|
|
|
} |
|
|
|
|
if (padding.unit === 'ratio') { |
|
|
|
|
return padding[key] * domainLength; |
|
|
|
|
} |
|
|
|
|
// assume padding is pixels if unit is not specified
|
|
|
|
|
return this.convertPixelsToAxisPadding(padding[key], domainLength); |
|
|
|
|
return this.convertPixelsToAxisPadding(p, domainLength); |
|
|
|
|
}; |
|
|
|
|
Axis.prototype.convertPixelsToAxisPadding = function convertPixelsToAxisPadding(pixels, domainLength) { |
|
|
|
|
var $$ = this.owner, |
|
|
|
@ -5957,10 +5967,10 @@
|
|
|
|
|
return d[1] - d[0]; |
|
|
|
|
}, |
|
|
|
|
isEmpty = c3_chart_internal_fn.isEmpty = function (o) { |
|
|
|
|
return !o || (isString(o) && o.length === 0) || (typeof o === 'object' && Object.keys(o).length === 0); |
|
|
|
|
return typeof o === 'undefined' || o === null || (isString(o) && o.length === 0) || (typeof o === 'object' && Object.keys(o).length === 0); |
|
|
|
|
}, |
|
|
|
|
notEmpty = c3_chart_internal_fn.notEmpty = function (o) { |
|
|
|
|
return Object.keys(o).length > 0; |
|
|
|
|
return !c3_chart_internal_fn.isEmpty(o); |
|
|
|
|
}, |
|
|
|
|
getOption = c3_chart_internal_fn.getOption = function (options, key, defaultValue) { |
|
|
|
|
return isDefined(options[key]) ? options[key] : defaultValue; |
|
|
|
|