Legend in ASP.NET MVC 3D Chart Component

11 Jan 202424 minutes to read

Legend provides information about the series rendered in the 3D chart.

Position and alignment

By using the Position property, the legend can be positioned at left, right, top or bottom of the 3D chart. The legend is positioned at the bottom of the 3D chart, by default.

@(Html.EJS().Chart3D("container").WallColor("transparent").EnableRotation(true).Rotation(7).Tilt(10).Depth(100)
   .Series(series =>
   {
      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("gold").
      Name("Gold").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("silver").
      Name("Silver").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("bronze").
      Name("Bronze").
      DataSource(ViewBag.dataSource).
      Add();
   })
   .PrimaryXAxis(px => 
      px.ValueType(Syncfusion.EJ2.Charts.ValueType.Category).Title("Countries")
   )
   .PrimaryYAxis(py => 
      py.Minimum(0).Maximum(80).Interval(20).Title("Medals")
   )
   .Title("Olympic Medals")
   .LegendSettings(lg => lg.Visible(true).Position(Syncfusion.EJ2.Charts.LegendPosition.Top))
   .Render())
public ActionResult Index()
{
    List<ChartData> chartData = new List<ChartData>
    {
        new ChartData { country= "USA",       gold= 50, silver= 70, bronze= 45 },
        new ChartData { country= "China",     gold= 40, silver= 60, bronze= 55 },
        new ChartData { country= "Japan",     gold= 70, silver= 60, bronze= 50 },
        new ChartData { country= "Australia", gold= 60, silver= 56, bronze= 40 },
        new ChartData { country= "France",    gold= 50, silver= 45, bronze= 35 },
        new ChartData { country= "Germany",   gold= 40, silver= 30, bronze= 22 },
        new ChartData { country= "Italy",     gold= 40, silver= 35, bronze= 37 },
        new ChartData { country= "Sweden",    gold= 30, silver= 25, bronze= 27 }
    };
    ViewBag.dataSource = chartData;
    return View();
}
public class ChartData
{
    public string country;
    public double gold;
    public double silver;
    public double bronze;
}

The custom position helps you to position the legend anywhere in the 3D chart using X and Y coordinates.

@(Html.EJS().Chart3D("container").WallColor("transparent").EnableRotation(true).Rotation(7).Tilt(10).Depth(100)
   .Series(series =>
   {
      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("gold").
      Name("Gold").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("silver").
      Name("Silver").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("bronze").
      Name("Bronze").
      DataSource(ViewBag.dataSource).
      Add();
   })
   .PrimaryXAxis(px => 
      px.ValueType(Syncfusion.EJ2.Charts.ValueType.Category).Title("Countries")
   )
   .PrimaryYAxis(py => 
      py.Minimum(0).Maximum(80).Interval(20).Title("Medals")
   )
   .Title("Olympic Medals")
   .LegendSettings(lg => lg.Visible(true)
      .Position(Syncfusion.EJ2.Charts.LegendPosition.Custom)
      .Location(lc => lc.X(200).Y(20)))
   .Render())
public ActionResult Index()
{
    List<ChartData> chartData = new List<ChartData>
    {
        new ChartData { country= "USA",       gold= 50, silver= 70, bronze= 45 },
        new ChartData { country= "China",     gold= 40, silver= 60, bronze= 55 },
        new ChartData { country= "Japan",     gold= 70, silver= 60, bronze= 50 },
        new ChartData { country= "Australia", gold= 60, silver= 56, bronze= 40 },
        new ChartData { country= "France",    gold= 50, silver= 45, bronze= 35 },
        new ChartData { country= "Germany",   gold= 40, silver= 30, bronze= 22 },
        new ChartData { country= "Italy",     gold= 40, silver= 35, bronze= 37 },
        new ChartData { country= "Sweden",    gold= 30, silver= 25, bronze= 27 }
    };
    ViewBag.dataSource = chartData;
    return View();
}
public class ChartData
{
    public string country;
    public double gold;
    public double silver;
    public double bronze;
}

Legend reverse

The order of the legend items can be reversed by using the Reverse property. By default, legend for the first series in the collection will be placed first.

