Skip to content

Instantly share code, notes, and snippets.

@TorsteinHonsi
Created June 24, 2015 12:52
Show Gist options
  • Save TorsteinHonsi/a9759e7b54af718ca396 to your computer and use it in GitHub Desktop.
Save TorsteinHonsi/a9759e7b54af718ca396 to your computer and use it in GitHub Desktop.
diff --git a/js/parts/Axis.js b/js/parts/Axis.js
index 0b5a1b5..d933a04 100644
--- a/js/parts/Axis.js
+++ b/js/parts/Axis.js
@@ -134,7 +134,7 @@ Axis.prototype = {
//textAlign: dynamic,
//rotation: 0,
formatter: function () {
- return Highcharts.numberFormat(this.total, -1);
+ return this.nullCount ? '' : Highcharts.numberFormat(this.total, -1);
},
style: merge(defaultPlotOptions.line.dataLabels.style, { color: '#000000' })
}
diff --git a/js/parts/Stacking.js b/js/parts/Stacking.js
index ef16043..2c13cbb 100644
--- a/js/parts/Stacking.js
+++ b/js/parts/Stacking.js
@@ -18,6 +18,7 @@ function StackItem(axis, options, isNegative, x, stackOption) {
// Initialize total value
this.total = null;
+ this.nullCount = 0;
// This will keep each points' extremes stored by series.index and point index
this.points = {};
@@ -219,6 +220,8 @@ Series.prototype.setStackedPoints = function () {
if (oldStacks[key] && oldStacks[key][x]) {
stacks[key][x] = oldStacks[key][x];
stacks[key][x].total = null;
+ stacks[key][x].nullCount = 0;
+
} else {
stacks[key][x] = new StackItem(yAxis, yAxis.options.stackLabels, isNegative, x, stackOption);
}
@@ -253,6 +256,10 @@ Series.prototype.setStackedPoints = function () {
stack.points[pointKey].push(stack.cum);
stackedYData[i] = stack.cum;
+ if (y === null) {
+ stack.nullCount++;
+ }
+
}
if (stacking === 'percent') {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment