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

Bar chart axis labels rendering

Hi Team,

I am trying to build a bar chart and I pass maximum abd minimum value for primary Y axis from controller and I have set the sans properties in the chart as well. The maximum and minimum works well. However, there's no zero point on y Axis labels. Could you please  help me to render zero always in  y axis as one of the labels.


Thanks

1 Reply

DD Dharanidharan Dharmasivam Syncfusion Team February 1, 2019 10:12 AM UTC

Hi Jsu, 
 
Greetings from Syncfusion.  
 
We have analyzed your requirement. In general, when ranges (minimum, maximum) are not specified, then for the bar chart the minimum range will be calculated from zero only. In your scenario, you have specified ranges for y axis, so based on this ranges will be calculated. This is the current behavior. 
 
Also, we would like to let you know that, the axis labels text can be customized using the axislabelRender event. This event will be triggered for each axis label and can be customized based on your requirement. 
 
 
@Html.EJS().Chart("container").AxisLabelRender("labelRender") 
  .PrimaryYAxis(py => py.Minimum(2).Maximum(10) ) 
   Other configurations 
 
.Render() 
 
function labelRender(args) { 
        if (args.axis.orientation === "Horizontal" && args.axis.minimum === parseFloat(args.text)) { 
            args.text = "0"; 
        } 
    } 
 
 
Here we have set y axis minimum value as 2, but we have customized the text in event as depicted above. For more information axis labels customization, find the user guide. 
Screenshot: 
 
 
Thanks, 
Dharani. 


Loader.
Live Chat Icon For mobile
Up arrow icon