@(Html.EJS().Chart3D("container").WallColor("transparent").EnableRotation(true).Rotation(7).Tilt(10).Depth(100)
   .Series(series =>
   {
      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("gold").
      Name("Gold").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("silver").
      Name("Silver").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("bronze").
      Name("Bronze").
      DataSource(ViewBag.dataSource).
      Add();
   })
   .PrimaryXAxis(px => 
      px.ValueType(Syncfusion.EJ2.Charts.ValueType.Category).Title("Countries")
   )
   .PrimaryYAxis(py => 
      py.Minimum(0).Maximum(80).Interval(20).Title("Medals")
   )
   .Title("Olympic Medals")
   .LegendSettings(lg => lg.Visible(true).Reverse(true))
   .Render())
public ActionResult Index()
{
    List<ChartData> chartData = new List<ChartData>
    {
        new ChartData { country= "USA",       gold= 50, silver= 70, bronze= 45 },
        new ChartData { country= "China",     gold= 40, silver= 60, bronze= 55 },
        new ChartData { country= "Japan",     gold= 70, silver= 60, bronze= 50 },
        new ChartData { country= "Australia", gold= 60, silver= 56, bronze= 40 },
        new ChartData { country= "France",    gold= 50, silver= 45, bronze= 35 },
        new ChartData { country= "Germany",   gold= 40, silver= 30, bronze= 22 },
        new ChartData { country= "Italy",     gold= 40, silver= 35, bronze= 37 },
        new ChartData { country= "Sweden",    gold= 30, silver= 25, bronze= 27 }
    };
    ViewBag.dataSource = chartData;
    return View();
}
public class ChartData
{
    public string country;
    public double gold;
    public double silver;
    public double bronze;
}

Legend alignment

The legend can be aligned at near, far or center to the 3D chart using the Alignment property.

@(Html.EJS().Chart3D("container").WallColor("transparent").EnableRotation(true).Rotation(7).Tilt(10).Depth(100)
   .Series(series =>
   {
      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("gold").
      Name("Gold").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("silver").
      Name("Silver").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("bronze").
      Name("Bronze").
      DataSource(ViewBag.dataSource).
      Add();
   })
   .PrimaryXAxis(px => 
      px.ValueType(Syncfusion.EJ2.Charts.ValueType.Category).Title("Countries")
   )
   .PrimaryYAxis(py => 
      py.Minimum(0).Maximum(80).Interval(20).Title("Medals")
   )
   .Title("Olympic Medals")
   .LegendSettings(lg => lg.Visible(true).Position(Syncfusion.EJ2.Charts.LegendPosition.Top)
      .Alignment(Syncfusion.EJ2.Charts.Alignment.Near))
   .Render())
public ActionResult Index()
{
    List<ChartData> chartData = new List<ChartData>
    {
        new ChartData { country= "USA",       gold= 50, silver= 70, bronze= 45 },
        new ChartData { country= "China",     gold= 40, silver= 60, bronze= 55 },
        new ChartData { country= "Japan",     gold= 70, silver= 60, bronze= 50 },
        new ChartData { country= "Australia", gold= 60, silver= 56, bronze= 40 },
        new ChartData { country= "France",    gold= 50, silver= 45, bronze= 35 },
        new ChartData { country= "Germany",   gold= 40, silver= 30, bronze= 22 },
        new ChartData { country= "Italy",     gold= 40, silver= 35, bronze= 37 },
        new ChartData { country= "Sweden",    gold= 30, silver= 25, bronze= 27 }
    };
    ViewBag.dataSource = chartData;
    return View();
}
public class ChartData
{
    public string country;
    public double gold;
    public double silver;
    public double bronze;
}

Legend customization

To change the legend icon shape, LegendShape property in the Series can be used. By default, the legend icon shape is SeriesType.

