Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ExtJS 4绘图和图表示例不是绘图_Extjs_Drawing_Extjs4 - Fatal编程技术网

ExtJS 4绘图和图表示例不是绘图

ExtJS 4绘图和图表示例不是绘图,extjs,drawing,extjs4,Extjs,Drawing,Extjs4,这让我抓狂,我尝试了很多不同的选择。我正在浏览所有的资料,试图为一个项目将尽可能多的ExtJS4塞进我的大脑。在绘图和图表部分有两个示例。下面,第一个例子画了一个黄色的圆圈,第二个例子没有画圆圈。为什么? 第一个示例(绘制黄色圆圈): 第二个示例(不绘制圆): 我已经尝试了无数种将精灵添加到drawComponent的方法,唯一有效的方法是将它作为drawComponent实例化中项的声明成员提供。控制台中没有出现错误。修复包括在sprite语句末尾添加.show(true)。像这样: var

这让我抓狂,我尝试了很多不同的选择。我正在浏览所有的资料,试图为一个项目将尽可能多的ExtJS4塞进我的大脑。在绘图和图表部分有两个示例。下面,第一个例子画了一个黄色的圆圈,第二个例子没有画圆圈。为什么?

第一个示例(绘制黄色圆圈):

第二个示例(不绘制圆):


我已经尝试了无数种将精灵添加到drawComponent的方法,唯一有效的方法是将它作为drawComponent实例化中项的声明成员提供。控制台中没有出现错误。

修复包括在sprite语句末尾添加
.show(true)
。像这样:

var myCircle = drawComponent.surface.add({
    type: 'circle',
    x: 100,
    y: 100,
    radius: 100,
    fill: '#cc5'
}).show(true);
我真希望这已经出现在ExtJS4文档中

Ext.application({
name: 'HelloExt',
launch: function(){
    // Create a draw component
    var drawComponent = Ext.create('Ext.draw.Component', {
        viewBox: false
    });

    // Create a window to place the draw component in
    Ext.create('Ext.Window', {
        width: 220,
        height: 230,
        layout: 'fit',
        items: [drawComponent]
    }).show();

    // Add a circle sprite
    var myCircle = drawComponent.surface.add({
        type: 'circle',
        x: 100,
        y: 100,
        radius: 100,
        fill: '#cc5'
    });
}
});
var myCircle = drawComponent.surface.add({
    type: 'circle',
    x: 100,
    y: 100,
    radius: 100,
    fill: '#cc5'
}).show(true);