Skip to content

Commit 7d5cf26

Browse files
Reverted inadvertant changes to past versions
1 parent 78c940f commit 7d5cf26

7 files changed

Lines changed: 42 additions & 92 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ node_modules
55
help
66
image_creator
77
tmp
8+
notes

dist/dimple.latest.js

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,11 @@
12901290

12911291
// Loop again to calculate shares
12921292
for (i = 0; i < returnData.length; i += 1) {
1293-
returnData[i].piePct = (returnData[i].pValue / pieDictionary[returnData[i].pieKey].total);
1293+
if (pieDictionary[returnData[i].pieKey].total === 0) {
1294+
returnData[i].piePct = 0;
1295+
} else {
1296+
returnData[i].piePct = (returnData[i].pValue / pieDictionary[returnData[i].pieKey].total);
1297+
}
12941298
returnData[i].startAngle = pieDictionary[returnData[i].pieKey].angle;
12951299
returnData[i].endAngle = returnData[i].startAngle + returnData[i].piePct * (endAngle - startAngle);
12961300
pieDictionary[returnData[i].pieKey].angle = returnData[i].endAngle;
@@ -4823,26 +4827,12 @@
48234827
// License: "https://github.com/PMSI-AlignAlytics/dimple/blob/master/MIT-LICENSE.txt"
48244828
// Source: /src/methods/_parentWidth.js
48254829
dimple._parentWidth = function (parent) {
4826-
// This one seems to work in Chrome - good old Chrome!
4827-
var returnValue = parent.offsetWidth;
4828-
// This does it for IE
4830+
// Let's be explicit about what we are trying to get here
4831+
var returnValue = parent.getBoundingClientRect().width;
4832+
// If it returns nothing then go with "clientWidth"
48294833
if (!returnValue || returnValue < 0) {
48304834
returnValue = parent.clientWidth;
48314835
}
4832-
// FireFox is the hard one this time. See this bug report:
4833-
// https://bugzilla.mozilla.org/show_bug.cgi?id=649285//
4834-
// It's dealt with by trying to recurse up the dom until we find something
4835-
// we can get a size for. Usually the parent of the SVG. It's a bit costly
4836-
// but I don't know of any other way.
4837-
if (!returnValue || returnValue < 0) {
4838-
if (!parent.parentNode) {
4839-
// Give up - Recursion Exit Point
4840-
returnValue = 0;
4841-
} else {
4842-
// Get the size from the parent recursively
4843-
returnValue = dimple._parentWidth(parent.parentNode);
4844-
}
4845-
}
48464836
return returnValue;
48474837
};
48484838

dist/dimple.latest.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/dimple.v2.1.6.js

Lines changed: 18 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -661,11 +661,6 @@
661661

662662
// The group within which to put all of this chart's objects
663663
this._group = svg.append("g");
664-
this._group.attr('class', 'dimple-chart');
665-
this._gridlines_group = this._group.insert('g');
666-
this._gridlines_group.attr('class', 'dimple-gridlines-group');
667-
this._axis_group = this._group.insert('g');
668-
this._axis_group.attr('class', 'dimple-axis-group');
669664
// The group within which to put tooltips. This is not initialised here because
670665
// the group would end up behind other chart contents in a multi chart output. It will
671666
// therefore be added and removed by the mouse enter/leave events
@@ -1017,20 +1012,12 @@
10171012
returnData.forEach(function (ret) {
10181013
if (x !== null) {
10191014
if (useCount.x === true) { ret.xValue = ret.xValueList.length; }
1020-
if (x._hasMeasure() && x._hasCategories()) {
1021-
tot = (totals.x[ret.xField.join("/")] || 0) + (x._hasMeasure() ? Math.abs(ret.xValue) : 0);
1022-
} else {
1023-
tot = (totals.x[ret.xField.join("/")] || 0) + (y._hasMeasure() ? Math.abs(ret.yValue) : 0);
1024-
}
1015+
tot = (totals.x[ret.xField.join("/")] || 0) + (y._hasMeasure() ? Math.abs(ret.yValue) : 0);
10251016
totals.x[ret.xField.join("/")] = tot;
10261017
}
10271018
if (y !== null) {
10281019
if (useCount.y === true) { ret.yValue = ret.yValueList.length; }
1029-
if (y._hasMeasure() && y._hasCategories()) {
1030-
tot = (totals.y[ret.yField.join("/")] || 0) + (y._hasMeasure() ? Math.abs(ret.yValue) : 0);
1031-
} else {
1032-
tot = (totals.y[ret.yField.join("/")] || 0) + (x._hasMeasure() ? Math.abs(ret.xValue) : 0);
1033-
}
1020+
tot = (totals.y[ret.yField.join("/")] || 0) + (x._hasMeasure() ? Math.abs(ret.xValue) : 0);
10341021
totals.y[ret.yField.join("/")] = tot;
10351022
}
10361023
if (p !== null) {
@@ -1150,6 +1137,7 @@
11501137

11511138
};
11521139

1140+
11531141
// Copyright: 2015 AlignAlytics
11541142
// License: "https://github.com/PMSI-AlignAlytics/dimple/blob/master/MIT-LICENSE.txt"
11551143
// Source: /src/objects/chart/methods/_getDelay.js
@@ -1614,7 +1602,6 @@
16141602
tooltipLabel: 'dimple-custom-tooltip-label',
16151603
tooltipDropLine: 'dimple-custom-tooltip-dropline',
16161604
lineMarker: 'dimple-custom-line-marker',
1617-
lineMarkerCircle: 'dimple-custom-line-marker-circle',
16181605
legendLabel: 'dimple-custom-legend-label',
16191606
legendKey: 'dimple-custom-legend-key',
16201607
areaSeries: 'dimple-custom-series-area',
@@ -1636,7 +1623,6 @@
16361623
'dimple-custom-format-10'
16371624
]
16381625
};
1639-
16401626
// Copyright: 2015 AlignAlytics
16411627
// License: "https://github.com/PMSI-AlignAlytics/dimple/blob/master/MIT-LICENSE.txt"
16421628
// Source: /src/objects/chart/methods/defaultColors.js
@@ -1843,7 +1829,7 @@
18431829
if (axis.gridlineShapes === null) {
18441830
if (axis.showGridlines || (axis.showGridlines === null && !axis._hasCategories() && ((!xGridSet && axis.position === "x") || (!yGridSet && axis.position === "y")))) {
18451831
// Add a group for the gridlines to allow css formatting
1846-
axis.gridlineShapes = this._gridlines_group.append("g").attr("class", "dimple-gridline");
1832+
axis.gridlineShapes = this._group.append("g").attr("class", "dimple-gridline");
18471833
if (axis.position === "x") {
18481834
xGridSet = true;
18491835
} else {
@@ -1859,7 +1845,7 @@
18591845
}
18601846
if (axis.shapes === null) {
18611847
// Add a group for the axes to allow css formatting
1862-
axis.shapes = this._axis_group.append("g")
1848+
axis.shapes = this._group.append("g")
18631849
.attr("class", "dimple-axis dimple-axis-" + axis.position)
18641850
.each(function () {
18651851
if (!chart.noFormats) {
@@ -2047,7 +2033,7 @@
20472033
// Add a title for the axis - NB check for null here, by default the title is undefined, in which case
20482034
// use the dimension name
20492035
if (!axis.hidden && (axis.position === "x" || axis.position === "y") && axis.title !== null) {
2050-
axis.titleShape = this._axis_group.append("text")
2036+
axis.titleShape = this._group.append("text")
20512037
.attr("class", "dimple-axis dimple-title " + chart.customClassList.axisTitle + " dimple-axis-" + axis.position);
20522038
axis.titleShape
20532039
.attr("x", titleX)
@@ -2191,6 +2177,8 @@
21912177
this._heightPixels = function () {
21922178
return dimple._parentHeight(this.svg.node()) - this._yPixels() - dimple._parseYPosition(bottom, this.svg.node());
21932179
};
2180+
// Refresh the axes to redraw them against the new bounds
2181+
this.draw(0, true);
21942182
// return the chart object for method chaining
21952183
return this;
21962184
};
@@ -2568,9 +2556,6 @@
25682556
this.tooltipFontFamily = "sans-serif";
25692557
// Help: http://github.com/PMSI-AlignAlytics/dimple/wiki/dimple.axis#wiki-radius
25702558
this.radius = "auto";
2571-
// The group within which to put all of this series's objects
2572-
this._group = chart._group.append("g");
2573-
this._group.attr('class', 'dimple-series-group-' + chart.series.length);
25742559

25752560
// Any event handlers joined to this series
25762561
this._eventHandlers = [];
@@ -3157,7 +3142,6 @@
31573142
p,
31583143
b,
31593144
l,
3160-
lIndex,
31613145
lastAngle,
31623146
catCoord,
31633147
valCoord,
@@ -3424,20 +3408,17 @@
34243408
p = getArea(interpolation, "_previousOrigin")(finalPointArray);
34253409
b = getArea((interpolation === "step-after" ? "step-before" : (interpolation === "step-before" ? "step-after" : interpolation)), "_previousOrigin")(basePoints);
34263410
l = getArea("linear", "_previousOrigin")(finalPointArray);
3427-
lIndex = l.indexOf("L") === -1 ? undefined : l.indexOf("L");
3428-
areaData[i].entry = p + (b && b.length > 0 ? "L" + b.substring(1) : "") + (l && l.length > 0 ? "L" + l.substring(1, lIndex) : 0);
3411+
areaData[i].entry = p + (b && b.length > 0 ? "L" + b.substring(1) : "") + (l && l.length > 0 ? "L" + l.substring(1, l.indexOf("L")) : 0);
34293412

34303413
p = getArea(interpolation)(finalPointArray);
34313414
b = getArea(interpolation === "step-after" ? "step-before" : (interpolation === "step-before" ? "step-after" : interpolation))(basePoints);
34323415
l = getArea("linear")(finalPointArray);
3433-
lIndex = l.indexOf("L") === -1 ? undefined : l.indexOf("L");
3434-
areaData[i].update = p + (b && b.length > 0 ? "L" + b.substring(1) : "") + (l && l.length > 0 ? "L" + l.substring(1, lIndex) : 0);
3416+
areaData[i].update = p + (b && b.length > 0 ? "L" + b.substring(1) : "") + (l && l.length > 0 ? "L" + l.substring(1, l.indexOf("L")) : 0);
34353417

34363418
p = getArea(interpolation, "_origin")(finalPointArray);
34373419
b = getArea((interpolation === "step-after" ? "step-before" : (interpolation === "step-before" ? "step-after" : interpolation)), "_origin")(basePoints);
34383420
l = getArea("linear", "_origin")(finalPointArray);
3439-
lIndex = l.indexOf("L") === -1 ? undefined : l.indexOf("L");
3440-
areaData[i].exit = p + (b && b.length > 0 ? "L" + b.substring(1) : "") + (l && l.length > 0 ? "L" + l.substring(1, lIndex) : 0);
3421+
areaData[i].exit = p + (b && b.length > 0 ? "L" + b.substring(1) : "") + (l && l.length > 0 ? "L" + l.substring(1, l.indexOf("L")) : 0);
34413422

34423423
// Add the color in this loop, it can't be done during initialisation of the row because
34433424
// the areas should be ordered first (to ensure standard distribution of colors
@@ -3450,7 +3431,7 @@
34503431
}
34513432

34523433
if (series.shapes === null || series.shapes === undefined) {
3453-
theseShapes = series._group.selectAll("." + className).data(areaData);
3434+
theseShapes = chart._group.selectAll("." + className).data(areaData);
34543435
} else {
34553436
theseShapes = series.shapes.data(areaData, function (d) { return d.key; });
34563437
}
@@ -3544,7 +3525,7 @@
35443525
}
35453526

35463527
if (series.shapes === null || series.shapes === undefined) {
3547-
theseShapes = series._group.selectAll("." + classes.join(".")).data(chartData);
3528+
theseShapes = chart._group.selectAll("." + classes.join(".")).data(chartData);
35483529
} else {
35493530
theseShapes = series.shapes.data(chartData, function (d) { return d.key; });
35503531
}
@@ -3663,7 +3644,7 @@
36633644
}
36643645

36653646
if (series.shapes === null || series.shapes === undefined) {
3666-
theseShapes = series._group.selectAll("." + classes.join(".")).data(chartData);
3647+
theseShapes = chart._group.selectAll("." + classes.join(".")).data(chartData);
36673648
} else {
36683649
theseShapes = series.shapes.data(chartData, function (d) {
36693650
return d.key;
@@ -3877,17 +3858,6 @@
38773858
}
38783859
}
38793860

3880-
// Special case when a line contains a single point - duplicate the point
3881-
// If we don't do this a path will be created with 0,0 coordinates
3882-
if (lineData && lineData[i] && lineData[i].points && lineData[i].points.length === 1) {
3883-
lineData[i].points.push(
3884-
{
3885-
x : lineData[i].points[0].x,
3886-
y : lineData[i].points[0].y
3887-
}
3888-
);
3889-
}
3890-
38913861
// Get the points that this line will appear
38923862
lineData[i].entry = getLine(interpolation, "_previousOrigin")(lineData[i].points);
38933863
lineData[i].update = getLine(interpolation)(lineData[i].points);
@@ -3904,7 +3874,7 @@
39043874
}
39053875

39063876
if (series.shapes === null || series.shapes === undefined) {
3907-
theseShapes = series._group.selectAll("." + className).data(lineData);
3877+
theseShapes = chart._group.selectAll("." + className).data(lineData);
39083878
} else {
39093879
theseShapes = series.shapes.data(lineData, function (d) { return d.key; });
39103880
}
@@ -4058,7 +4028,7 @@
40584028
}
40594029

40604030
if (series.shapes === null || series.shapes === undefined) {
4061-
theseShapes = series._group.selectAll("." + classes.join(".")).data(chartData);
4031+
theseShapes = chart._group.selectAll("." + classes.join(".")).data(chartData);
40624032
} else {
40634033
theseShapes = series.shapes.data(chartData, function (d) { return d.key; });
40644034
}
@@ -4252,7 +4222,7 @@
42524222
shapes;
42534223
if (series.lineMarkers) {
42544224
if (series._markerBacks === null || series._markerBacks === undefined || series._markerBacks[lineDataRow.keyString] === undefined) {
4255-
markerBacks = series._group.selectAll("." + markerBackClasses.join(".")).data(lineDataRow.markerData);
4225+
markerBacks = chart._group.selectAll("." + markerBackClasses.join(".")).data(lineDataRow.markerData);
42564226
} else {
42574227
markerBacks = series._markerBacks[lineDataRow.keyString].data(lineDataRow.markerData, function (d) { return d.key; });
42584228
}
@@ -4320,7 +4290,7 @@
43204290

43214291
// Deal with markers in the same way as main series to fix #28
43224292
if (series._markers === null || series._markers === undefined || series._markers[lineDataRow.keyString] === undefined) {
4323-
markers = series._group.selectAll("." + markerClasses.join(".")).data(lineDataRow.markerData);
4293+
markers = chart._group.selectAll("." + markerClasses.join(".")).data(lineDataRow.markerData);
43244294
} else {
43254295
markers = series._markers[lineDataRow.keyString].data(lineDataRow.markerData, function (d) {
43264296
return d.key;
@@ -5247,7 +5217,6 @@
52475217

52485218
// Add a ring around the data point
52495219
chart._tooltipGroup.append("circle")
5250-
.attr("class", "dimple-line-marker-circle " + chart.customClassList.lineMarkerCircle)
52515220
.attr("cx", cx)
52525221
.attr("cy", cy)
52535222
.attr("r", r)

dist/dimple.v2.1.6.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/dimple.v2.2.0.js

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,11 @@
12901290

12911291
// Loop again to calculate shares
12921292
for (i = 0; i < returnData.length; i += 1) {
1293-
returnData[i].piePct = (returnData[i].pValue / pieDictionary[returnData[i].pieKey].total);
1293+
if (pieDictionary[returnData[i].pieKey].total === 0) {
1294+
returnData[i].piePct = 0;
1295+
} else {
1296+
returnData[i].piePct = (returnData[i].pValue / pieDictionary[returnData[i].pieKey].total);
1297+
}
12941298
returnData[i].startAngle = pieDictionary[returnData[i].pieKey].angle;
12951299
returnData[i].endAngle = returnData[i].startAngle + returnData[i].piePct * (endAngle - startAngle);
12961300
pieDictionary[returnData[i].pieKey].angle = returnData[i].endAngle;
@@ -4823,26 +4827,12 @@
48234827
// License: "https://github.com/PMSI-AlignAlytics/dimple/blob/master/MIT-LICENSE.txt"
48244828
// Source: /src/methods/_parentWidth.js
48254829
dimple._parentWidth = function (parent) {
4826-
// This one seems to work in Chrome - good old Chrome!
4827-
var returnValue = parent.offsetWidth;
4828-
// This does it for IE
4830+
// Let's be explicit about what we are trying to get here
4831+
var returnValue = parent.getBoundingClientRect().width;
4832+
// If it returns nothing then go with "clientWidth"
48294833
if (!returnValue || returnValue < 0) {
48304834
returnValue = parent.clientWidth;
48314835
}
4832-
// FireFox is the hard one this time. See this bug report:
4833-
// https://bugzilla.mozilla.org/show_bug.cgi?id=649285//
4834-
// It's dealt with by trying to recurse up the dom until we find something
4835-
// we can get a size for. Usually the parent of the SVG. It's a bit costly
4836-
// but I don't know of any other way.
4837-
if (!returnValue || returnValue < 0) {
4838-
if (!parent.parentNode) {
4839-
// Give up - Recursion Exit Point
4840-
returnValue = 0;
4841-
} else {
4842-
// Get the size from the parent recursively
4843-
returnValue = dimple._parentWidth(parent.parentNode);
4844-
}
4845-
}
48464836
return returnValue;
48474837
};
48484838

dist/dimple.v2.2.0.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)