-3

我在我的页面上使用 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);
}
)

我收到一个错误,我无法解决。目的是使页面能够在变量中预定义的时间间隔内重新加载。

4

1 回答 1

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>
于 2013-09-11T13:36:07.073 回答