- Position and alignment
- Legend reverse
- Legend shape
- Legend size
- Legend item size
- Legend paging
- Legend text wrap
- Legend title
- Arrow page navigation
- Legend item padding
Contact Support
Legend in ASP.NET CORE 3D Circular Chart Component
18 Mar 202422 minutes to read
The legend provides information about the data points rendered in the 3D Circular Chart. It can be added by enabling the Visible
option in the LegendSettings
property.
<ejs-circularchart3d id="container" tilt="-45">
<e-circularchart3d-legendsettings visible="true">
</e-circularchart3d-legendsettings>
<e-circularchart3d-series-collection>
<e-circularchart3d-series dataSource="ViewBag.dataSource" xName="X" yName="Y">
</e-circularchart3d-series>
</e-circularchart3d-series-collection>
</ejs-circularchart3d>
public IActionResult Index()
{
List<CircularChartData> circularData = new List<CircularChartData>
{
new CircularChartData { X = "Jan", Y = 13 },
new CircularChartData { X = "Feb", Y = 13 },
new CircularChartData { X = "Mar", Y = 17 },
new CircularChartData { X = "Apr", Y = 13.5 }
};
ViewBag.dataSource = circularData;
return View();
}
public class CircularChartData
{
public string X;
public double Y;
}
Position and alignment
By using the Position
property, the legend can be positioned at the Left
, Right
, Top
or Bottom
of the 3D Circular Chart. By default, the legend will be positioned to the right of the 3D Circular Chart. Additionally, you can align the legend to the Center
, Far
or Near
of the chart using the Alignment
property.
<ejs-circularchart3d id="container" tilt="-45">
<e-circularchart3d-legendsettings position="@Syncfusion.EJ2.Charts.LegendPosition.Top" alignment="@Syncfusion.EJ2.Charts.Alignment.Near">
</e-circularchart3d-legendsettings>
<e-circularchart3d-series-collection>
<e-circularchart3d-series dataSource="ViewBag.dataSource" xName="X" yName="Y">
</e-circularchart3d-series>
</e-circularchart3d-series-collection>
</ejs-circularchart3d>
public IActionResult Index()
{
List<CircularChartData> circularData = new List<CircularChartData>
{
new CircularChartData { X = "Jan", Y = 13 },
new CircularChartData { X = "Feb", Y = 13 },
new CircularChartData { X = "Mar", Y = 17 },
new CircularChartData { X = "Apr", Y = 13.5 }
};
ViewBag.dataSource = circularData;
return View();
}
public class CircularChartData
{
public string X;
public double Y;
}
Legend reverse
You can reverse the order of the legend items by using the Reverse
property in LegendSettings
. By default, the legend for the first series in the collection will be placed first.
<ejs-circularchart3d id="container" tilt="-45">
<e-circularchart3d-legendsettings visible="true" reverse="true">
</e-circularchart3d-legendsettings>
<e-circularchart3d-series-collection>
<e-circularchart3d-series dataSource="ViewBag.dataSource" xName="X" yName="Y" legendShape="@Syncfusion.EJ2.Charts.LegendShape.Rectangle">
</e-circularchart3d-series>
</e-circularchart3d-series-collection>
</ejs-circularchart3d>
public IActionResult Index()
{
List<CircularChartData> circularData = new List<CircularChartData>
{
new CircularChartData { X = "Jan", Y = 13 },
new CircularChartData { X = "Feb", Y = 13 },
new CircularChartData { X = "Mar", Y = 17 },
new CircularChartData { X = "Apr", Y = 13.5 }
};
ViewBag.dataSource = circularData;
return View();
}
public class CircularChartData
{
public string X;
public double Y;
}
Legend shape
To change the legend shape, use the LegendShape
property in the Series
. By default, the legend shape is set to SeriesType
.
<ejs-circularchart3d id="container" tilt="-45">
<e-circularchart3d-legendsettings visible="true">
</e-circularchart3d-legendsettings>
<e-circularchart3d-series-collection>
<e-circularchart3d-series dataSource="ViewBag.dataSource" xName="X" yName="Y" legendShape="@Syncfusion.EJ2.Charts.LegendShape.Rectangle">
</e-circularchart3d-series>
</e-circularchart3d-series-collection>
</ejs-circularchart3d>
public IActionResult Index()
{
List<CircularChartData> circularData = new List<CircularChartData>
{
new CircularChartData { X = "Jan", Y = 13 },
new CircularChartData { X = "Feb", Y = 13 },
new CircularChartData { X = "Mar", Y = 17 },
new CircularChartData { X = "Apr", Y = 13.5 }
};
ViewBag.dataSource = circularData;
return View();
}
public class CircularChartData
{
public string X;
public double Y;
}
Legend size
The legend size can be changed by using the Width
and Height
properties in LegendSettings
.
<ejs-circularchart3d id="container" tilt="-45">
<e-circularchart3d-legendsettings width="150" height="100">
<e-circularchart3dlegendsettings-border width="1" color="pink">
</e-circularchart3dlegendsettings-border>
</e-circularchart3d-legendsettings>
<e-circularchart3d-series-collection>
<e-circularchart3d-series dataSource="ViewBag.dataSource" xName="X" yName="Y">
</e-circularchart3d-series>
</e-circularchart3d-series-collection>
</ejs-circularchart3d>
public IActionResult Index()
{
List<CircularChartData> circularData = new List<CircularChartData>
{
new CircularChartData { X = "Jan", Y = 13 },
new CircularChartData { X = "Feb", Y = 13 },
new CircularChartData { X = "Mar", Y = 17 },
new CircularChartData { X = "Apr", Y = 13.5 }
};
ViewBag.dataSource = circularData;
return View();
}
public class CircularChartData
{
public string X;
public double Y;
}
Legend item size
The size of the legend items can be customized by using the ShapeHeight
and ShapeWidth
properties in LegendSettings
.
<ejs-circularchart3d id="container" tilt="-45">
<e-circularchart3d-legendsettings shapeHeight="15" shapeWidth="15">
</e-circularchart3d-legendsettings>
<e-circularchart3d-series-collection>
<e-circularchart3d-series dataSource="ViewBag.dataSource" xName="X" yName="Y">
</e-circularchart3d-series>
</e-circularchart3d-series-collection>
</ejs-circularchart3d>
public IActionResult Index()
{
List<CircularChartData> circularData = new List<CircularChartData>
{
new CircularChartData { X = "Jan", Y = 13 },
new CircularChartData { X = "Feb", Y = 13 },
new CircularChartData { X = "Mar", Y = 17 },
new CircularChartData { X = "Apr", Y = 13.5 }
};
ViewBag.dataSource = circularData;
return View();
}
public class CircularChartData
{
public string X;
public double Y;
}
Legend paging
Paging will be enabled by default when the legend items exceed the legend bounds. Each legend item can be viewed by navigating between the pages using navigation buttons.
<ejs-circularchart3d id="container" tilt="-45">
<e-circularchart3d-legendsettings width="80" height="150">
</e-circularchart3d-legendsettings>
<e-circularchart3d-series-collection>
<e-circularchart3d-series dataSource="ViewBag.dataSource" xName="X" yName="Y">
</e-circularchart3d-series>
</e-circularchart3d-series-collection>
</ejs-circularchart3d>
public IActionResult Index()
{
List<CircularChartData> circularData = new List<CircularChartData>
{
new CircularChartData { X = "Jan", Y = 3 },
new CircularChartData { X = "Feb", Y = 3.5 },
new CircularChartData { X = "Mar", Y = 7 },
new CircularChartData { X = "Apr", Y = 13.5 },
new CircularChartData { X = "May", Y = 19 },
new CircularChartData { X = "Jun", Y = 23.5 },
new CircularChartData { X = "Jul", Y = 26 },
new CircularChartData { X = "Aug", Y = 25 },
new CircularChartData { X = "Sep", Y = 21 },
new CircularChartData { X = "Oct", Y = 15 },
new CircularChartData { X = "Nov", Y = 15 },
new CircularChartData { X = "Dec", Y = 15 }
};
ViewBag.dataSource = circularData;
return View();
}
public class CircularChartData
{
public string X;
public double Y;
}
Legend text wrap
When the legend text exceeds the container, the text can be wrapped using the TextWrap
property in LegendSettings
. End users can also wrap the legend text based on the MaximumLabelWidth
property in LegendSettings
.
<ejs-circularchart3d id="container" tilt="-45">
<e-circularchart3d-legendsettings visible="true" position="@Syncfusion.EJ2.Charts.LegendPosition.Right" textWrap="@Syncfusion.EJ2.Charts.TextWrap.Wrap" maximumLabelWidth="60">
</e-circularchart3d-legendsettings>
<e-circularchart3d-series-collection>
<e-circularchart3d-series dataSource="ViewBag.dataSource" xName="X" yName="Y" innerRadius="40%">
</e-circularchart3d-series>
</e-circularchart3d-series-collection>
</ejs-circularchart3d>
public IActionResult Index()
{
List<CircularChartData> circularData = new List<CircularChartData>
{
new CircularChartData { X = "Net-tution", Y = 21 },
new CircularChartData { X = "Private Gifts", Y = 8 },
new CircularChartData { X = "All Other", Y = 9 },
new CircularChartData { X = "Local Revenue", Y = 4 },
new CircularChartData { X = "State Revenue", Y = 21 },
new CircularChartData { X = "Federal Revenue", Y = 16 },
new CircularChartData { X = "Self-supporting Operations", Y = 21 }
};
ViewBag.dataSource = circularData;
return View();
}
public class CircularChartData
{
public string X;
public double Y;
}
Legend title
You can set a title for the legend using the Title
property in LegendSettings
. The Size
, Color
, Opacity
, FontStyle
, FontWeight
, FontFamily
, TextAlignment
, and TextOverflow
of the legend title can be customized using the TitleStyle
property in LegendSettings
.
<ejs-circularchart3d id="container" tilt="-45">
<e-circularchart3d-legendsettings visible="true" title="Months" position="@Syncfusion.EJ2.Charts.LegendPosition.Bottom">
</e-circularchart3d-legendsettings>
<e-circularchart3d-series-collection>
<e-circularchart3d-series dataSource="ViewBag.dataSource" xName="X" yName="Y">
</e-circularchart3d-series>
</e-circularchart3d-series-collection>
</ejs-circularchart3d>
public IActionResult Index()
{
List<CircularChartData> circularData = new List<CircularChartData>
{
new CircularChartData { X = "Jan", Y = 13 },
new CircularChartData { X = "Feb", Y = 13 },
new CircularChartData { X = "Mar", Y = 17 },
new CircularChartData { X = "Apr", Y = 13.5 }
};
ViewBag.dataSource = circularData;
return View();
}
public class CircularChartData
{
public string X;
public double Y;
}
Arrow page navigation
The page number will always be visible when using legend paging. However, it is now possible to disable the page number and enable page navigation with the left and right arrows. To render the arrow page navigation, set the EnablePages
property to false.
<ejs-circularchart3d id="container" tilt="-45">
<e-circularchart3d-legendsettings width="260px" height="50px" enablePages="false" position="@Syncfusion.EJ2.Charts.LegendPosition.Bottom">
</e-circularchart3d-legendsettings>
<e-circularchart3d-series-collection>
<e-circularchart3d-series dataSource="ViewBag.dataSource" xName="X" yName="Y">
</e-circularchart3d-series>
</e-circularchart3d-series-collection>
</ejs-circularchart3d>
public IActionResult Index()
{
List<CircularChartData> circularData = new List<CircularChartData>
{
new CircularChartData { X = "Jan", Y = 3 },
new CircularChartData { X = "Feb", Y = 3.5 },
new CircularChartData { X = "Mar", Y = 7 },
new CircularChartData { X = "Apr", Y = 13.5 },
new CircularChartData { X = "May", Y = 19 },
new CircularChartData { X = "Jun", Y = 23.5 },
new CircularChartData { X = "Jul", Y = 26 },
new CircularChartData { X = "Aug", Y = 25 },
new CircularChartData { X = "Sep", Y = 21 },
new CircularChartData { X = "Oct", Y = 15 },
new CircularChartData { X = "Nov", Y = 15 },
new CircularChartData { X = "Dec", Y = 15 }
};
ViewBag.dataSource = circularData;
return View();
}
public class CircularChartData
{
public string X;
public double Y;
}
Legend item padding
The ItemPadding
property can be used to adjust the space between the legend items.
<ejs-circularchart3d id="container" tilt="-45">
<e-circularchart3d-legendsettings width="260px" height="50px" position="@Syncfusion.EJ2.Charts.LegendPosition.Bottom" itemPadding="30">
</e-circularchart3d-legendsettings>
<e-circularchart3d-series-collection>
<e-circularchart3d-series dataSource="ViewBag.dataSource" xName="X" yName="Y">
</e-circularchart3d-series>
</e-circularchart3d-series-collection>
</ejs-circularchart3d>
public IActionResult Index()
{
List<CircularChartData> circularData = new List<CircularChartData>
{
new CircularChartData { X = "Jan", Y = 3 },
new CircularChartData { X = "Feb", Y = 3.5 },
new CircularChartData { X = "Mar", Y = 7 },
new CircularChartData { X = "Apr", Y = 13.5 },
new CircularChartData { X = "May", Y = 19 },
new CircularChartData { X = "Jun", Y = 23.5 },
new CircularChartData { X = "Jul", Y = 26 },
new CircularChartData { X = "Aug", Y = 25 },
new CircularChartData { X = "Sep", Y = 21 },
new CircularChartData { X = "Oct", Y = 15 },
new CircularChartData { X = "Nov", Y = 15 },
new CircularChartData { X = "Dec", Y = 15 }
};
ViewBag.dataSource = circularData;
return View();
}
public class CircularChartData
{
public string X;
public double Y;
}