Commit bee04927 authored by Evgeny's avatar Evgeny

Update fow

parent db6b4ac3
...@@ -670,11 +670,11 @@ ...@@ -670,11 +670,11 @@
withSubchart = getOption(options, "withSubchart", true); withSubchart = getOption(options, "withSubchart", true);
withTransition = getOption(options, "withTransition", true); withTransition = getOption(options, "withTransition", true);
withTransform = getOption(options, "withTransform", false); withTransform = getOption(options, "withTransform", false);
withUpdateXDomain = getOption(options, "withUpdateXDomain", false); withUpdateXDomain = getOption(options, "withUpdateXDomain", true);
withUpdateOrgXDomain = getOption(options, "withUpdateOrgXDomain", false); withUpdateOrgXDomain = getOption(options, "withUpdateOrgXDomain", true);
withTrimXDomain = getOption(options, "withTrimXDomain", true); withTrimXDomain = getOption(options, "withTrimXDomain", true);
withUpdateXAxis = getOption(options, "withUpdateXAxis", withUpdateXDomain); withUpdateXAxis = getOption(options, "withUpdateXAxis", withUpdateXDomain);
withLegend = getOption(options, "withLegend", false); withLegend = getOption(options, "withLegend", true);
withEventRect = getOption(options, "withEventRect", true); withEventRect = getOption(options, "withEventRect", true);
withDimension = getOption(options, "withDimension", true); withDimension = getOption(options, "withDimension", true);
withTransitionForExit = getOption(options, "withTransitionForExit", withTransition); withTransitionForExit = getOption(options, "withTransitionForExit", withTransition);
...@@ -2310,7 +2310,7 @@ ...@@ -2310,7 +2310,7 @@
}); });
} }
// Update/Add data // Update/Add data
$$.data.targets.forEach(function (d) { $$.data._targets.forEach(function (d) {
for (var i = 0; i < targets.length; i++) { for (var i = 0; i < targets.length; i++) {
if (d.id === targets[i].id) { if (d.id === targets[i].id) {
d.values = targets[i].values; d.values = targets[i].values;
...@@ -2330,7 +2330,7 @@ ...@@ -2330,7 +2330,7 @@
// Redraw with new targets // Redraw with new targets
$$.redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); $$.redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true});
if (args.done) { args.done(); } if (args && args.done) { args.done(); }
}; };
c3_chart_internal_fn.loadFromArgs = function (args) { c3_chart_internal_fn.loadFromArgs = function (args) {
var $$ = this; var $$ = this;
...@@ -2361,7 +2361,7 @@ ...@@ -2361,7 +2361,7 @@
done = function () {}; done = function () {};
} }
// filter existing target // filter existing target
targetIds = targetIds.filter(function (id) { return $$.hasTarget($$.data.targets, id); }); targetIds = targetIds.filter(function (id) { return $$.hasTarget($$.data._targets, id); });
// If no target, call done and return // If no target, call done and return
if (!targetIds || targetIds.length === 0) { if (!targetIds || targetIds.length === 0) {
done(); done();
...@@ -2380,7 +2380,7 @@ ...@@ -2380,7 +2380,7 @@
$$.legend.selectAll('.' + CLASS.legendItem + $$.getTargetSelectorSuffix(id)).remove(); $$.legend.selectAll('.' + CLASS.legendItem + $$.getTargetSelectorSuffix(id)).remove();
} }
// Remove target // Remove target
$$.data._targets = $$.data.targets.filter(function (t) { $$.data._targets = $$.data._targets.filter(function (t) {
return t.id !== id; return t.id !== id;
}); });
$$.data.targets = $$.normalize($$.data._targets); $$.data.targets = $$.normalize($$.data._targets);
...@@ -5400,7 +5400,7 @@ ...@@ -5400,7 +5400,7 @@
main.select('.' + CLASS.chartArcsTitle) main.select('.' + CLASS.chartArcsTitle)
.style("opacity", $$.hasType('donut') || $$.hasType('gauge') ? 1 : 0); .style("opacity", $$.hasType('donut') || $$.hasType('gauge') ? 1 : 0);
if($$.config.hasSubs || $$.config.isSub){ if(typeof process !== 'object' && ($$.config.hasSubs || $$.config.isSub)){
$$.buffer.onlastfinish("draw-lines"+$$.config.isSub, function(){ $$.buffer.onlastfinish("draw-lines"+$$.config.isSub, function(){
$$.buffer.onlastfinish("draw-lines"+$$.config.isSub, function(){ $$.buffer.onlastfinish("draw-lines"+$$.config.isSub, function(){
$$.ed3Internal.redrawLinesOnBoth(); $$.ed3Internal.redrawLinesOnBoth();
...@@ -7012,7 +7012,7 @@ ...@@ -7012,7 +7012,7 @@
targets = $$.convertDataToTargets(data, true); targets = $$.convertDataToTargets(data, true);
// Update/Add data // Update/Add data
$$.data.targets.forEach(function (t) { $$.data._targets.forEach(function (t) {
var found = false, i, j; var found = false, i, j;
for (i = 0; i < targets.length; i++) { for (i = 0; i < targets.length; i++) {
if (t.id === targets[i].id) { if (t.id === targets[i].id) {
...@@ -7039,7 +7039,7 @@ ...@@ -7039,7 +7039,7 @@
}); });
// Append null for not found targets // Append null for not found targets
$$.data.targets.forEach(function (t) { $$.data._targets.forEach(function (t) {
var i, j; var i, j;
for (i = 0; i < notfoundIds.length; i++) { for (i = 0; i < notfoundIds.length; i++) {
if (t.id === notfoundIds[i]) { if (t.id === notfoundIds[i]) {
...@@ -7057,10 +7057,10 @@ ...@@ -7057,10 +7057,10 @@
}); });
// Generate null values for new target // Generate null values for new target
if ($$.data.targets.length) { if ($$.data._targets.length) {
targets.forEach(function (t) { targets.forEach(function (t) {
var i, missing = []; var i, missing = [];
for (i = $$.data.targets[0].values[0].index; i < tail; i++) { for (i = $$.data._targets[0].values[0].index; i < tail; i++) {
missing.push({ missing.push({
id: t.id, id: t.id,
index: i, index: i,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -18,7 +18,7 @@ c3_chart_fn.flow = function (args) { ...@@ -18,7 +18,7 @@ c3_chart_fn.flow = function (args) {
targets = $$.convertDataToTargets(data, true); targets = $$.convertDataToTargets(data, true);
// Update/Add data // Update/Add data
$$.data.targets.forEach(function (t) { $$.data._targets.forEach(function (t) {
var found = false, i, j; var found = false, i, j;
for (i = 0; i < targets.length; i++) { for (i = 0; i < targets.length; i++) {
if (t.id === targets[i].id) { if (t.id === targets[i].id) {
...@@ -45,7 +45,7 @@ c3_chart_fn.flow = function (args) { ...@@ -45,7 +45,7 @@ c3_chart_fn.flow = function (args) {
}); });
// Append null for not found targets // Append null for not found targets
$$.data.targets.forEach(function (t) { $$.data._targets.forEach(function (t) {
var i, j; var i, j;
for (i = 0; i < notfoundIds.length; i++) { for (i = 0; i < notfoundIds.length; i++) {
if (t.id === notfoundIds[i]) { if (t.id === notfoundIds[i]) {
...@@ -63,10 +63,10 @@ c3_chart_fn.flow = function (args) { ...@@ -63,10 +63,10 @@ c3_chart_fn.flow = function (args) {
}); });
// Generate null values for new target // Generate null values for new target
if ($$.data.targets.length) { if ($$.data._targets.length) {
targets.forEach(function (t) { targets.forEach(function (t) {
var i, missing = []; var i, missing = [];
for (i = $$.data.targets[0].values[0].index; i < tail; i++) { for (i = $$.data._targets[0].values[0].index; i < tail; i++) {
missing.push({ missing.push({
id: t.id, id: t.id,
index: i, index: i,
......
...@@ -304,7 +304,7 @@ c3_chart_internal_fn.redrawArc = function (duration, durationForExit, withTransf ...@@ -304,7 +304,7 @@ c3_chart_internal_fn.redrawArc = function (duration, durationForExit, withTransf
main.select('.' + CLASS.chartArcsTitle) main.select('.' + CLASS.chartArcsTitle)
.style("opacity", $$.hasType('donut') || $$.hasType('gauge') ? 1 : 0); .style("opacity", $$.hasType('donut') || $$.hasType('gauge') ? 1 : 0);
if($$.config.hasSubs || $$.config.isSub){ if(typeof process !== 'object' && ($$.config.hasSubs || $$.config.isSub)){
$$.buffer.onlastfinish("draw-lines"+$$.config.isSub, function(){ $$.buffer.onlastfinish("draw-lines"+$$.config.isSub, function(){
$$.buffer.onlastfinish("draw-lines"+$$.config.isSub, function(){ $$.buffer.onlastfinish("draw-lines"+$$.config.isSub, function(){
$$.ed3Internal.redrawLinesOnBoth(); $$.ed3Internal.redrawLinesOnBoth();
......
...@@ -449,11 +449,11 @@ c3_chart_internal_fn.redraw = function (options, transitions) { ...@@ -449,11 +449,11 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
withSubchart = getOption(options, "withSubchart", true); withSubchart = getOption(options, "withSubchart", true);
withTransition = getOption(options, "withTransition", true); withTransition = getOption(options, "withTransition", true);
withTransform = getOption(options, "withTransform", false); withTransform = getOption(options, "withTransform", false);
withUpdateXDomain = getOption(options, "withUpdateXDomain", false); withUpdateXDomain = getOption(options, "withUpdateXDomain", true);
withUpdateOrgXDomain = getOption(options, "withUpdateOrgXDomain", false); withUpdateOrgXDomain = getOption(options, "withUpdateOrgXDomain", true);
withTrimXDomain = getOption(options, "withTrimXDomain", true); withTrimXDomain = getOption(options, "withTrimXDomain", true);
withUpdateXAxis = getOption(options, "withUpdateXAxis", withUpdateXDomain); withUpdateXAxis = getOption(options, "withUpdateXAxis", withUpdateXDomain);
withLegend = getOption(options, "withLegend", false); withLegend = getOption(options, "withLegend", true);
withEventRect = getOption(options, "withEventRect", true); withEventRect = getOption(options, "withEventRect", true);
withDimension = getOption(options, "withDimension", true); withDimension = getOption(options, "withDimension", true);
withTransitionForExit = getOption(options, "withTransitionForExit", withTransition); withTransitionForExit = getOption(options, "withTransitionForExit", withTransition);
......
...@@ -12,7 +12,7 @@ c3_chart_internal_fn.load = function (targets, args) { ...@@ -12,7 +12,7 @@ c3_chart_internal_fn.load = function (targets, args) {
}); });
} }
// Update/Add data // Update/Add data
$$.data.targets.forEach(function (d) { $$.data._targets.forEach(function (d) {
for (var i = 0; i < targets.length; i++) { for (var i = 0; i < targets.length; i++) {
if (d.id === targets[i].id) { if (d.id === targets[i].id) {
d.values = targets[i].values; d.values = targets[i].values;
...@@ -32,7 +32,7 @@ c3_chart_internal_fn.load = function (targets, args) { ...@@ -32,7 +32,7 @@ c3_chart_internal_fn.load = function (targets, args) {
// Redraw with new targets // Redraw with new targets
$$.redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true}); $$.redraw({withUpdateOrgXDomain: true, withUpdateXDomain: true, withLegend: true});
if (args.done) { args.done(); } if (args && args.done) { args.done(); }
}; };
c3_chart_internal_fn.loadFromArgs = function (args) { c3_chart_internal_fn.loadFromArgs = function (args) {
var $$ = this; var $$ = this;
...@@ -63,7 +63,7 @@ c3_chart_internal_fn.unload = function (targetIds, done) { ...@@ -63,7 +63,7 @@ c3_chart_internal_fn.unload = function (targetIds, done) {
done = function () {}; done = function () {};
} }
// filter existing target // filter existing target
targetIds = targetIds.filter(function (id) { return $$.hasTarget($$.data.targets, id); }); targetIds = targetIds.filter(function (id) { return $$.hasTarget($$.data._targets, id); });
// If no target, call done and return // If no target, call done and return
if (!targetIds || targetIds.length === 0) { if (!targetIds || targetIds.length === 0) {
done(); done();
...@@ -82,7 +82,7 @@ c3_chart_internal_fn.unload = function (targetIds, done) { ...@@ -82,7 +82,7 @@ c3_chart_internal_fn.unload = function (targetIds, done) {
$$.legend.selectAll('.' + CLASS.legendItem + $$.getTargetSelectorSuffix(id)).remove(); $$.legend.selectAll('.' + CLASS.legendItem + $$.getTargetSelectorSuffix(id)).remove();
} }
// Remove target // Remove target
$$.data._targets = $$.data.targets.filter(function (t) { $$.data._targets = $$.data._targets.filter(function (t) {
return t.id !== id; return t.id !== id;
}); });
$$.data.targets = $$.normalize($$.data._targets); $$.data.targets = $$.normalize($$.data._targets);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment