Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Set the currency symbol on Charts Dynamically

Veerendra Patil5 hours ago

Hi,

I have a chart whose query is dynamic .. and the properties of the chart are also set dynamically using below code

On the Page level - Executes when Page Load I have

require(["ojs/ojconverter-number", "ojs/ojconverter-nativenumber"], function(ojc, ojn) {
  decConverter = new ojn.NumberConverter({style : "decimal", decimalFormat: "short", minimumFractionDigits: 1, maximumFractionDigits: 1});
});

After Page Loads with setTimeOut I have Below code to refresh the Chart as

var yAxisConverter = new oj.IntlNumberConverter({style : "currency", currency: "USD", currencyDisplay: "symbol"});

           // Orientation, Stack, Legend Position, X/Y Labels
           apex.region("chartID").widget().ojChart({
               type: chartType,
               orientation: pParams.orientation,
               stack: pParams.stack,
               stackLabel: pParams.stack,
               hiddenCategories: pHiddenCategories,
               legend: {
                   rendered: pParams.showLegend,
                   position: pParams.legendPosition,
                   backgroundColor: pParams.legendColour
               },
               xAxis: {
                   title: pParams.xAxisLabel
               },
               yAxis: {
                   title: pParams.yAxisLabel,
                   referenceObjects: pParams.refObj,
                   tickLabel: {
                       converter: yAxisConverter,
                       scaling: 'none'
                   }
               },
               styleDefaults: {
                   lineType: pParams.pLineType,
                   dataLabelPosition: pParams.dataLabelPosition
               },
               valueFormats: {
                   label: {
                       scaling: pParams.pValueFormatting
                   }
               }
           });
var ele = “chartID_jet”; 
$(ele).ojChart('option', 'valueFormats.label.converter', decConverter);
                   $(ele).ojChart('option', 'valueFormats.value.converter', decConverter);
                   $(ele).ojChart('option', 'valueFormats.y.converter', decConverter);

I am not able to get yAxisConverter and decConverter working together, When I add the yAxisConverter,, I loose the Y-axis ticklabel formatter, The number appears as $12,00,000, instead of $12M. If I remove the yAxisConverter , I get the Y-axis label as 12M, without the curr symbol.

Also, How to get the bar labels also to display the currency symbol dynamically when the yAxisConverter has CURR symbol?

Please suggest.

Thanks.

Comments
Post Details
Added 5 hours ago
0 comments
13 views