99445609
2016-03-29 16:11
采纳率: 64.3%
浏览 1.2k
已采纳

extjs构建图表代码哪里不对求指导,需要引入chart.swp吗

function timee1chartPanel(){
var timee1chartPanel=Ext.create("Ext.panel.Panel",{
title:"管理用户",
layout:'fit',
items:[checkAllTimee1chart()]
});
return timee1chartPanel;
}
function checkAllTimee1chart(){
new Ext.Viewport({
layout:'fit',
item:[{
xtype:'chart',
store:store,
axes:[
{
title:'Temperature',
type:'Numeric',
position:'left',
fields:['temperature'],
minimm:0,
maximum:100,

             },
             {
                 title:'Time',
                 type:'Category',
                 position:'bottom',
                 fields:['date']
             }
              ],
              series:[
                  {
                    type:'line',
                    xField:'date',
                    yField:'temperature'

                  }    
                      ]
    }]
    })

};

Ext.define('WeatherPoint', {
extend: 'Ext.data.Model',
fields: ['temperature', 'date']
});
var store = Ext.create('Ext.data.Store', {
model: 'WeatherPoint',
data: [
{ temperature: 58, date: new Date(2011, 1, 1, 8) },
{ temperature: 63, date: new Date(2011, 1, 1, 9) },
{ temperature: 73, date: new Date(2011, 1, 1, 10) },
{ temperature: 78, date: new Date(2011, 1, 1, 11) },
{ temperature: 81, date: new Date(2011, 1, 1, 12) },
]

}

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • 已采纳

    checkAllTimee1chart直接返回chart配置,要不panel里面又嵌套viewpoint会报错,还有一个问题就是没见你再那里显示panel。。

           function checkAllTimee1chart(){
               return  {
                        xtype:'chart',
                        store:store,
                        axes:[
                        {
                            title:'Temperature',
                            type:'Numeric',
                            position:'left',
                            fields:['temperature'],
                            minimm:0,
                            maximum:100,
    
                        },
                                     {
                                         title:'Time',
                                         type:'Category',
                                         position:'bottom',
                                         fields:['date']
                                     }
                        ],
                        series:[
                            {
                                type:'line',
                                xField:'date',
                                yField:'temperature'
    
                            }    
                        ]
                    }
            }
    
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题