You could try s/th like the following. I use this, to place AmCharts inside a
dive, _after_ the div was drawn.

qx.Class.define("project.widget.DIV", {
        extend : qx.ui.core.Widget,     
        
        construct : function() {
                this.base(arguments);
                this.__createDIV();
        },
        
        events : {
                ready : 'qx.event.type.Event'
        },
        
        members : {
                __elem : null,
                
                isReady : function() {
                        return ( this.__elem !== null );
                },
                
                getDIV : function() {
                        if ( this.isReady() ) {
                                return this.__elem;
                        }
                        else {
                                this.error("div element not ready yet");
                        }
                },
                
                __createDIV : function() {
                        this.__elem = this.getContentElement().getDomElement();

                        if ( this.__elem === null ) {
                                this.addListenerOnce("appear", 
this.__createDIV, this);
                        }
                        else {
                                this.setWidth(this.getBounds().width);
                                this.setHeight(this.getBounds().height);
                                this.fireDataEvent("ready", this.__elem);
                        }
                }
        }
        
});

qx.Class.define("project.widget.AmCharts", {
        extend : project.widget.DIV,    

        construct : function(args) {
                this.base(arguments);
                this._chart = new AmCharts.AmSerialChart();
                
                var valueAxis = new AmCharts.ValueAxis;
                this._chart.addValueAxis(valueAxis_stand);

                var graph = new AmCharts.AmGraph();
                graph.valueAxis = valueAxis;
                this._chart.addGraph(graph);
                
                var legend = new AmCharts.AmLegend();
                this._chart.addLegend(legend);
                
                this.addListenerOnce("ready", this.__onReady, this);
        },
        
        members : {
                _chart : null,
                
                __onReady : function(event) {
                        // render chart for the first time
                        this._chart.write(this.getDIV());
                        
                        // setup resize listener for resizing chart
                        this.addListener("resize", this.__resize, this);
                },
                
                __resize : function(e) {
                        // does not work:
                        //var g = e.getData();
                        //console.log("resize: w: "+g.width+" h: "+g.height);
                        //this.__chart.width = g.width; 
                        //this.__chart.height = g.height; 
                        //this.__chart.validateNow();

                        // workaround
                        qx.html.Element.flush();
                        this._chart.invalidateSize();
                }
        }
});



--
View this message in context: 
http://qooxdoo.678.n2.nabble.com/Using-amChart-in-qooxdoo-mobile-tp7585861p7585862.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to