BulletGraph
方向
機能
サンプル
設定
説明
この例は、BulletGraph コントロールで Direction プロパティを使用する方法を示します。
ソース
DirectionController.cs
using MvcExplorer.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace MvcExplorer.Controllers
{
public partial class BulletGraphController : Controller
{
public ActionResult Direction()
{
ViewBag.DemoSettings = true;
ViewBag.DemoSettingsModel = new ClientSettingsModel
{
Settings = CreateDirectionSettings()
};
return View();
}
private static IDictionary<string, object[]> CreateDirectionSettings()
{
var settings = new Dictionary<string, object[]>
{
{"Direction", new object[]{"Left", "Right", "Down", "Up"}}
};
return settings;
}
}
}
Direction.cshtml
@{
ClientSettingsModel demoSettingsModel = ViewBag.DemoSettingsModel;
}
@section Scripts{
<script>
function customChangeDirection(control, value) {
control.direction = value;
control.invalidate();
if (value === "Left" || value === "Right") {
control.hostElement.style.width = "500px";
control.hostElement.style.height = "1.2em";
} else {
control.hostElement.style.width = "1.2em";
control.hostElement.style.height = "500px";
}
}
</script>
}
@(Html.C1().BulletGraph().Id(demoSettingsModel.ControlId)
.Min(0).Max(10).Good(3)
.Bad(4).Value(5).Target(6)
.Direction(GaugeDirection.Left).Width(500)
)
@section Description{
@Html.Raw(Resources.BulletGraph.Direction_Text0)
}
マニュアル