We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Customizing the numbers in the ejChart

Hello Syncfusion. 

I am using the ejChart and was wondering if customizing the numbers are possible 

For example 
if the number is 100,000,000 then this should be displayed as 100,000 thousand or 100 million 

would this be possible? 


1 Reply

SK Saravana Kumar Kanagavel Syncfusion Team August 19, 2016 07:19 AM UTC

Hi Maverickjin8, 
 
Thanks for contacting syncfusion support. 
We have analyzed your query and created a sample based on your requirement. And this can be achieved as an work around. 
Please refer the code example below 
 
[JS] 
  $("#container").ejChart( 
        { 
            axesLabelRendering: "axesLabelChange" 
   }); 
 
function axesLabelChange(sender) { //axesLabelRendering event triggered 
        var value; 
        var type = $("#type option:selected").text(); 
        if (type != "None") { 
            var axisLabel = sender.data.label.Text; 
            if (sender.data.axis.orientation == "vertical") { 
                if (type == "K") { 
                    value = axisLabel / 1000; 
                    sender.data.label.Text = value + " Thousand"; 
                } 
                else if (type == "M") { 
                    value = axisLabel / 100000; 
                    sender.data.label.Text = value + " Million"; 
                } 
                else if (type == "B") { 
                    value = axisLabel / 1000000000; 
                    sender.data.label.Text = value + " Billion"; 
                } 
            } 
        } 
    } 
   
In the above code, we are triggering axesLableRendering event in chart. In the event, we are getting the axis label text and text value is divided by based on the value from the drop down list. Then we are adding suffix such as “thousand” or “Million” or “Billion” with the divided value and assigning that value to the axis label text. 
 
And we have attached the sample in the below location for your reference. 
 
  
Find the output of the sample below 
 
 
 
Please let us know if you have any concern. 
 
Regards, 
Saravana Kumar K 


Loader.
Up arrow icon