簡體   English   中英

航跡圖不呈現

[英]Flot chart doesn't render

我正在使用Visual Studio 2012 / ASP.NET MVC 4創建一個網站,我想使用Flot將圖表放在首頁上。

該項目的BundleConfig設置為包括整個Flot目錄,並包括jQuery:

bundles.Add(new ScriptBundle("~/bundles/flot").IncludeDirectory("~/Scripts/flot", "*.js"));
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js",
"~/Scripts/jquery-ui-{version}.js",
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*"));

腳本在_Layout.cshtml文件中呈現。

@Scripts.Render("~/bundles/modernizr", "~/bundles/jquery", "~bundles/flot")

腳本再次在主頁的“視圖”上呈現,並且flotcontainer div在主頁上顯示,但僅顯示為空白矩形。

@{
    ViewBag.Title = "Home Page";
    Scripts.Render("~/bundles/modernizr", "~/bundles/jquery", "~bundles/flot");
}

<div id="flotcontainer" style="width: 600px; height: 400px;"></div>

<script type="text/javascript">
    $(function () {
        var oilPrices = [[1167692400000, 61.05] ...
        ...(Flot chart example goes here, nothing wrong with this part)...
    });
</script>

馬克的答案原來是正確的-問題是“〜bundles / flot”缺少反斜杠,應該寫為“〜/ bundles / flot”。 謝謝馬克!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM