如何在Ext.js中使用d3.js图?

时间:2013-02-19 02:00:56

标签: extjs d3.js

有人能指出我如何将d3.js图形嵌入ext.js的最简单的例子吗?我做了很多搜索:我甚至不确定它是否可行。或者是吗?提前谢谢。

1 个答案:

答案 0 :(得分:4)

到目前为止我使用OK结果的过度简化版本:

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.....

}

});