首页 > 解决方案 > Flot 不在 localhost 中显示图表

问题描述

我正在尝试使用 Flot 从 mysql 中查询一些数据来绘制图表。因为我以前从未使用过 Flot,所以我开始尝试重现 Flot 提供的示例,例如这个: http ://www.flotcharts.org/flot/examples/interacting/index.html

我在我网站的本地文件夹中下载了上面的 html 页面(并用 test.html 重命名),以及所有必要的 javascript 源和 CSS,并将它们放在同一个文件夹中,并更正了 html 页面中的路径以便找到js代码和css。

问题是,如果我用它的绝对路径打开这个 html 文件,图表可以完美运行:file:///data/www/test_website/test.html,但是如果我用 127.0.0.2/test 打开它就不行.html。

有人可以帮忙吗?任何建议将不胜感激!!!

我尝试绝对路径时没有错误。但是当我尝试使用 127.0.0.2/test.html 时,出现以下错误:

jquery.canvaswrapper.js:17 Uncaught TypeError: Cannot read property 'getElementsByClassName' of undefined

appContent.js:54 Uncaught (in promise) TypeError: Cannot read property 'query' of undefined

标签: phpflot

解决方案


推荐阅读