Data Label in EJ 1 ASP.NET MVC SunburstChart

29 Jun 2020 / 2 minutes to read

Sunburst data labels are used to display the data related to the segment. It helps to provide the information about the data points to the users.
You can enable or disable the data labels by setting the visible property of the DataLabelSettings to true as shown in the below code

  • cshtml
  • @(Html.EJ().SunburstChart("chartContainer")
    
         //...Palette colors
        .DataLabelSettings(dt => dt.Visible(true))
          //...
     )

    Visual representation of Data Label using SunburstChart in ASP.NET MVC

    Label Overflow mode

    When you represent huge data with data labels, they may intersect each other. You can avoid this using the SunburstLabelOverflowMode property.

    The following properties are used to avoid the overlapping.

    • Trim – To trim the large data labels.
    • Hide – To hide the overlapped data labels.
      The following code shows how to set Hide and Trim mode.
  • cshtml
  • @(Html.EJ().SunburstChart("chartContainer")
    
         //.
        .DataLabelSettings(dt => dt.Visible(true).SunburstLabelOverflowMode(SunburstLabelOverflowMode.Hide))
          //...
     )

    Label Overflow mode - Trim using SunburstChart in ASP.NET MVC

  • cshtml
  • @(Html.EJ().SunburstChart("chartContainer")
    
         //.
        .DataLabelSettings(dt => dt.Visible(true).SunburstLabelOverflowMode(SunburstLabelOverflowMode.Trim))
          //...
     )

    Label Overflow mode - Hide using SunburstChart in ASP.NET MVC

    Label Rotation Mode

    You can rotate the data label by using SunburstLabelRotationMode property. By default, the labelRotationMode is set as angle.

    The following code shows how to set labelRotationMode as normal and angle.

  • cshtml
  • @(Html.EJ().SunburstChart("chartContainer")
    
         //.
        .DataLabelSettings(dt => dt.Visible(true).SunburstLabelRotationMode(SunburstLabelRotationMode.Normal)
          //...
     )

    Label Rotation Mode - Normal using SunburstChart in ASP.NET MVC

  • cshtml
  • @(Html.EJ().SunburstChart("chartContainer")
    
         //.
        .DataLabelSettings(dt => dt.Visible(true).SunburstLabelRotationMode(SunburstLabelRotationMode.Angle)
          //...
     )

    Label Rotation Mode - Angle using SunburstChart in ASP.NET MVC

    Customizing the data labels

    You can customize the appearance of the data point using the Font property.

  • cshtml
  • @(Html.EJ().SunburstChart("chartContainer")
    
         //.
        .DataLabelSettings(dt => dt.Visible(true).Font(font=>font.Color("Black").Font-Weight("Bold").Size("15px")))
          //...
     )

    Customizing the data labels using SunburstChart in ASP.NET MVC