2 qq 34262595 qq_34262595 于 2016.03.30 00:11 提问

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个回答

showbo
showbo   Ds   Rxr 2016.07.05 09:25
已采纳

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'

                        }    
                    ]
                }
        }
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!