我正在使用Visual 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")脚本将再次呈现在主页的View上,浮动容器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>发布于 2014-07-07 12:53:57
Mark's answer被证明是正确的--问题是“~bundle/flot”缺少一个反斜杠,它应该写成“~/bundle/flot”。谢谢马克!
https://stackoverflow.com/questions/24560142
复制相似问题