2012-02-07 4 views
0

이것은 나를 미치게 만들고 여러 가지 옵션을 시도했습니다. 나는 모든 자료 here을 통해 가능한 많은 ExtJS 4를 프로젝트 내 두뇌에 밀어 넣으려고합니다. 그림 및 차트 섹션에는 두 가지 예가 있습니다. 아래의 첫 번째 예제는 노란색 원을 그리고 두 번째 예제는 원을 그립니다. 왜?ExtJS 4 그리기 및 차트 작성 예가 그림이 아닙니다.

Ext.application({ 
name: 'HelloExt', 
launch: function(){ 
    var drawComponent = Ext.create('Ext.draw.Component', { 
     viewBox: false, 
     items: [{ 
      type: 'circle', 
      fill: '#ffc', 
      radius: 100, 
      x: 100, 
      y: 100 
     }] 
    }); 

    Ext.create('Ext.Window', { 
     width: 230, 
     height: 230, 
     layout: 'fit', 
     items: [drawComponent] 
    }).show(); 
} 
}); 

두 번째 예 (더 원을 그립니다 없음) :

첫 번째 예는 (노란색 원립니다) 나는 drawComponent과에 스프라이트를 추가하는 수많은 방법을 시도했습니다

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' 
    }); 
} 
}); 

을 drawComponent 인스턴스화에있는 항목의 선언 된 멤버로 제공하는 경우에만 작동합니다. 콘솔에 오류가 없습니다.

답변

1

수정 내용에는 .show(true)을 sprite 문의 끝에 추가해야합니다. 이와 같이 :

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

정말 이것이 ExtJS 4 문서에 있었으면 좋겠습니다.