问题
Can anyone point me to even the simplest example of how to embed d3.js graphics into ext.js? I've done a lot of searching: I'm not even sure it's possible. Or is it? Thanks in advance.
回答1:
An overly simplified version of what I have used with OK results so far:
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.....
}
});
来源:https://stackoverflow.com/questions/14948593/how-to-use-d3-js-graphs-in-ext-js