add g elements (groups) for each series added to a chart. Use in plots and with markers.

master
Jose Jimenez 2016-01-29 21:12:43 -06:00
parent c3a10e5a2d
commit 8396a2b711
13 changed files with 39 additions and 27 deletions

18
dist/dimple.latest.js vendored
View File

@ -661,6 +661,7 @@
// The group within which to put all of this chart's objects
this._group = svg.append("g");
this._group.attr('class', 'dimple-chart');
// The group within which to put tooltips. This is not initialised here because
// the group would end up behind other chart contents in a multi chart output. It will
// therefore be added and removed by the mouse enter/leave events
@ -2563,6 +2564,9 @@
this.tooltipFontFamily = "sans-serif";
// Help: http://github.com/PMSI-AlignAlytics/dimple/wiki/dimple.axis#wiki-radius
this.radius = "auto";
// The group within which to put all of this series's objects
this._group = chart._group.append("g");
this._group.attr('class', 'dimple-series-group-' + chart.series.length);
// Any event handlers joined to this series
this._eventHandlers = [];
@ -3442,7 +3446,7 @@
}
if (series.shapes === null || series.shapes === undefined) {
theseShapes = chart._group.selectAll("." + className).data(areaData);
theseShapes = series._group.selectAll("." + className).data(areaData);
} else {
theseShapes = series.shapes.data(areaData, function (d) { return d.key; });
}
@ -3536,7 +3540,7 @@
}
if (series.shapes === null || series.shapes === undefined) {
theseShapes = chart._group.selectAll("." + classes.join(".")).data(chartData);
theseShapes = series._group.selectAll("." + classes.join(".")).data(chartData);
} else {
theseShapes = series.shapes.data(chartData, function (d) { return d.key; });
}
@ -3655,7 +3659,7 @@
}
if (series.shapes === null || series.shapes === undefined) {
theseShapes = chart._group.selectAll("." + classes.join(".")).data(chartData);
theseShapes = series._group.selectAll("." + classes.join(".")).data(chartData);
} else {
theseShapes = series.shapes.data(chartData, function (d) {
return d.key;
@ -3896,7 +3900,7 @@
}
if (series.shapes === null || series.shapes === undefined) {
theseShapes = chart._group.selectAll("." + className).data(lineData);
theseShapes = series._group.selectAll("." + className).data(lineData);
} else {
theseShapes = series.shapes.data(lineData, function (d) { return d.key; });
}
@ -4050,7 +4054,7 @@
}
if (series.shapes === null || series.shapes === undefined) {
theseShapes = chart._group.selectAll("." + classes.join(".")).data(chartData);
theseShapes = series._group.selectAll("." + classes.join(".")).data(chartData);
} else {
theseShapes = series.shapes.data(chartData, function (d) { return d.key; });
}
@ -4244,7 +4248,7 @@
shapes;
if (series.lineMarkers) {
if (series._markerBacks === null || series._markerBacks === undefined || series._markerBacks[lineDataRow.keyString] === undefined) {
markerBacks = chart._group.selectAll("." + markerBackClasses.join(".")).data(lineDataRow.markerData);
markerBacks = series._group.selectAll("." + markerBackClasses.join(".")).data(lineDataRow.markerData);
} else {
markerBacks = series._markerBacks[lineDataRow.keyString].data(lineDataRow.markerData, function (d) { return d.key; });
}
@ -4312,7 +4316,7 @@
// 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.markerData);
markers = series._group.selectAll("." + markerClasses.join(".")).data(lineDataRow.markerData);
} else {
markers = series._markers[lineDataRow.keyString].data(lineDataRow.markerData, function (d) {
return d.key;

File diff suppressed because one or more lines are too long

18
dist/dimple.v2.1.6.js vendored
View File

@ -661,6 +661,7 @@
// The group within which to put all of this chart's objects
this._group = svg.append("g");
this._group.attr('class', 'dimple-chart');
// The group within which to put tooltips. This is not initialised here because
// the group would end up behind other chart contents in a multi chart output. It will
// therefore be added and removed by the mouse enter/leave events
@ -2563,6 +2564,9 @@
this.tooltipFontFamily = "sans-serif";
// Help: http://github.com/PMSI-AlignAlytics/dimple/wiki/dimple.axis#wiki-radius
this.radius = "auto";
// The group within which to put all of this series's objects
this._group = chart._group.append("g");
this._group.attr('class', 'dimple-series-group-' + chart.series.length);
// Any event handlers joined to this series
this._eventHandlers = [];
@ -3442,7 +3446,7 @@
}
if (series.shapes === null || series.shapes === undefined) {
theseShapes = chart._group.selectAll("." + className).data(areaData);
theseShapes = series._group.selectAll("." + className).data(areaData);
} else {
theseShapes = series.shapes.data(areaData, function (d) { return d.key; });
}
@ -3536,7 +3540,7 @@
}
if (series.shapes === null || series.shapes === undefined) {
theseShapes = chart._group.selectAll("." + classes.join(".")).data(chartData);
theseShapes = series._group.selectAll("." + classes.join(".")).data(chartData);
} else {
theseShapes = series.shapes.data(chartData, function (d) { return d.key; });
}
@ -3655,7 +3659,7 @@
}
if (series.shapes === null || series.shapes === undefined) {
theseShapes = chart._group.selectAll("." + classes.join(".")).data(chartData);
theseShapes = series._group.selectAll("." + classes.join(".")).data(chartData);
} else {
theseShapes = series.shapes.data(chartData, function (d) {
return d.key;
@ -3896,7 +3900,7 @@
}
if (series.shapes === null || series.shapes === undefined) {
theseShapes = chart._group.selectAll("." + className).data(lineData);
theseShapes = series._group.selectAll("." + className).data(lineData);
} else {
theseShapes = series.shapes.data(lineData, function (d) { return d.key; });
}
@ -4050,7 +4054,7 @@
}
if (series.shapes === null || series.shapes === undefined) {
theseShapes = chart._group.selectAll("." + classes.join(".")).data(chartData);
theseShapes = series._group.selectAll("." + classes.join(".")).data(chartData);
} else {
theseShapes = series.shapes.data(chartData, function (d) { return d.key; });
}
@ -4244,7 +4248,7 @@
shapes;
if (series.lineMarkers) {
if (series._markerBacks === null || series._markerBacks === undefined || series._markerBacks[lineDataRow.keyString] === undefined) {
markerBacks = chart._group.selectAll("." + markerBackClasses.join(".")).data(lineDataRow.markerData);
markerBacks = series._group.selectAll("." + markerBackClasses.join(".")).data(lineDataRow.markerData);
} else {
markerBacks = series._markerBacks[lineDataRow.keyString].data(lineDataRow.markerData, function (d) { return d.key; });
}
@ -4312,7 +4316,7 @@
// 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.markerData);
markers = series._group.selectAll("." + markerClasses.join(".")).data(lineDataRow.markerData);
} else {
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

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

View File

@ -9,7 +9,7 @@
// 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.markerData);
markers = series._group.selectAll("." + markerClasses.join(".")).data(lineDataRow.markerData);
} else {
markers = series._markers[lineDataRow.keyString].data(lineDataRow.markerData, function (d) {
return d.key;

View File

@ -37,6 +37,7 @@
// The group within which to put all of this chart's objects
this._group = svg.append("g");
this._group.attr('class', 'dimple-chart');
// The group within which to put tooltips. This is not initialised here because
// the group would end up behind other chart contents in a multi chart output. It will
// therefore be added and removed by the mouse enter/leave events

View File

@ -336,7 +336,7 @@
}
if (series.shapes === null || series.shapes === undefined) {
theseShapes = chart._group.selectAll("." + className).data(areaData);
theseShapes = series._group.selectAll("." + className).data(areaData);
} else {
theseShapes = series.shapes.data(areaData, function (d) { return d.key; });
}

View File

@ -37,7 +37,7 @@
}
if (series.shapes === null || series.shapes === undefined) {
theseShapes = chart._group.selectAll("." + classes.join(".")).data(chartData);
theseShapes = series._group.selectAll("." + classes.join(".")).data(chartData);
} else {
theseShapes = series.shapes.data(chartData, function (d) { return d.key; });
}

View File

@ -26,7 +26,7 @@
}
if (series.shapes === null || series.shapes === undefined) {
theseShapes = chart._group.selectAll("." + classes.join(".")).data(chartData);
theseShapes = series._group.selectAll("." + classes.join(".")).data(chartData);
} else {
theseShapes = series.shapes.data(chartData, function (d) {
return d.key;

View File

@ -181,7 +181,7 @@
}
if (series.shapes === null || series.shapes === undefined) {
theseShapes = chart._group.selectAll("." + className).data(lineData);
theseShapes = series._group.selectAll("." + className).data(lineData);
} else {
theseShapes = series.shapes.data(lineData, function (d) { return d.key; });
}

View File

@ -93,7 +93,7 @@
}
if (series.shapes === null || series.shapes === undefined) {
theseShapes = chart._group.selectAll("." + classes.join(".")).data(chartData);
theseShapes = series._group.selectAll("." + classes.join(".")).data(chartData);
} else {
theseShapes = series.shapes.data(chartData, function (d) { return d.key; });
}

View File

@ -42,6 +42,9 @@
this.tooltipFontFamily = "sans-serif";
// Help: http://github.com/PMSI-AlignAlytics/dimple/wiki/dimple.axis#wiki-radius
this.radius = "auto";
// The group within which to put all of this series's objects
this._group = chart._group.append("g");
this._group.attr('class', 'dimple-series-group-' + chart.series.length);
// Any event handlers joined to this series
this._eventHandlers = [];