81
Views
3
Comments
Solved
[OutSystems Charts] Chart Version 3.2 Formatter Function not working
outsystems-charts
Reactive icon
Forge asset by OutSystems
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));

2022-11-12 11-28-30
Gonçalo Martins
Staff
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

2022-04-11 07-41-42
Aarathi S

This works!!! Thank you so much.

2023-01-11 05-39-38
Jendale Kim Ramay

Hello @Gonçalo Martins ,

This might be late but thank you for this solution.


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