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

DataLabel in Bar Graph not shown all value

below in my code to generate bar graph. by default, not all bar is labelled. please refer attached picture. really appreciate if you can help me with this. thanks :)



@(Html.EJS().Chart("graph_bar").Height("258").Width("743").Series(sr =>
  {
                                 sr.Type(Syncfusion.EJ2.Charts.ChartSeriesType.Column).Marker(ViewBag.Marker).XName("x").YName("yValue2").DataSource(ViewBag.dataSource).Name("Red").Width(3).Add();
                                 sr.Type(Syncfusion.EJ2.Charts.ChartSeriesType.Column).Marker(ViewBag.Marker).XName("x").YName("yValue1").DataSource(ViewBag.dataSource).Name("Yellow").Width(3).Add();
      sr.Type(Syncfusion.EJ2.Charts.ChartSeriesType.Column).Marker(ViewBag.Marker).XName("x").YName("yValue").DataSource(ViewBag.dataSource).Name("Green").Width(3).Add();
    }
     ).LegendSettings(legend => legend.Width("104%")
     ).PrimaryYAxis(px => px.Minimum(0).Maximum(50).Interval(10).LabelStyle(ViewBag.Style).LineStyle(ViewBag.Line).MajorTickLines(ViewBag.Line).MajorGridLines(ViewBag.line).LineStyle(ViewBag.lineStyle)
     ).PrimaryXAxis(px => px.Interval(1).ValueType(Syncfusion.EJ2.Charts.ValueType.Category).MajorGridLines(ViewBag.line).MinorGridLines(ViewBag.minorGridLines)
     ).LegendSettings(legend => legend.Alignment(Syncfusion.EJ2.Charts.Alignment.Center)
     ).ZoomSettings(z => z.EnableMouseWheelZooming(true)
     ).Tooltip(tt => tt.Enable(true)
     ).ChartArea(area => area.Border(ViewBag.ChartBorder)
     ).Title("Statistic by Mode (BL Manifest)").Load("load").Render()
                    )


3 Replies

KC Kalaimathi Chellaiah Syncfusion Team December 26, 2018 11:27 AM UTC

Hi Muhammad, 
 
Greetings from Syncfusion. 
 
We have analyzed query with attached code snippet. Consider the following sample here we have created chart with datalabel in version 16.4.0.42. Already we got datalabel property through an viewBag from code behind. Now we gave lambda support for all property. Please find below code snippet which was used to show all label values of the chart. 
chartFeatures.cshtml 
@(Html.EJS().Chart("graph_bar").Width("743").Series(sr => 
{ 
    sr.Type(Syncfusion.EJ2.Charts.ChartSeriesType.Column).Marker(mr=> mr.Visible(true).DataLabel(dl=> dl.Visible(true))).XName("xValue").YName("yValue2").DataSource(ViewBag.dataSource).Name("Red").Width(3).Add(); 
    /… 
} 
) 
   ) 
 
Screenshot: 
 
 
Regards, 
Kalai 



AF afiqdoherty December 27, 2018 03:53 AM UTC

Thanks Kalai,

this solution works.

afiq :)


DD Dharanidharan Dharmasivam Syncfusion Team December 31, 2018 05:58 AM UTC

Hi Muhammad, 
 
We are happy to hear that provide solution works at your end. Kindly revert us, if you would require further assistance. 
 
Thanks, 
Dharani. 


Loader.
Live Chat Icon For mobile
Up arrow icon