有人能指出我如何将d3.js图形嵌入ext.js的最简单的例子吗?我做了很多搜索:我甚至不确定它是否可行。或者是吗?提前谢谢。
答案 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.....
}
});