@(Html.EJS().Chart3D("container").WallColor("transparent").EnableRotation(true).Rotation(7).Tilt(10).Depth(100)
   .Series(series =>
   {
      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("gold").
      Name("Gold").
      LegendShape(Syncfusion.EJ2.Charts.LegendShape.Circle).
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("silver").
      Name("Silver").
      LegendShape(Syncfusion.EJ2.Charts.LegendShape.SeriesType).
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("bronze").
      Name("Bronze").
      LegendShape(Syncfusion.EJ2.Charts.LegendShape.Rectangle).
      DataSource(ViewBag.dataSource).
      Add();
   })
   .PrimaryXAxis(px => 
      px.ValueType(Syncfusion.EJ2.Charts.ValueType.Category).Title("Countries")
   )
   .PrimaryYAxis(py => 
      py.Minimum(0).Maximum(80).Interval(20).Title("Medals")
   )
   .Title("Olympic Medals")
   .LegendSettings(lg => lg.Visible(true))
   .Render())
public ActionResult Index()
{
    List<ChartData> chartData = new List<ChartData>
    {
        new ChartData { country= "USA",       gold= 50, silver= 70, bronze= 45 },
        new ChartData { country= "China",     gold= 40, silver= 60, bronze= 55 },
        new ChartData { country= "Japan",     gold= 70, silver= 60, bronze= 50 },
        new ChartData { country= "Australia", gold= 60, silver= 56, bronze= 40 },
        new ChartData { country= "France",    gold= 50, silver= 45, bronze= 35 },
        new ChartData { country= "Germany",   gold= 40, silver= 30, bronze= 22 },
        new ChartData { country= "Italy",     gold= 40, silver= 35, bronze= 37 },
        new ChartData { country= "Sweden",    gold= 30, silver= 25, bronze= 27 }
    };
    ViewBag.dataSource = chartData;
    return View();
}
public class ChartData
{
    public string country;
    public double gold;
    public double silver;
    public double bronze;
}

Legend size

By default, legend takes 20% - 25% of the 3D chart’s height horizontally, when it is placed on top or bottom position and 20% - 25% of the 3D chart’s width vertically, when it is placed on left or right position. You can change this default legend size by using the Height and Width properties of the LegendSettings.

@(Html.EJS().Chart3D("container").WallColor("transparent").EnableRotation(true).Rotation(7).Tilt(10).Depth(100)
   .Series(series =>
   {
      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("gold").
      Name("Gold").
      LegendShape(Syncfusion.EJ2.Charts.LegendShape.Circle).
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("silver").
      Name("Silver").
      LegendShape(Syncfusion.EJ2.Charts.LegendShape.Circle).
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("bronze").
      Name("Bronze").
      LegendShape(Syncfusion.EJ2.Charts.LegendShape.Circle).
      DataSource(ViewBag.dataSource).
      Add();
   })
   .PrimaryXAxis(px => 
      px.ValueType(Syncfusion.EJ2.Charts.ValueType.Category).Title("Countries")
   )
   .PrimaryYAxis(py => 
      py.Minimum(0).Maximum(80).Interval(20).Title("Medals")
   )
   .Title("Olympic Medals")
   .LegendSettings(lg => lg.Visible(true).Width("500").Height("100").Border(br => br.Width(1).Color("pink")))
   .Render())
public ActionResult Index()
{
    List<ChartData> chartData = new List<ChartData>
    {
        new ChartData { country= "USA",       gold= 50, silver= 70, bronze= 45 },
        new ChartData { country= "China",     gold= 40, silver= 60, bronze= 55 },
        new ChartData { country= "Japan",     gold= 70, silver= 60, bronze= 50 },
        new ChartData { country= "Australia", gold= 60, silver= 56, bronze= 40 },
        new ChartData { country= "France",    gold= 50, silver= 45, bronze= 35 },
        new ChartData { country= "Germany",   gold= 40, silver= 30, bronze= 22 },
        new ChartData { country= "Italy",     gold= 40, silver= 35, bronze= 37 },
        new ChartData { country= "Sweden",    gold= 30, silver= 25, bronze= 27 }
    };
    ViewBag.dataSource = chartData;
    return View();
}
public class ChartData
{
    public string country;
    public double gold;
    public double silver;
    public double bronze;
}

Legend item size

The size of the legend items can be customised by using the ShapeHeight and ShapeWidth properties.

