|
|
@ -446,7 +446,7 @@ c3_chart_internal_fn.redraw = function (options, transitions) { |
|
|
|
var hideAxis = $$.hasArcType(); |
|
|
|
var hideAxis = $$.hasArcType(); |
|
|
|
var drawArea, drawBar, drawLine, xForText, yForText; |
|
|
|
var drawArea, drawBar, drawLine, xForText, yForText; |
|
|
|
var duration, durationForExit, durationForAxis; |
|
|
|
var duration, durationForExit, durationForAxis; |
|
|
|
var waitForDraw, flow; |
|
|
|
var transitionsToWait, waitForDraw, flow, transition; |
|
|
|
var targetsToShow = $$.filterTargetsToShow($$.data.targets), tickValues, i, intervalForCulling, xDomainForZoom; |
|
|
|
var targetsToShow = $$.filterTargetsToShow($$.data.targets), tickValues, i, intervalForCulling, xDomainForZoom; |
|
|
|
var xv = $$.xv.bind($$), cx, cy; |
|
|
|
var xv = $$.xv.bind($$), cx, cy; |
|
|
|
|
|
|
|
|
|
|
@ -510,7 +510,7 @@ c3_chart_internal_fn.redraw = function (options, transitions) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// axes
|
|
|
|
// axes
|
|
|
|
$$.axis.redraw(transitions, hideAxis); |
|
|
|
$$.axis.redraw(durationForAxis, hideAxis); |
|
|
|
|
|
|
|
|
|
|
|
// Update axis label
|
|
|
|
// Update axis label
|
|
|
|
$$.axis.updateLabels(withTransition); |
|
|
|
$$.axis.updateLabels(withTransition); |
|
|
@ -542,6 +542,12 @@ c3_chart_internal_fn.redraw = function (options, transitions) { |
|
|
|
xForText = $$.generateXYForText(areaIndices, barIndices, lineIndices, true); |
|
|
|
xForText = $$.generateXYForText(areaIndices, barIndices, lineIndices, true); |
|
|
|
yForText = $$.generateXYForText(areaIndices, barIndices, lineIndices, false); |
|
|
|
yForText = $$.generateXYForText(areaIndices, barIndices, lineIndices, false); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// update circleY based on updated parameters
|
|
|
|
|
|
|
|
$$.updateCircleY(); |
|
|
|
|
|
|
|
// generate circle x/y functions depending on updated params
|
|
|
|
|
|
|
|
cx = ($$.config.axis_rotated ? $$.circleY : $$.circleX).bind($$); |
|
|
|
|
|
|
|
cy = ($$.config.axis_rotated ? $$.circleX : $$.circleY).bind($$); |
|
|
|
|
|
|
|
|
|
|
|
// Update sub domain
|
|
|
|
// Update sub domain
|
|
|
|
if (withY) { |
|
|
|
if (withY) { |
|
|
|
$$.subY.domain($$.getYDomain(targetsToShow, 'y')); |
|
|
|
$$.subY.domain($$.getYDomain(targetsToShow, 'y')); |
|
|
@ -571,11 +577,11 @@ c3_chart_internal_fn.redraw = function (options, transitions) { |
|
|
|
// lines, areas and cricles
|
|
|
|
// lines, areas and cricles
|
|
|
|
$$.updateLine(durationForExit); |
|
|
|
$$.updateLine(durationForExit); |
|
|
|
$$.updateArea(durationForExit); |
|
|
|
$$.updateArea(durationForExit); |
|
|
|
$$.updateCircle(); |
|
|
|
$$.updateCircle(cx, cy); |
|
|
|
|
|
|
|
|
|
|
|
// text
|
|
|
|
// text
|
|
|
|
if ($$.hasDataLabel()) { |
|
|
|
if ($$.hasDataLabel()) { |
|
|
|
$$.updateText(durationForExit); |
|
|
|
$$.updateText(xForText, yForText, durationForExit); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// title
|
|
|
|
// title
|
|
|
@ -600,13 +606,6 @@ c3_chart_internal_fn.redraw = function (options, transitions) { |
|
|
|
$$.updateEventRect(); |
|
|
|
$$.updateEventRect(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// update circleY based on updated parameters
|
|
|
|
|
|
|
|
$$.updateCircleY(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// generate circle x/y functions depending on updated params
|
|
|
|
|
|
|
|
cx = ($$.config.axis_rotated ? $$.circleY : $$.circleX).bind($$); |
|
|
|
|
|
|
|
cy = ($$.config.axis_rotated ? $$.circleX : $$.circleY).bind($$); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (options.flow) { |
|
|
|
if (options.flow) { |
|
|
|
flow = $$.generateFlow({ |
|
|
|
flow = $$.generateFlow({ |
|
|
|
targets: targetsToShow, |
|
|
|
targets: targetsToShow, |
|
|
@ -623,51 +622,44 @@ c3_chart_internal_fn.redraw = function (options, transitions) { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ((duration || flow) && $$.isTabVisible()) { // Only use transition if tab visible. See #938.
|
|
|
|
if ($$.isTabVisible()) { // Only use transition if tab visible. See #938.
|
|
|
|
// transition should be derived from one transition
|
|
|
|
if (duration) { |
|
|
|
d3.transition().duration(duration).each(function () { |
|
|
|
// transition should be derived from one transition
|
|
|
|
var transitionsToWait = []; |
|
|
|
transition = d3.transition().duration(duration); |
|
|
|
|
|
|
|
transitionsToWait = []; |
|
|
|
// redraw and gather transitions
|
|
|
|
|
|
|
|
[ |
|
|
|
[ |
|
|
|
$$.redrawBar(drawBar, true), |
|
|
|
$$.redrawBar(drawBar, true, transition), |
|
|
|
$$.redrawLine(drawLine, true), |
|
|
|
$$.redrawLine(drawLine, true, transition), |
|
|
|
$$.redrawArea(drawArea, true), |
|
|
|
$$.redrawArea(drawArea, true, transition), |
|
|
|
$$.redrawCircle(cx, cy, true), |
|
|
|
$$.redrawCircle(cx, cy, true, transition), |
|
|
|
$$.redrawText(xForText, yForText, options.flow, true), |
|
|
|
$$.redrawText(xForText, yForText, options.flow, true, transition), |
|
|
|
$$.redrawRegion(true), |
|
|
|
$$.redrawRegion(true, transition), |
|
|
|
$$.redrawGrid(true), |
|
|
|
$$.redrawGrid(true, transition), |
|
|
|
].forEach(function (transitions) { |
|
|
|
].forEach(function (transitions) { |
|
|
|
transitions.forEach(function (transition) { |
|
|
|
transitions.forEach(function (transition) { |
|
|
|
transitionsToWait.push(transition); |
|
|
|
transitionsToWait.push(transition); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// Wait for end of transitions to call flow and onrendered callback
|
|
|
|
// Wait for end of transitions to call flow and onrendered callback
|
|
|
|
waitForDraw = $$.generateWait(); |
|
|
|
waitForDraw = $$.generateWait(); |
|
|
|
transitionsToWait.forEach(function (t) { |
|
|
|
transitionsToWait.forEach(function (t) { |
|
|
|
waitForDraw.add(t); |
|
|
|
waitForDraw.add(t); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}) |
|
|
|
waitForDraw(function () { |
|
|
|
.call(waitForDraw, function () { |
|
|
|
if (flow) { flow(); } |
|
|
|
if (flow) { |
|
|
|
if (config.onrendered) { config.onrendered.call($$); } |
|
|
|
flow(); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
if (config.onrendered) { |
|
|
|
else { |
|
|
|
config.onrendered.call($$); |
|
|
|
$$.redrawBar(drawBar); |
|
|
|
} |
|
|
|
$$.redrawLine(drawLine); |
|
|
|
}); |
|
|
|
$$.redrawArea(drawArea); |
|
|
|
} |
|
|
|
$$.redrawCircle(cx, cy); |
|
|
|
else { |
|
|
|
$$.redrawText(xForText, yForText, options.flow); |
|
|
|
$$.redrawBar(drawBar); |
|
|
|
$$.redrawRegion(); |
|
|
|
$$.redrawLine(drawLine); |
|
|
|
$$.redrawGrid(); |
|
|
|
$$.redrawArea(drawArea); |
|
|
|
if (flow) { flow(); } |
|
|
|
$$.redrawCircle(cx, cy); |
|
|
|
if (config.onrendered) { config.onrendered.call($$); } |
|
|
|
$$.redrawText(xForText, yForText, options.flow); |
|
|
|
|
|
|
|
$$.redrawRegion(); |
|
|
|
|
|
|
|
$$.redrawGrid(); |
|
|
|
|
|
|
|
if (config.onrendered) { |
|
|
|
|
|
|
|
config.onrendered.call($$); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1001,7 +993,7 @@ c3_chart_internal_fn.endall = function (transition, callback) { |
|
|
|
}; |
|
|
|
}; |
|
|
|
c3_chart_internal_fn.generateWait = function () { |
|
|
|
c3_chart_internal_fn.generateWait = function () { |
|
|
|
var transitionsToWait = [], |
|
|
|
var transitionsToWait = [], |
|
|
|
f = function (transition, callback) { |
|
|
|
f = function (callback) { |
|
|
|
var timer = setInterval(function () { |
|
|
|
var timer = setInterval(function () { |
|
|
|
var done = 0; |
|
|
|
var done = 0; |
|
|
|
transitionsToWait.forEach(function (t) { |
|
|
|
transitionsToWait.forEach(function (t) { |
|
|
@ -1019,7 +1011,7 @@ c3_chart_internal_fn.generateWait = function () { |
|
|
|
clearInterval(timer); |
|
|
|
clearInterval(timer); |
|
|
|
if (callback) { callback(); } |
|
|
|
if (callback) { callback(); } |
|
|
|
} |
|
|
|
} |
|
|
|
}, 10); |
|
|
|
}, 50); |
|
|
|
}; |
|
|
|
}; |
|
|
|
f.add = function (transition) { |
|
|
|
f.add = function (transition) { |
|
|
|
transitionsToWait.push(transition); |
|
|
|
transitionsToWait.push(transition); |
|
|
|