|
|
@ -1827,12 +1827,11 @@ |
|
|
|
|
|
|
|
|
|
|
|
//-- Type --//
|
|
|
|
//-- Type --//
|
|
|
|
|
|
|
|
|
|
|
|
function setTargetType(targets, type) { |
|
|
|
function setTargetType(targetIds, type) { |
|
|
|
var targetIds = isUndefined(targets) ? getTargetIds() : targets; |
|
|
|
var i, ids = targetIds ? (typeof targetIds === 'string' ? [targetIds] : targetIds) : getTargetIds(); |
|
|
|
if (typeof targetIds === 'string') { targetIds = [targetIds]; } |
|
|
|
for (i = 0; i < ids.length; i++) { |
|
|
|
for (var i = 0; i < targetIds.length; i++) { |
|
|
|
withoutFadeIn[ids[i]] = (type === __data_types[ids[i]]); |
|
|
|
withoutFadeIn[targetIds[i]] = (type === __data_types[targetIds[i]]); |
|
|
|
__data_types[ids[i]] = type; |
|
|
|
__data_types[targetIds[i]] = type; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
function hasType(targets, type) { |
|
|
|
function hasType(targets, type) { |
|
|
@ -2543,7 +2542,7 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Draw with targets
|
|
|
|
// Draw with targets
|
|
|
|
updateAndRedraw({withTransform: true, withLegend: true, durationForAxis: 0}); |
|
|
|
updateAndRedraw({withTransform: true, withLegend: true, withTransitionForAxis: false}); |
|
|
|
|
|
|
|
|
|
|
|
// Show tooltip if needed
|
|
|
|
// Show tooltip if needed
|
|
|
|
if (__tooltip_init_show) { |
|
|
|
if (__tooltip_init_show) { |
|
|
@ -2861,7 +2860,7 @@ |
|
|
|
var mainCircle, mainBar, mainRegion, mainText, contextBar, eventRectUpdate; |
|
|
|
var mainCircle, mainBar, mainRegion, mainText, contextBar, eventRectUpdate; |
|
|
|
var barIndices = getBarIndices(), maxDataCountTarget; |
|
|
|
var barIndices = getBarIndices(), maxDataCountTarget; |
|
|
|
var rectX, rectW; |
|
|
|
var rectX, rectW; |
|
|
|
var withY, withSubchart, withTransition, withTransform, withUpdateXDomain, withUpdateOrgXDomain, withLegend; |
|
|
|
var withY, withSubchart, withTransition, withTransitionForExit, withTransitionForAxis, withTransform, withUpdateXDomain, withUpdateOrgXDomain, withLegend; |
|
|
|
var hideAxis = hasArcType(c3.data.targets); |
|
|
|
var hideAxis = hasArcType(c3.data.targets); |
|
|
|
var drawBar, drawBarOnSub, xForText, yForText; |
|
|
|
var drawBar, drawBarOnSub, xForText, yForText; |
|
|
|
var duration, durationForExit, durationForAxis; |
|
|
|
var duration, durationForExit, durationForAxis; |
|
|
@ -2881,9 +2880,12 @@ |
|
|
|
withUpdateOrgXDomain = isDefined(options.withUpdateOrgXDomain) ? options.withUpdateOrgXDomain : false; |
|
|
|
withUpdateOrgXDomain = isDefined(options.withUpdateOrgXDomain) ? options.withUpdateOrgXDomain : false; |
|
|
|
withLegend = isDefined(options.withLegend) ? options.withLegend : false; |
|
|
|
withLegend = isDefined(options.withLegend) ? options.withLegend : false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
withTransitionForExit = isDefined(options.withTransitionForExit) ? options.withTransitionForExit : withTransition; |
|
|
|
|
|
|
|
withTransitionForAxis = isDefined(options.withTransitionForAxis) ? options.withTransitionForAxis : withTransition; |
|
|
|
|
|
|
|
|
|
|
|
duration = withTransition ? __transition_duration : 0; |
|
|
|
duration = withTransition ? __transition_duration : 0; |
|
|
|
durationForExit = isDefined(options.durationForExit) ? options.durationForExit : duration; |
|
|
|
durationForExit = withTransitionForExit ? duration : 0; |
|
|
|
durationForAxis = isDefined(options.durationForAxis) ? options.durationForAxis : duration; |
|
|
|
durationForAxis = withTransitionForAxis ? duration : 0; |
|
|
|
|
|
|
|
|
|
|
|
// update legend and transform each g
|
|
|
|
// update legend and transform each g
|
|
|
|
if (withLegend && __legend_show) { |
|
|
|
if (withLegend && __legend_show) { |
|
|
@ -3321,7 +3323,7 @@ |
|
|
|
options.withLegend = isDefined(options.withLegend) ? options.withLegend : false; |
|
|
|
options.withLegend = isDefined(options.withLegend) ? options.withLegend : false; |
|
|
|
options.withUpdateXDomain = true; |
|
|
|
options.withUpdateXDomain = true; |
|
|
|
options.withUpdateOrgXDomain = true; |
|
|
|
options.withUpdateOrgXDomain = true; |
|
|
|
options.durationForExit = 0; |
|
|
|
options.withTransitionForExit = false; |
|
|
|
// Update sizes and scales
|
|
|
|
// Update sizes and scales
|
|
|
|
updateSizes(); |
|
|
|
updateSizes(); |
|
|
|
updateScales(); |
|
|
|
updateScales(); |
|
|
@ -3727,6 +3729,11 @@ |
|
|
|
klass = params && params['class'] ? params['class'] : null; |
|
|
|
klass = params && params['class'] ? params['class'] : null; |
|
|
|
return value ? function (line) { return line.value !== value; } : klass ? function (line) { return line['class'] !== klass; } : function () { return true; }; |
|
|
|
return value ? function (line) { return line.value !== value; } : klass ? function (line) { return line['class'] !== klass; } : function () { return true; }; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function transformTo(targetIds, type, optionsForRedraw) { |
|
|
|
|
|
|
|
var withTransitionForAxis = !hasArcType(c3.data.targets); |
|
|
|
|
|
|
|
setTargetType(targetIds, type); |
|
|
|
|
|
|
|
updateAndRedraw(optionsForRedraw ? optionsForRedraw : {withTransitionForAxis: withTransitionForAxis}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
c3.focus = function (targetId) { |
|
|
|
c3.focus = function (targetId) { |
|
|
|
var candidates = svg.selectAll(selectorTarget(targetId)), |
|
|
|
var candidates = svg.selectAll(selectorTarget(targetId)), |
|
|
@ -3880,44 +3887,36 @@ |
|
|
|
}); |
|
|
|
}); |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
c3.toLine = function (targets) { |
|
|
|
c3.toLine = function (targetIds) { |
|
|
|
setTargetType(targets, 'line'); |
|
|
|
transformTo(targetIds, 'line'); |
|
|
|
updateAndRedraw(); |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
c3.toSpline = function (targets) { |
|
|
|
c3.toSpline = function (targetIds) { |
|
|
|
setTargetType(targets, 'spline'); |
|
|
|
transformTo(targetIds, 'spline'); |
|
|
|
updateAndRedraw(); |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
c3.toBar = function (targets) { |
|
|
|
c3.toBar = function (targetIds) { |
|
|
|
setTargetType(targets, 'bar'); |
|
|
|
transformTo(targetIds, 'bar'); |
|
|
|
updateAndRedraw(); |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
c3.toScatter = function (targets) { |
|
|
|
c3.toScatter = function (targetIds) { |
|
|
|
setTargetType(targets, 'scatter'); |
|
|
|
transformTo(targetIds, 'scatter'); |
|
|
|
updateAndRedraw(); |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
c3.toArea = function (targets) { |
|
|
|
c3.toArea = function (targetIds) { |
|
|
|
setTargetType(targets, 'area'); |
|
|
|
transformTo(targetIds, 'area'); |
|
|
|
updateAndRedraw(); |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
c3.toAreaSpline = function (targets) { |
|
|
|
c3.toAreaSpline = function (targetIds) { |
|
|
|
setTargetType(targets, 'area-spline'); |
|
|
|
transformTo(targetIds, 'area-spline'); |
|
|
|
updateAndRedraw(); |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
c3.toPie = function (targets) { |
|
|
|
c3.toPie = function (targetIds) { |
|
|
|
setTargetType(targets, 'pie'); |
|
|
|
transformTo(targetIds, 'pie', {withTransform: true}); |
|
|
|
updateAndRedraw({withTransform: true}); |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
c3.toDonut = function (targets) { |
|
|
|
c3.toDonut = function (targetIds) { |
|
|
|
setTargetType(targets, 'donut'); |
|
|
|
transformTo(targetIds, 'donut', {withTransform: true}); |
|
|
|
updateAndRedraw({withTransform: true}); |
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
c3.groups = function (groups) { |
|
|
|
c3.groups = function (groups) { |
|
|
|