Sunburst
凡例とタイトル
機能
サンプル
設定
説明
Legend プロパティを使用すると、チャートの凡例の外観をカスタマイズできます。 Header プロパティと Footer プロパティを使用して、Sunburst チャートコントロールにタイトルを追加できます。
この例では、Sunburst の Legend.Position、Header、 Footer の各プロパティをリアルタイムで変更できます。
ソース
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> }
マニュアル