You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ma...@apache.org on 2017/08/24 22:38:04 UTC
[incubator-superset] branch master updated: bugfix for
addTotalValues with negative values (#3366)
This is an automated email from the ASF dual-hosted git repository.
maximebeauchemin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-superset.git
The following commit(s) were added to refs/heads/master by this push:
new 90ba6ee bugfix for addTotalValues with negative values (#3366)
90ba6ee is described below
commit 90ba6ee6a00128eed3eb06342e35a46e9397691a
Author: Boris Hajduk <bo...@gmail.com>
AuthorDate: Fri Aug 25 06:37:58 2017 +0800
bugfix for addTotalValues with negative values (#3366)
---
superset/assets/visualizations/nvd3_vis.js | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/superset/assets/visualizations/nvd3_vis.js b/superset/assets/visualizations/nvd3_vis.js
index 35e1e87..831b997 100644
--- a/superset/assets/visualizations/nvd3_vis.js
+++ b/superset/assets/visualizations/nvd3_vis.js
@@ -38,24 +38,26 @@ const addTotalBarValues = function (svg, chart, data, stacked, axisFormat) {
return true;
}
return i === countSeriesDisplayed - 1;
- }).selectAll('rect.positive');
+ }).selectAll('rect');
const groupLabels = svg.select('g.nv-barsWrap').append('g');
rectsToBeLabeled.each(
function (d, index) {
const rectObj = d3.select(this);
- const transformAttr = rectObj.attr('transform');
- const yPos = parseFloat(rectObj.attr('y'));
- const xPos = parseFloat(rectObj.attr('x'));
- const rectWidth = parseFloat(rectObj.attr('width'));
- const t = groupLabels.append('text')
- .attr('x', xPos) // rough position first, fine tune later
- .attr('y', yPos - 5)
- .text(format(stacked ? totalStackedValues[index] : d.y))
- .attr('transform', transformAttr)
- .attr('class', 'bar-chart-label');
- const labelWidth = t.node().getBBox().width;
- t.attr('x', xPos + rectWidth / 2 - labelWidth / 2); // fine tune
+ if (rectObj.attr('class').includes('positive')) {
+ const transformAttr = rectObj.attr('transform');
+ const yPos = parseFloat(rectObj.attr('y'));
+ const xPos = parseFloat(rectObj.attr('x'));
+ const rectWidth = parseFloat(rectObj.attr('width'));
+ const t = groupLabels.append('text')
+ .attr('x', xPos) // rough position first, fine tune later
+ .attr('y', yPos - 5)
+ .text(format(stacked ? totalStackedValues[index] : d.y))
+ .attr('transform', transformAttr)
+ .attr('class', 'bar-chart-label');
+ const labelWidth = t.node().getBBox().width;
+ t.attr('x', xPos + rectWidth / 2 - labelWidth / 2); // fine tune
+ }
});
};
--
To stop receiving notification emails like this one, please contact
['"commits@superset.apache.org" <co...@superset.apache.org>'].