Sunburst
Sunburst
Legend and Titles
Features
Sample
Settings
Description
The Legend properties can be used to customize the appearance of the chart's legend. The Header and Footer properties can be used to add titles to the Sunburst chart control.
This example allows you to change the Legend.Position, Header, and Footer properties of Sunburst in real-time.
Source
LegendAndTitlesController.cs
using System; using System.Collections.Generic; using System.Linq; using System.Web.Mvc; using C1.Web.Mvc.Chart; using MvcExplorer.Models; namespace MvcExplorer.Controllers { public partial class SunburstController : Controller { public ActionResult LegendAndTitles() { ViewBag.DemoSettingsModel = new ClientSettingsModel { Settings = new Dictionary<string, object[]> { {"Legend.Position", Enum.GetValues(typeof(Position)).Cast<object>().ToArray()}, {"Header", new object[] {"Header", "ヘッダー"}}, {"Footer", new object[] {"Footer", "フッター"}} }, DefaultValues = new Dictionary<string, object> { {"Legend.Position", Position.Right} } }; return View(_data); } } }
LegendAndTitles.cshtml
@using C1.Web.Mvc.Chart @model IEnumerable<HierarchicalData> @{ ViewBag.DemoSettings = true; ClientSettingsModel demoSettingsModel = ViewBag.DemoSettingsModel; } @(Html.C1().Sunburst<HierarchicalData>() .Id(demoSettingsModel.ControlId) .Bind("Year", "Value", Model) .Header("Header") .Footer("Footer") .DataLabel(dl => dl.Content("{name}").Position(PieLabelPosition.Center)) .BindingName("Year, Quarter, Month")) @section Description{ <p>@Html.Raw(Resources.Sunburst.LegendAndTitles_Text0)</p> <p>@Html.Raw(Resources.Sunburst.LegendAndTitles_Text1)</p> }
Documentation