@(Html.EJS().Chart3D("container").WallColor("transparent").EnableRotation(true).Rotation(7).Tilt(10).Depth(100)
   .Series(series =>
   {
      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("gold").
      Name("Gold").
      LegendShape(Syncfusion.EJ2.Charts.LegendShape.Circle).
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("silver").
      Name("Silver").
      LegendShape(Syncfusion.EJ2.Charts.LegendShape.Circle).
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("bronze").
      Name("Bronze").
      LegendShape(Syncfusion.EJ2.Charts.LegendShape.Circle).
      DataSource(ViewBag.dataSource).
      Add();
   })
   .PrimaryXAxis(px => 
      px.ValueType(Syncfusion.EJ2.Charts.ValueType.Category).Title("Countries")
   )
   .PrimaryYAxis(py => 
      py.Minimum(0).Maximum(80).Interval(20).Title("Medals")
   )
   .Title("Olympic Medals")
   .LegendSettings(lg => lg.Visible(true).ShapeHeight(10).ShapeWidth(10))
   .Render())
public ActionResult Index()
{
    List<ChartData> chartData = new List<ChartData>
    {
        new ChartData { country= "USA",       gold= 50, silver= 70, bronze= 45 },
        new ChartData { country= "China",     gold= 40, silver= 60, bronze= 55 },
        new ChartData { country= "Japan",     gold= 70, silver= 60, bronze= 50 },
        new ChartData { country= "Australia", gold= 60, silver= 56, bronze= 40 },
        new ChartData { country= "France",    gold= 50, silver= 45, bronze= 35 },
        new ChartData { country= "Germany",   gold= 40, silver= 30, bronze= 22 },
        new ChartData { country= "Italy",     gold= 40, silver= 35, bronze= 37 },
        new ChartData { country= "Sweden",    gold= 30, silver= 25, bronze= 27 }
    };
    ViewBag.dataSource = chartData;
    return View();
}
public class ChartData
{
    public string country;
    public double gold;
    public double silver;
    public double bronze;
}

Paging for legend

Paging will be enabled by default, when the legend items exceeds the legend bounds. Each legend items can be viewed by navigating between the pages using navigation buttons.

@(Html.EJS().Chart3D("container").WallColor("transparent").EnableRotation(true).Rotation(7).Tilt(10).Depth(100)
   .Series(series =>
   {
      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("x").
      YName("y").
      Name("December 2007").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("x").
      YName("y1").
      Name("December 2008").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("x").
      YName("y2").
      Name("December 2009").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("x").
      YName("y3").
      Name("December 2010").
      DataSource(ViewBag.dataSource).
      Add();
   })
   .PrimaryXAxis(px => 
      px.ValueType(Syncfusion.EJ2.Charts.ValueType.Category).Title("Countries").Interval(1)
      .LabelIntersectAction(Syncfusion.EJ2.Charts.LabelIntersectAction.Rotate45)
   )
   .PrimaryYAxis(py => 
      py.Minimum(0).Maximum(90).LabelFormat("{value}%").Title("Penetration (%)")
   )
   .Title("FB Penetration of Internet Audience")
   .LegendSettings(lg => lg.Visible(true).Padding(10).ShapePadding(10).Width("200").Border(br => br.Width(2).Color("grey")))
   .Render())
public ActionResult Index()
{
    List<ChartData> chartData = new List<ChartData>
    {
        new ChartData { x= "WW",     y= 12,   y1= 22,   y2= 38.3, y3= 50   },
        new ChartData { x= "EU",     y= 9.9,  y1= 26,   y2= 45.2, y3= 63.6 },
        new ChartData { x= "APAC",   y= 4.4,  y1= 9.3,  y2= 18.2, y3= 20.9 },
        new ChartData { x= "LATAM",  y= 6.4,  y1= 28,   y2= 46.7, y3= 65.1 },
        new ChartData { x= "MEA",    y= 30,   y1= 45.7, y2= 61.5, y3= 73   },
        new ChartData { x= "NA",     y= 25.3, y1= 35.9, y2= 64,   y3= 81.4 }
    };
    ViewBag.dataSource = chartData;
    return View();
}
public class ChartData
{
    public string x;
    public double y;
    public double y1;
    public double y2;
    public double y3;
}

