15
Views
2
Comments
Solved
[OutSystems Charts] Chart Version 3.2 Formatter Function not working
outsystems-charts
Reactive icon
Forge component by Gonçalo Martins
Application Type
Reactive
Service Studio Version
11.54.31 (Build 62912)

I am unable to provide a condition in formatter to display datalabels on stacked grouped column chart only if the datapoint value is greater than zero. I tried to use the formatter function as below. However, the formatter function was not working in any of the JS code that I've used. Even a console.log inside the formatter was not returning an output. Can anyone please suggest me the right way to use formatter function in Outsystems Charts v 3.2.0?

JS Code:

const chartLabels = {   

 'plotOptions': {      

     'column': {                     

      'dataLabels': {    

                     'enabled': true,      

                     'formatter': function () {         

                                                              var point = this.point;      var xValue = point.x;      var yValue = point.y;             

                                                              if(yValue != 0) {                       

                                                                 return yValue; }

                                                                 }  

                                  }  

                           }

                     },          

};

OutSystems.ChartAPI.Chart.SetProviderConfigs($parameters.ChartWidgetId, JSON.stringify(chartLabels));

Solution

Hello @Aarathi S 

First of all, thank you for reaching out.
This is a scenario that was broken with some re-architecture work done (mostly for security reasons), so sorry about the inconvenience. We'll try to review this for the next release. 

As a workaround, you can do the following instead:

Replace:

OutSystems.ChartAPI.Chart.SetProviderConfigs($parameters.ChartWidgetId, JSON.stringify(chartLabels));

by

OutSystems.ChartAPI.Chart.GetById($parameters.ChartWidgetId).provider.update(chartTooltip, true, true);

Hope it helps to unblock you.

Cheers,
GM

This works!!! Thank you so much.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.