Removing 0 And N/A Value Lables From Column Or Bar Chart
Introduction
In some cases 0 values are unnecessary and may interrupt Bar or Column Chart widgets display.
Explanation
When choosing to display 'Value Labels' some measures that contain 0's and N/A's can interrupt the display for example:

Solution
In order to remove the 0's and N/A's please enter the following script under the widgets "edit script":
widget.on("beforeviewloaded", function (w, args) {
args.options.plotOptions.series.dataLabels.formatter = function () {
var func = $$get(this, "series.options.mask");
if (defined(func) && this.y > 0) {
return func(this.y);
} else {
if (defined(func) && (this.y === null || this.y === 0)) {
return "";
} else {
return formatWithCommas(this.y);
}
}
}
})
args.options.plotOptions.series.dataLabels.formatter = function () {
var func = $$get(this, "series.options.mask");
if (defined(func) && this.y > 0) {
return func(this.y);
} else {
if (defined(func) && (this.y === null || this.y === 0)) {
return "";
} else {
return formatWithCommas(this.y);
}
}
}
})
If you only want to exclude N/A's please enter the following script under the widgets "edit script":
widget.on("beforeviewloaded", function (w, args) {
args.options.plotOptions.series.dataLabels.formatter = function () {
var func = $$get(this, "series.options.mask");
if (defined(func) && this.y > 0) {
return func(this.y);
} else {
if (defined(func) && this.y === null) {
return "";
} else {
return formatWithCommas(this.y);
}
}
}
})
args.options.plotOptions.series.dataLabels.formatter = function () {
var func = $$get(this, "series.options.mask");
if (defined(func) && this.y > 0) {
return func(this.y);
} else {
if (defined(func) && this.y === null) {
return "";
} else {
return formatWithCommas(this.y);
}
}
}
})
Updated 03-02-2023
intapiuser
Admin
Joined December 15, 2022