Lisha
09-02-2022Cloud Apps
Widget script for specific condition in Column chart
Below is a script that I had added for an indicator widget. If the secondary measure gives a result greater than 1, the widget will show NA.
widget.on('render', function (se, ev) {
if(se.queryResult.secondary.data > 1)
{
se.queryResult.value.text = "N/A";
}
});
I want to achieve the same thing but for a column chart. I already have 3 values for the column chart and I added the 4th value which will determine NA scenario. The 4th value should not appear as a bar (it should be hidden), we are only using it in the script. However, I am not able to figure out the script for the same.
Enable 4th panel and try this script
widget.on('processresult', function(se, ev){ if(ev.result.series[0].data[3].y > 1) { ev.result.series = [] ev.rawResult.values = [] } ev.result.xAxis.categories.length = 3 ev.result.series.length = 3 ev.result.series[0].data.length = 3 })
-Hari