Forum Discussion

jeffreyl's avatar
jeffreyl
Cloud Apps
11-30-2022

Column Custom Number Abbreviation (kW instead of K)

I have a column chart where I need the number abbreviation to be kW instead of K and have been unable to find a solution.

Thank you

2 Replies

Replies have been turned off for this discussion
  • Hi jeffreyl ,

    Please try this script

     

    widget.on('domready', function(se, ev){
    
    $("widget[widgetid=''] cartesianchart .highcharts-root .highcharts-stack-labels text tspan").each(function(i, obj)//widgetid number pls add
         {
        var Valuetext=$(this).text().split(',').join('');
    
                 if($.isNumeric(Valuetext)){
                            value = parseFloat(Valuetext)/1000000.0;                
                            var decValue  = value.toFixed(2);                
                            var newValue=decValue+'KW';                 
                            $(this).text(newValue);
    
     
    
         }
    
      })
    })

     

    Thanks

    Sijo

    • jeffreyl's avatar
      jeffreyl
      Cloud Apps

      Sijo,

      Thank you for the code. It does change the abbrev to kW which is Great. On the chart I am trying to modify it causes the numbers to change as an example from 4325 to 00.100. Not sure why but I can see that your code is making the change I am looking for. Thank you. Next week I will create a new basic chart and test. It's possible the other options/code I have in this widget is causing the issue. Thank You!!