Fixed Problem Markers on Removed Lines

master
johnkiernander 2014-04-23 15:12:23 +01:00
parent a262be0d1b
commit fadf89c2b1
7 changed files with 115 additions and 31 deletions

48
dist/dimple.v1.2.0.js vendored
View File

@ -3098,16 +3098,30 @@ var dimple = {
.attr("stroke-width", series.lineWeight);
}
})
.each(drawMarkers);
.each(function (d) {
// Pass line data to markers
d.markerData = d.data;
drawMarkers(d);
});
// Update
updated = chart._handleTransition(theseShapes, duration, chart)
.attr("d", function (d) { return d.update; })
.each(drawMarkers);
.each(function (d) {
// Pass line data to markers
d.markerData = d.data;
drawMarkers(d);
});
// Remove
removed = chart._handleTransition(theseShapes.exit(), duration, chart)
.attr("d", function (d) { return d.exit; })
.each(drawMarkers);
.each(function (d) {
// Using all data for the markers fails because there are no exits in the markers
// only the whole line, therefore we need to clear the points here
d.markerData = [];
drawMarkers(d);
});
dimple._postDrawHandling(series, updated, removed, duration);
@ -3466,6 +3480,7 @@ var dimple = {
keyString: keyString,
color: "white",
data: [],
markerData: [],
points: [],
line: {},
entry: {},
@ -3559,17 +3574,30 @@ var dimple = {
.attr("stroke-width", series.lineWeight);
}
})
.each(drawMarkers);
.each(function (d) {
// Pass line data to markers
d.markerData = d.data;
drawMarkers(d);
});
// Update
updated = chart._handleTransition(theseShapes, duration, chart)
.attr("d", function (d) { return d.update; })
.each(drawMarkers);
.each(function (d) {
// Pass line data to markers
d.markerData = d.data;
drawMarkers(d);
});
// Remove
removed = chart._handleTransition(theseShapes.exit(), duration, chart)
.attr("d", function (d) { return d.exit; })
.each(drawMarkers);
.each(function (d) {
// Using all data for the markers fails because there are no exits in the markers
// only the whole line, therefore we need to clear the points here
d.markerData = [];
drawMarkers(d);
});
dimple._postDrawHandling(series, updated, removed, duration);
@ -3711,9 +3739,9 @@ var dimple = {
rem;
if (series.lineMarkers) {
if (series._markerBacks === null || series._markerBacks === undefined || series._markerBacks[lineDataRow.keyString] === undefined) {
markerBacks = chart._group.selectAll("." + markerBackClasses.join(".")).data(lineDataRow.data);
markerBacks = chart._group.selectAll("." + markerBackClasses.join(".")).data(lineDataRow.markerData);
} else {
markerBacks = series._markerBacks[lineDataRow.keyString].data(lineDataRow.data, function (d) { return d.key; });
markerBacks = series._markerBacks[lineDataRow.keyString].data(lineDataRow.markerData, function (d) { return d.key; });
}
// Add
markerBacks
@ -3777,9 +3805,9 @@ var dimple = {
// Deal with markers in the same way as main series to fix #28
if (series._markers === null || series._markers === undefined || series._markers[lineDataRow.keyString] === undefined) {
markers = chart._group.selectAll("." + markerClasses.join(".")).data(lineDataRow.data);
markers = chart._group.selectAll("." + markerClasses.join(".")).data(lineDataRow.markerData);
} else {
markers = series._markers[lineDataRow.keyString].data(lineDataRow.data, function (d) {
markers = series._markers[lineDataRow.keyString].data(lineDataRow.markerData, function (d) {
return d.key;
});
}

File diff suppressed because one or more lines are too long

View File

@ -7,9 +7,9 @@
rem;
if (series.lineMarkers) {
if (series._markerBacks === null || series._markerBacks === undefined || series._markerBacks[lineDataRow.keyString] === undefined) {
markerBacks = chart._group.selectAll("." + markerBackClasses.join(".")).data(lineDataRow.data);
markerBacks = chart._group.selectAll("." + markerBackClasses.join(".")).data(lineDataRow.markerData);
} else {
markerBacks = series._markerBacks[lineDataRow.keyString].data(lineDataRow.data, function (d) { return d.key; });
markerBacks = series._markerBacks[lineDataRow.keyString].data(lineDataRow.markerData, function (d) { return d.key; });
}
// Add
markerBacks

View File

@ -11,9 +11,9 @@
// Deal with markers in the same way as main series to fix #28
if (series._markers === null || series._markers === undefined || series._markers[lineDataRow.keyString] === undefined) {
markers = chart._group.selectAll("." + markerClasses.join(".")).data(lineDataRow.data);
markers = chart._group.selectAll("." + markerClasses.join(".")).data(lineDataRow.markerData);
} else {
markers = series._markers[lineDataRow.keyString].data(lineDataRow.data, function (d) {
markers = series._markers[lineDataRow.keyString].data(lineDataRow.markerData, function (d) {
return d.key;
});
}

View File

@ -356,16 +356,30 @@
.attr("stroke-width", series.lineWeight);
}
})
.each(drawMarkers);
.each(function (d) {
// Pass line data to markers
d.markerData = d.data;
drawMarkers(d);
});
// Update
updated = chart._handleTransition(theseShapes, duration, chart)
.attr("d", function (d) { return d.update; })
.each(drawMarkers);
.each(function (d) {
// Pass line data to markers
d.markerData = d.data;
drawMarkers(d);
});
// Remove
removed = chart._handleTransition(theseShapes.exit(), duration, chart)
.attr("d", function (d) { return d.exit; })
.each(drawMarkers);
.each(function (d) {
// Using all data for the markers fails because there are no exits in the markers
// only the whole line, therefore we need to clear the points here
d.markerData = [];
drawMarkers(d);
});
dimple._postDrawHandling(series, updated, removed, duration);

View File

@ -100,6 +100,7 @@
keyString: keyString,
color: "white",
data: [],
markerData: [],
points: [],
line: {},
entry: {},
@ -193,17 +194,30 @@
.attr("stroke-width", series.lineWeight);
}
})
.each(drawMarkers);
.each(function (d) {
// Pass line data to markers
d.markerData = d.data;
drawMarkers(d);
});
// Update
updated = chart._handleTransition(theseShapes, duration, chart)
.attr("d", function (d) { return d.update; })
.each(drawMarkers);
.each(function (d) {
// Pass line data to markers
d.markerData = d.data;
drawMarkers(d);
});
// Remove
removed = chart._handleTransition(theseShapes.exit(), duration, chart)
.attr("d", function (d) { return d.exit; })
.each(drawMarkers);
.each(function (d) {
// Using all data for the markers fails because there are no exits in the markers
// only the whole line, therefore we need to clear the points here
d.markerData = [];
drawMarkers(d);
});
dimple._postDrawHandling(series, updated, removed, duration);

View File

@ -3098,16 +3098,30 @@ var dimple = {
.attr("stroke-width", series.lineWeight);
}
})
.each(drawMarkers);
.each(function (d) {
// Pass line data to markers
d.markerData = d.data;
drawMarkers(d);
});
// Update
updated = chart._handleTransition(theseShapes, duration, chart)
.attr("d", function (d) { return d.update; })
.each(drawMarkers);
.each(function (d) {
// Pass line data to markers
d.markerData = d.data;
drawMarkers(d);
});
// Remove
removed = chart._handleTransition(theseShapes.exit(), duration, chart)
.attr("d", function (d) { return d.exit; })
.each(drawMarkers);
.each(function (d) {
// Using all data for the markers fails because there are no exits in the markers
// only the whole line, therefore we need to clear the points here
d.markerData = [];
drawMarkers(d);
});
dimple._postDrawHandling(series, updated, removed, duration);
@ -3466,6 +3480,7 @@ var dimple = {
keyString: keyString,
color: "white",
data: [],
markerData: [],
points: [],
line: {},
entry: {},
@ -3559,17 +3574,30 @@ var dimple = {
.attr("stroke-width", series.lineWeight);
}
})
.each(drawMarkers);
.each(function (d) {
// Pass line data to markers
d.markerData = d.data;
drawMarkers(d);
});
// Update
updated = chart._handleTransition(theseShapes, duration, chart)
.attr("d", function (d) { return d.update; })
.each(drawMarkers);
.each(function (d) {
// Pass line data to markers
d.markerData = d.data;
drawMarkers(d);
});
// Remove
removed = chart._handleTransition(theseShapes.exit(), duration, chart)
.attr("d", function (d) { return d.exit; })
.each(drawMarkers);
.each(function (d) {
// Using all data for the markers fails because there are no exits in the markers
// only the whole line, therefore we need to clear the points here
d.markerData = [];
drawMarkers(d);
});
dimple._postDrawHandling(series, updated, removed, duration);
@ -3711,9 +3739,9 @@ var dimple = {
rem;
if (series.lineMarkers) {
if (series._markerBacks === null || series._markerBacks === undefined || series._markerBacks[lineDataRow.keyString] === undefined) {
markerBacks = chart._group.selectAll("." + markerBackClasses.join(".")).data(lineDataRow.data);
markerBacks = chart._group.selectAll("." + markerBackClasses.join(".")).data(lineDataRow.markerData);
} else {
markerBacks = series._markerBacks[lineDataRow.keyString].data(lineDataRow.data, function (d) { return d.key; });
markerBacks = series._markerBacks[lineDataRow.keyString].data(lineDataRow.markerData, function (d) { return d.key; });
}
// Add
markerBacks
@ -3777,9 +3805,9 @@ var dimple = {
// Deal with markers in the same way as main series to fix #28
if (series._markers === null || series._markers === undefined || series._markers[lineDataRow.keyString] === undefined) {
markers = chart._group.selectAll("." + markerClasses.join(".")).data(lineDataRow.data);
markers = chart._group.selectAll("." + markerClasses.join(".")).data(lineDataRow.markerData);
} else {
markers = series._markers[lineDataRow.keyString].data(lineDataRow.data, function (d) {
markers = series._markers[lineDataRow.keyString].data(lineDataRow.markerData, function (d) {
return d.key;
});
}