Prevent Data Labels from rendering on 0 values

Hi, is there a way I can prevent data labels from rendering when the y value is 0? I tried using ranges without luck.

See screenshot:

https://gyazo.com/c5daf632138ed58a54e13d846ef6fe2c


3 Replies

DD Dharanidharan Dharmasivam Syncfusion Team January 3, 2018 10:25 AM UTC

Hi Magnus,  

Thanks for using Syncfusion products. 

We have analyzed your query, your requirement can be achieved using display-text-rendering event. This event will be triggered for each data label and we can able to customize the data label text in this event. In order to achieve your requirement, we have cancelled the event when the data label value is 0(zero). You can change this with respect to your scenario. Kindly find the code snippet to achieve this scenario. 

ASP.NET Core: 

<ej-chart display-text-rendering="dataLabel"> 
</ej-chart> 
 
function dataLabel(sender) { 
                if (sender.data.text === 0) sender.cancel = true; 
            } 


Screenshot: 
 

Sample for reference can be find from below link. 
 
Kindly revert us, if you have any concerns. 


Thanks, 
Dharani.


MB Magnus Braathen January 4, 2018 09:10 AM UTC

Thanks, that did the trick! :)


DD Dharanidharan Dharmasivam Syncfusion Team January 5, 2018 04:17 AM UTC

Hi Magnus, 

Thanks for the update. 

Kindly revert us, if you need any further assistance. 

Dharani. 
  



Loader.
Up arrow icon