Charts 我正在试用一个应用程序,它可以从商店中绘制图表。它倾向于显示轴,但不显示图形线和点
该商店在应用程序的其余部分运行良好,但我无法使用该数据并在图表中绘制该数据 我做了一些基本的工作,但对图表所知甚少 我尝试了其他的例子,但我无法解决这个问题。 控制台显示:Uncaught TypeError:无法读取未定义的属性“1” 我已经安装了ruby、compass和sass 视图: 模态:Charts 我正在试用一个应用程序,它可以从商店中绘制图表。它倾向于显示轴,但不显示图形线和点,charts,sencha-touch,sencha-touch-2,sencha-charts,Charts,Sencha Touch,Sencha Touch 2,Sencha Charts,该商店在应用程序的其余部分运行良好,但我无法使用该数据并在图表中绘制该数据 我做了一些基本的工作,但对图表所知甚少 我尝试了其他的例子,但我无法解决这个问题。 控制台显示:Uncaught TypeError:无法读取未定义的属性“1” 我已经安装了ruby、compass和sass 视图: 模态: Ext.define('CSBApp.model.expensemodel',{ extend: 'Ext.data.Model', config: { identi
Ext.define('CSBApp.model.expensemodel',{
extend: 'Ext.data.Model',
config: {
identifier:{
type:'uuid'
},
fields: [
{
name:'desc',
type:'string'
},
{
name: 'amount',
type:'number'
},
{
name: 'date',
type:'date',
defaultformat: 'Y-m-d'
},
],
// autoLoad : true
}
});
商店:
Ext.define('CSBApp.store.mystore',{
extend : 'Ext.data.Store',
config : {
model : 'CSBApp.model.expensemodel',
storeId : 'mysqlstore',
proxy : {
type : 'sql',
id : 'mystore',
reader: {
type: "sql"
}
},
autoLoad : true
}
});
我有点明白了。 基本问题在于视图及其调用存储的方式。 因此,该应用程序似乎与sql应用商店配合良好。 主要因素是“requires”文件必须正确 以下是视图:
Ext.define('CSBApp.view.graph', {
extend: 'Ext.chart.CartesianChart',
xtype: 'graph',
requires: [
'Ext.chart.series.Line',
'Ext.chart.axis.Numeric',
'Ext.chart.axis.Category',
'Ext.chart.CartesianChart',
'Ext.chart.axis.layout.CombineDuplicate',
'Ext.chart.axis.segmenter.Names'
],
config: {
store:'mysqlstore' ,
width : '100%',
layout:'fit',
axes: [{
type: 'numeric',
position: 'left',
title: {
text: 'Sample Values',
fontSize: 15
},
minimum:0,
fields: 'amount'
},
{
type: 'category',
position: 'bottom',
title: {
text: 'Sample Values',
fontSize: 15
},
fields: 'date',
minimum:0,
}],
series: [{
type: 'line',
xField: 'date',
yField: 'amount',
minimum:0,
style: {
stroke: '#003366',
lineWidth: 3
},
marker: {
type: 'circle',
stroke: '#003366',
radius: 5,
lineWidth: 3,
}
}
}]
}
});
如果您获得了store rite,这是非常正确的。您是否尝试过先使用本地数据,而不是使用sql代理?从小事做起。这个应用程序的另一部分显示所有费用,使用sql存储效果更好,但是我也会尝试并更新。没有解决方案吗?我已经尝试了2年了days@mitchellsimoens,我刚刚用本地存储进行了尝试,但仍然没有显示出来。
Ext.define('CSBApp.view.graph', {
extend: 'Ext.chart.CartesianChart',
xtype: 'graph',
requires: [
'Ext.chart.series.Line',
'Ext.chart.axis.Numeric',
'Ext.chart.axis.Category',
'Ext.chart.CartesianChart',
'Ext.chart.axis.layout.CombineDuplicate',
'Ext.chart.axis.segmenter.Names'
],
config: {
store:'mysqlstore' ,
width : '100%',
layout:'fit',
axes: [{
type: 'numeric',
position: 'left',
title: {
text: 'Sample Values',
fontSize: 15
},
minimum:0,
fields: 'amount'
},
{
type: 'category',
position: 'bottom',
title: {
text: 'Sample Values',
fontSize: 15
},
fields: 'date',
minimum:0,
}],
series: [{
type: 'line',
xField: 'date',
yField: 'amount',
minimum:0,
style: {
stroke: '#003366',
lineWidth: 3
},
marker: {
type: 'circle',
stroke: '#003366',
radius: 5,
lineWidth: 3,
}
}
}]
}
});