FlexChart
FlexChart
ラベル
機能
サンプル
設定
説明
ラベル
このビューは、FlexChart の DataLabel プロパティを使用して、各データポイントにラベルを追加する方法を示します。
ソース
LabelsController.cs
using System; using MvcExplorer.Models; using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; using C1.Web.Mvc.Chart; namespace MvcExplorer.Controllers { public partial class FlexChartController : Controller { public ActionResult Labels() { var model = new ClientSettingsModel { Settings = CreateLabelSettings() }; return View(model); } private static IDictionary<string, object[]> CreateLabelSettings() { var settings = new Dictionary<string, object[]> { {"ChartType", new object[]{"Column", "Bar", "Scatter", "Line", "LineSymbols", "Area", "Spline", "SplineSymbols", "SplineArea"}}, {"DataLabel.Position", new object[]{LabelPosition.Top.ToString(), LabelPosition.Right.ToString(), LabelPosition.Bottom.ToString(), LabelPosition.Left.ToString(), LabelPosition.Center.ToString(), LabelPosition.None.ToString()}}, {"DataLabel.Border", new object[]{false, true}}, }; return settings; } } }
Labels.cshtml
@{ ViewBag.DemoSettings = true; ViewBag.DemoSettingsModel = Model; var fruits = Fruit.GetFruitsSales(); } <c1-flex-chart id="@Model.ControlId" binding-x="Name"> <c1-items-source source-collection="fruits"></c1-items-source> <c1-flex-chart-series binding="MarPrice" name="March"></c1-flex-chart-series> <c1-flex-chart-series binding="AprPrice" name="April"></c1-flex-chart-series> <c1-flex-chart-series binding="MayPrice" name="May"></c1-flex-chart-series> <c1-flex-chart-datalabel position="Top" content="{y}"></c1-flex-chart-datalabel> </c1-flex-chart> @section Description{ <h3> @Html.Raw(FlexChartRes.Labels_Labels) </h3> <p>@Html.Raw(FlexChartRes.Labels_Text0)</p> }
マニュアル