我在我的页面上使用Shield UI ASP.NET MVC图表。以下是我的一些代码:
@(Html.ShieldChart()
.Name("chart5")
.PrimaryHeader(header => header.Text("Profile Hits"))
.Export(false)
.AxisX(axisX => axisX
.CategoricalValues("Jan", "Feb", "Mar", "Apr", "May", "Jun"))
.AxisY(axisY => axisY.Title(title => title.Text("Profile Hits")))
.DataSeries(dataSeries => dataSeries.Line()
.CollectionAlias("Total Visits")
.Data(new object[]{565000, 630400, 743000, 910200, 1170200, 1383000}))
.DataSeries(dataSeries => dataSeries.Bar()
.CollectionAlias("Unique Visits")
.Data(new object[]{152000, 234000, 123000, 348000, 167000, 283000}))
var interval = 500;
function reload() {
window.setTimeout(function () { reload() }, interval);
}
)
我收到错误,我无法解决。目的是使页面能够在变量中预定义的时间间隔内重新加载。
答案 0 :(得分:1)
将JS代码放在正确的位置时出错了。这是更正后的代码:
<input type="text" id="intrvl" value="1200" />
<script type="text/javascript">
var interval = 500;
function reload() {
window.setTimeout(function () { reload() }, interval);
}
</script>
<script type="text/javascript"> reload();</script>
<p id="DataSpot">
@(Html.ShieldChart()
.Name("chart5")
.PrimaryHeader(header => header.Text("Profile Hits"))
.Export(false)
.AxisX(axisX => axisX
.CategoricalValues("Jan", "Feb", "Mar", "Apr", "May", "Jun"))
.AxisY(axisY => axisY.Title(title => title.Text("Profile Hits")))
.DataSeries(dataSeries => dataSeries.Line()
.CollectionAlias("Total Visits")
.Data(new object[]{565000, 630400, 743000, 910200, 1170200, 1383000}))
.DataSeries(dataSeries => dataSeries.Bar()
.CollectionAlias("Unique Visits")
.Data(new object[]{152000, 234000, 123000, 348000, 167000, 283000}))
)
</p>