我正在尝试在应用中呈现sencha触摸图,
以下是该视图的代码。
Ext.define('xxxx.view.dashboard.EventAnalyticsChart', {
extend : 'Ext.Panel',
xtype : 'analyticsChartPanel',
requires:['Ext.chart.grid.HorizontalGrid',
'Ext.chart.grid.VerticalGrid'],
initialize : function() {
},
config : {
layout:{
type:'card'
},
items : [
{
// Toolbar to be displayed on the File Rack Screen
xtype : 'toolbar',
ui : 'light',
docked : 'top',
title : "Dashboard",
},
{
xtype:'panel',
docked : 'top',
height:60,
layout:{
type:'vbox',
align:'center',
pack:'center'
},
items:[
{
xtype : 'chart',
background: 'white',
flipXY: true,
legend: {
position: "bottom"
},
store: {
fields: ['name', 'g1', 'g2', 'g3'],
data: [
{"name": "Work", "g1": 2.67, "g2": 14.87, "g3": 0.41},
{"name": "Office", "g1": 1.90, "g2": 5.72, "g3": 14.80},
{"name": "Google", "g1": 18.34, "g2": 0.04, "g3": 22.35},
{"name": "Facebook", "g1": 21.37, "g2": 2.13, "g3": 12.98},
]
},
interactions: ['panzoom'],
//set legend configuration
legend: {
position: 'right',
width: 80
},
//define the x and y-axis configuration.
axes: [
{
type: 'numeric',
position: 'bottom',
grid: true,
minimum: 0
},
{
type: 'category',
position: 'left'
}
],
series: [
{
type: 'bar',
xField: 'name',
yField: ['g1', 'g2', 'g3'],
axis: 'bottom',
highlight: true,
showInLegend: true,
style: {
stroke: 'rgb(40,40,40)',
maxBarWidth: 30
},
// Cycles the red, green, and blue fill mode over the 2008, 2009,.., 2011, 2012 items
// subStyle parameters also override style parameters
subStyle: {
fill: ["#115fa6", "#94ae0a", "#a61120", "#ff8809", "#ffd13e", "#a61187", "#24ad9a", "#7c7474", "#a66111"]
}
}
]
}
],
}
});
在构建sencha代码之后,当运行打包的代码时,我得到以下错误。
未捕获的TypeError:无法调用方法' substring'未定义的app.js:1
我认为我没有加载图表所需的一些类。请指导我。
提前感谢。
答案 0 :(得分:0)
包括以下课程后工作正常。
'Ext.chart.axis.Numeric',
'Ext.chart.axis.Category',
'Ext.chart.series.Line',
'Ext.chart.interactions.PanZoom',
'Ext.chart.series.Bar'