尽管我在我的索引页面中包含了ext-all.js
文件;当我尝试this online Guage chart example provided by Sencha时得到如下的错误
http://myapp.com/widget/polar.js?_dc=1436970370848 404 (Not Found)
Uncaught Error: [Ext.create] Unrecognized class name / alias: widget.polar
图表位于一个单独的包中:
默认情况下,Sencha图表不包含在Ext JS库中。为了包含图表包,只需将“图表”(“sencha-charts”,如果使用Ext JS 5.x)添加到Sencha Cmd生成的应用程序的{appRoot} /app.json文件中的requires块。将包名称添加到requires数组会指示Cmd使包可用于您的应用程序。
https://docs.sencha.com/extjs/5.1/components/introduction_to_charting.html
"requires": [
"charts"
],
这应该从您的app.json中取消注释
在Extjs 6中,您必须通过取消注释来包含sencha图表
"requires": [
"sencha-charts"
],
在app.json
和通过应用程序文件夹在sencha cmd中运行sencha app watch
命令。
它对我有用,希望这对你有所帮助:)
我在渲染极坐标图时遇到了同样的问题。在下面的解决方案中找出:在application.js中添加以下内容
requires: ['Ext.chart.*']
除了取消注释“必需”:“图表”(ExtJS 6的“图表”和ExtJS 5的“图表”)适用于Sencha Cmd项目,我发现你自己包含了ext-all.js文件。可能你需要找到它们......你可以在那里找到所有文件 - >
https://cdnjs.com/libraries/extjs/6.2.0所有ExtJS文件,用于包括。这可以用于在线链接(例如在jsfiddle.net中)。写在最后的6.1.0,6.0.0,5.1.0或您需要的任何版本。
在此链接示例https://www.sencha.com/forum/showthread.php?303990-Is-there-a-free-GPA-CDN-for-ExtJS-6-l&p=1115697&viewfull=1#post1115697中找到 在jsfiddle - https://jsfiddle.net/Elunyfay/7v0uo2w6/7/
<!DOCTYPE html><html>
<head>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/ext-all-debug.js"></script>
<link rel="stylesheet" type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/classic/theme-triton/resources/theme-triton-all-debug.css">
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/classic/theme-triton/theme-triton-debug.js"></script>
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/packages/charts/classic/charts-debug.js"></script>
<link type="text/css" href="http://cdnjs.cloudflare.com/ajax/libs/extjs/6.0.0/packages/charts/classic/classic/resources/charts-all-debug.css">
...
对于使用开放式工具的ExtJS 6.x - 您必须手动安装图表模块
npm install @sencha/ext-charts
(不要使用-g
标志,因为Sencha CMD搜索源文件夹中的文件)
而不是添加
"requires": [
"charts"
],
到你的app.json文件。