2013-02-19 37 views

回答

4

一個過於簡化的東西我有好結果至今使用的版本:

Ext.define('desktop.controls.d3svg', { 
extend: 'Ext.container.Container', 
alias: 'widget.d3svg', 

listeners: { 

    added: function() { 

     this.onAdded(); 

    } 

}, 

onAdded: function() { 

    // ext container has the outer and inner containers 
    // use id for selection of inner container for appending svg 
    var svg = d3.select('#' + this.id + '-innerCt').append("svg"); 

    this.svg = svg; 

}, 

onResize: function(width, height) { 

    // on the way to an example of using ext resize event and width 
    // and height vars 
    // this.svg.do_d3_resize_things..... 

} 

});