Legend text wrap

When the legend text exceeds the container, the text can be wrapped by using the TextWrap property. End user can also wrap the legend text based on the MaximumLabelWidth property.

@(Html.EJS().Chart3D("container").WallColor("transparent").EnableRotation(true).Rotation(7).Tilt(10).Depth(100)
   .Series(series =>
   {
      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("gold").
      Name("Gold").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("silver").
      Name("Silver").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("bronze").
      Name("Bronze").
      DataSource(ViewBag.dataSource).
      Add();
   })
   .PrimaryXAxis(px => 
      px.ValueType(Syncfusion.EJ2.Charts.ValueType.Category).Title("Countries")
   )
   .PrimaryYAxis(py => 
      py.Minimum(0).Maximum(80).Interval(20).Title("Medals")
   )
   .Title("Olympic Medals")
   .LegendSettings(lg => lg.Visible(true).Position(Syncfusion.EJ2.Charts.LegendPosition.Right).TextWrap(Syncfusion.EJ2.Charts.TextWrap.Wrap).MaximumLabelWidth(50))
   .Render())
public ActionResult Index()
{
    List<ChartData> chartData = new List<ChartData>
    {
        new ChartData { country= "USA",       gold= 50, silver= 70, bronze= 45 },
        new ChartData { country= "China",     gold= 40, silver= 60, bronze= 55 },
        new ChartData { country= "Japan",     gold= 70, silver= 60, bronze= 50 },
        new ChartData { country= "Australia", gold= 60, silver= 56, bronze= 40 },
        new ChartData { country= "France",    gold= 50, silver= 45, bronze= 35 },
        new ChartData { country= "Germany",   gold= 40, silver= 30, bronze= 22 },
        new ChartData { country= "Italy",     gold= 40, silver= 35, bronze= 37 },
        new ChartData { country= "Sweden",    gold= 30, silver= 25, bronze= 27 }
    };
    ViewBag.dataSource = chartData;
    return View();
}
public class ChartData
{
    public string country;
    public double gold;
    public double silver;
    public double bronze;
}

Series selection through legend

By default, you can collapse the series visibility by clicking the legend. On the other hand, turn off the ToggleVisibility property if you must use a legend click to choose a series.

@(Html.EJS().Chart3D("container").WallColor("transparent").EnableRotation(true).Rotation(7).Tilt(10).Depth(100)
   .Series(series =>
   {
      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("gold").
      Name("Gold").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("silver").
      Name("Silver").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("bronze").
      Name("Bronze").
      DataSource(ViewBag.dataSource).
      Add();
   })
   .PrimaryXAxis(px => 
      px.ValueType(Syncfusion.EJ2.Charts.ValueType.Category).Title("Countries")
   )
   .PrimaryYAxis(py => 
      py.Minimum(0).Maximum(80).Interval(20).Title("Medals")
   )
   .Title("Olympic Medals")
   .LegendSettings(lg => lg.Visible(true).ToggleVisibility(false))
   .Render())
public ActionResult Index()
{
    List<ChartData> chartData = new List<ChartData>
    {
        new ChartData { country= "USA",       gold= 50, silver= 70, bronze= 45 },
        new ChartData { country= "China",     gold= 40, silver= 60, bronze= 55 },
        new ChartData { country= "Japan",     gold= 70, silver= 60, bronze= 50 },
        new ChartData { country= "Australia", gold= 60, silver= 56, bronze= 40 },
        new ChartData { country= "France",    gold= 50, silver= 45, bronze= 35 },
        new ChartData { country= "Germany",   gold= 40, silver= 30, bronze= 22 },
        new ChartData { country= "Italy",     gold= 40, silver= 35, bronze= 37 },
        new ChartData { country= "Sweden",    gold= 30, silver= 25, bronze= 27 }
    };
    ViewBag.dataSource = chartData;
    return View();
}
public class ChartData
{
    public string country;
    public double gold;
    public double silver;
    public double bronze;
}

Collapsing legend item

By default, series name will be displayed as legend. To skip the legend for a particular series, you can give empty string to the series name.

