我有一个 Shield UI ASP.NET MVC 并试图利用事件功能。我从该站点获取了一些源代码并相应地放置了它:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>@ViewBag.Title</title>
<link href="@Url.Content("~/Content/Site.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/Scripts/jquery-1.5.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/modernizr-1.7.min.js")" type="text/javascript"></script>
<link href="@Url.Content("~/shield-chart.1.2.2-Trial/shield-chart.1.2.2-Trial/css/shield-chart.min.css")" rel="stylesheet" type="text/css" />
<script src="@Url.Content("~/shield-chart.1.2.2-Trial/shield-chart.1.2.2-Trial/js/jquery-1.9.1.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/shield-chart.1.2.2-Trial/shield-chart.1.2.2-Trial/js/shield-chart.all.min.js")" type="text/javascript"></script>
<script type="text/ecmascript">
function HideChart() {
document.getElementById("DataSpot").innerHTML = "";
}
function chartEventFunction(e) {
alert("Chart ID: " + e.target.element.attr("id"));
}
</script>
在我的 cshtm 文件中,我有这个:
@(Html.ShieldChart()
.Events(events => events
.SeriesClick("chartEventFunction")))
.Name("chartA")
.AxisX(axisX => axisX.Title(title => title.Text("Speed of Wind")))
.AxisY(axisY => axisY.Title(title => title.Text("RainFall Quantities")))
.PrimaryHeader(header => header.Text("Weather - Wind/Precipitation Values"))
.Tooltip(tooltip => tooltip.AxisMarkers(axisMarkers => axisMarkers
.Enabled(true)
.Mode(Shield.Mvc.UI.Chart.TooltipAxisMarkerMode.XY)
.Width(1)
.ZIndex(3)))
.ChartLegend(chartLegend => chartLegend
.Align(Shield.Mvc.UI.Chart.Align.Right)
.VerticalAlign(Shield.Mvc.UI.Chart.VerticalAlign.Top)
.RenderDirection(Shield.Mvc.UI.Chart.Direction.Vertical))
.DataSeries(dataSeries => dataSeries.Scatter()
.CollectionAlias("January 2008")
.Data(new object[]{
new object[]{16.4, 5.4}, new object[]{21.7, 2}, new object[]{25.4, 3}, new object[]{19, 2}, new object[]{10.9, 1}, new object[]{13.6, 3.2}, new object[]{10.9, 7.4}, new object[]{10.9, 0}, new object[]{10.9, 8.2}, new object[]{16.4, 0}, new object[]{16.4, 1.8}, new object[]{13.6, 0.3}, new object[]{13.6, 0}, new object[]{29.9, 0}, new object[]{27.1, 2.3}, new object[]{16.4, 0}, new object[]{13.6, 3.7}, new object[]{10.9, 5.2}, new object[]{16.4, 6.5}, new object[]{10.9, 0}, new object[]{24.5, 7.1}, new object[]{10.9, 0}, new object[]{8.1, 4.7}, new object[]{19, 0}, new object[]{21.7, 1.8}, new object[]{27.1, 0}, new object[]{24.5, 0}, new object[]{27.1, 0}, new object[]{29.9, 1.5}, new object[]{27.1, 0.8}, new object[]{22.1, 2}
}))
.DataSeries(dataSeries => dataSeries.Scatter()
.CollectionAlias("January 2009")
.Data(new object[]{
new object[]{6.4, 13.4}, new object[]{1.7, 11}, new object[]{5.4, 8}, new object[]{9, 17}, new object[]{1.9, 4}, new object[]{3.6, 12.2}, new object[]{1.9, 14.4}, new object[]{1.9, 9}, new object[]{1.9, 13.2}, new object[]{1.4, 7}, new object[]{6.4, 8.8}, new object[]{3.6, 4.3}, new object[]{1.6, 10}, new object[]{9.9, 2}, new object[]{7.1, 15}, new object[]{1.4, 0}, new object[]{3.6, 13.7}, new object[]{1.9, 15.2}, new object[]{6.4, 16.5}, new object[]{0.9, 10}, new object[]{4.5, 17.1}, new object[]{10.9, 10}, new object[]{0.1, 14.7}, new object[]{9, 10}, new object[]{2.7, 11.8}, new object[]{2.1, 10}, new object[]{2.5, 10}, new object[]{27.1, 10}, new object[]{2.9, 11.5}, new object[]{7.1, 10.8}, new object[]{2.1, 12}
}))
.DataSeries(dataSeries => dataSeries.Scatter()
.CollectionAlias("January 2010")
.AddToLegend(false)
.Data(new object[]{
new object[]{21.7, 3}, new object[]{13.6, 3.5}, new object[]{13.6, 3}, new object[]{29.9, 3}, new object[]{21.7, 20}, new object[]{19, 2}, new object[]{10.9, 3}, new object[]{28, 4}, new object[]{27.1, 0.3}, new object[]{16.4, 4}, new object[]{13.6, 0}, new object[]{19, 5}, new object[]{16.4, 3}, new object[]{24.5, 3}, new object[]{32.6, 3}, new object[]{27.1, 4}, new object[]{13.6, 6}, new object[]{13.6, 8}, new object[]{13.6, 5}, new object[]{10.9, 4}, new object[]{16.4, 0}, new object[]{32.6, 10.3}, new object[]{21.7, 20.8}, new object[]{24.5, 0.8}, new object[]{16.4, 0}, new object[]{21.7, 6.9}, new object[]{13.6, 7.7}, new object[]{16.4, 0}, new object[]{8.1, 0}, new object[]{16.4, 0}, new object[]{16.4, 0}
}))
)
有一些问题我认为是由函数声明的存在引起的,我把它放在了正确的位置。还有什么可能是错的?还有一件事情。对于 MVC 图表,没有我可以在网站上获得(或至少找到)的可用事件列表。我怎么知道完整的事件列表?