@(Html.EJS().Chart3D("container").WallColor("transparent").EnableRotation(true).Rotation(7).Tilt(10).Depth(100)
   .Series(series =>
   {
      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("gold").
      Name("Gold").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("silver").
      Name("Silver").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("bronze").
      Name("Bronze").
      DataSource(ViewBag.dataSource).
      Add();
   })
   .PrimaryXAxis(px => 
      px.ValueType(Syncfusion.EJ2.Charts.ValueType.Category).Title("Countries")
   )
   .PrimaryYAxis(py => 
      py.Minimum(0).Maximum(80).Interval(20).Title("Medals")
   )
   .Title("Olympic Medals")
   .LegendSettings(lg => lg.Visible(true).ToggleVisibility(true))
   .Render())
public ActionResult Index()
{
    List<ChartData> chartData = new List<ChartData>
    {
        new ChartData { country= "USA",       gold= 50, silver= 70, bronze= 45 },
        new ChartData { country= "China",     gold= 40, silver= 60, bronze= 55 },
        new ChartData { country= "Japan",     gold= 70, silver= 60, bronze= 50 },
        new ChartData { country= "Australia", gold= 60, silver= 56, bronze= 40 },
        new ChartData { country= "France",    gold= 50, silver= 45, bronze= 35 },
        new ChartData { country= "Germany",   gold= 40, silver= 30, bronze= 22 },
        new ChartData { country= "Italy",     gold= 40, silver= 35, bronze= 37 },
        new ChartData { country= "Sweden",    gold= 30, silver= 25, bronze= 27 }
    };
    ViewBag.dataSource = chartData;
    return View();
}
public class ChartData
{
    public string country;
    public double gold;
    public double silver;
    public double bronze;
}

Legend title

You can set title for legend using Title property in LegendSettings. The Size, Color, Opacity, FontStyle, FontWeight, FontFamily, TextAlignment, and TextOverflow of legend title can be customized by using the TitleStyle property in LegendSettings. The TitlePosition is used to set the legend position in Top, Left and Right position. The MaximumTitleWidth is used to set the width of the legend title. By default, it will be 100px.

@(Html.EJS().Chart3D("container").WallColor("transparent").EnableRotation(true).Rotation(7).Tilt(10).Depth(100)
   .Series(series =>
   {
      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("gold").
      Name("Gold").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("silver").
      Name("Silver").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("country").
      YName("bronze").
      Name("Bronze").
      DataSource(ViewBag.dataSource).
      Add();
   })
   .PrimaryXAxis(px => 
      px.ValueType(Syncfusion.EJ2.Charts.ValueType.Category)
   )
   .PrimaryYAxis(py => 
      py.Minimum(0).Maximum(80).Interval(20).Title("Medals")
   )
   .Title("Olympic Medals")
   .LegendSettings(lg => lg.Visible(true).Title("Countries"))
   .Render())
public ActionResult Index()
{
    List<ChartData> chartData = new List<ChartData>
    {
        new ChartData { country= "USA",       gold= 50, silver= 70, bronze= 45 },
        new ChartData { country= "China",     gold= 40, silver= 60, bronze= 55 },
        new ChartData { country= "Japan",     gold= 70, silver= 60, bronze= 50 },
        new ChartData { country= "Australia", gold= 60, silver= 56, bronze= 40 },
        new ChartData { country= "France",    gold= 50, silver= 45, bronze= 35 },
        new ChartData { country= "Germany",   gold= 40, silver= 30, bronze= 22 },
        new ChartData { country= "Italy",     gold= 40, silver= 35, bronze= 37 },
        new ChartData { country= "Sweden",    gold= 30, silver= 25, bronze= 27 }
    };
    ViewBag.dataSource = chartData;
    return View();
}
public class ChartData
{
    public string country;
    public double gold;
    public double silver;
    public double bronze;
}

Arrow page navigation

The page number will always be visible while using legend paging. It is now possible to disable the page number and enable page navigation with the left and right arrows. The EnablePages property needs to be set to false in order to render the arrow page navigation.

@(Html.EJS().Chart3D("container").WallColor("transparent").EnableRotation(true).Rotation(7).Tilt(10).Depth(100)
   .Series(series =>
   {
      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("x").
      YName("y").
      Name("December 2007").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("x").
      YName("y1").
      Name("December 2008").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("x").
      YName("y2").
      Name("December 2009").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("x").
      YName("y3").
      Name("December 2010").
      DataSource(ViewBag.dataSource).
      Add();
   })
   .PrimaryXAxis(px => 
      px.ValueType(Syncfusion.EJ2.Charts.ValueType.Category).Title("Countries").Interval(1)
      .LabelIntersectAction(Syncfusion.EJ2.Charts.LabelIntersectAction.Rotate45)
   )
   .PrimaryYAxis(py => 
      py.Minimum(0).Maximum(90).LabelFormat("{value}%").Title("Penetration (%)")
   )
   .Title("FB Penetration of Internet Audience")
   .LegendSettings(lg => lg.Width("180").EnablePages(false))
   .Render())
public ActionResult Index()
{
    List<ChartData> chartData = new List<ChartData>
    {
        new ChartData { x= "WW",     y= 12,   y1= 22,   y2= 38.3, y3= 50   },
        new ChartData { x= "EU",     y= 9.9,  y1= 26,   y2= 45.2, y3= 63.6 },
        new ChartData { x= "APAC",   y= 4.4,  y1= 9.3,  y2= 18.2, y3= 20.9 },
        new ChartData { x= "LATAM",  y= 6.4,  y1= 28,   y2= 46.7, y3= 65.1 },
        new ChartData { x= "MEA",    y= 30,   y1= 45.7, y2= 61.5, y3= 73   },
        new ChartData { x= "NA",     y= 25.3, y1= 35.9, y2= 64,   y3= 81.4 }
    };
    ViewBag.dataSource = chartData;
    return View();
}
public class ChartData
{
    public string x;
    public double y;
    public double y1;
    public double y2;
    public double y3;
}

Legend item padding

The ItemPadding property can be used to adjust the space between the legend items.

@(Html.EJS().Chart3D("container").WallColor("transparent").EnableRotation(true).Rotation(7).Tilt(10).Depth(100)
   .Series(series =>
   {
      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("x").
      YName("y").
      Name("December 2007").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("x").
      YName("y1").
      Name("December 2008").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("x").
      YName("y2").
      Name("December 2009").
      DataSource(ViewBag.dataSource).
      Add();

      series.Type(Syncfusion.EJ2.Charts.Chart3DSeriesType.Column).  
      XName("x").
      YName("y3").
      Name("December 2010").
      DataSource(ViewBag.dataSource).
      Add();
   })
   .PrimaryXAxis(px => 
      px.ValueType(Syncfusion.EJ2.Charts.ValueType.Category).Title("Countries").Interval(1)
      .LabelIntersectAction(Syncfusion.EJ2.Charts.LabelIntersectAction.Rotate45)
   )
   .PrimaryYAxis(py => 
      py.Minimum(0).Maximum(90).LabelFormat("{value}%").Title("Penetration (%)")
   )
   .Title("FB Penetration of Internet Audience")
   .LegendSettings(lg => lg.ItemPadding(30).EnablePages(false))
   .Render())
public ActionResult Index()
{
    List<ChartData> chartData = new List<ChartData>
    {
        new ChartData { x= "WW",     y= 12,   y1= 22,   y2= 38.3, y3= 50   },
        new ChartData { x= "EU",     y= 9.9,  y1= 26,   y2= 45.2, y3= 63.6 },
        new ChartData { x= "APAC",   y= 4.4,  y1= 9.3,  y2= 18.2, y3= 20.9 },
        new ChartData { x= "LATAM",  y= 6.4,  y1= 28,   y2= 46.7, y3= 65.1 },
        new ChartData { x= "MEA",    y= 30,   y1= 45.7, y2= 61.5, y3= 73   },
        new ChartData { x= "NA",     y= 25.3, y1= 35.9, y2= 64,   y3= 81.4 }
    };
    ViewBag.dataSource = chartData;
    return View();
}
public class ChartData
{
    public string x;
    public double y;
    public double y1;
    public double y2;
    public double y3;
}