@@ -60,6 +60,15 @@ acgraph.vector.Stage = function(opt_container, opt_width, opt_height) {
6060
6161 this . renderAsync_ = goog . bind ( this . renderAsync_ , this ) ;
6262 this . checkSize = goog . bind ( this . checkSize , this ) ;
63+ var doc = goog . global [ 'document' ] ;
64+
65+ if ( ! goog . global [ 'acgraph' ] . stages )
66+ goog . global [ 'acgraph' ] . stages = { } ;
67+
68+ var id = acgraph . utils . IdGenerator . getInstance ( ) . identify ( this , acgraph . utils . IdGenerator . ElementTypePrefix . STAGE ) ;
69+ goog . global [ 'acgraph' ] . stages [ id ] = this ;
70+
71+ this . charts = { } ;
6372
6473 /**
6574 * Event handler of the stage.
@@ -73,7 +82,9 @@ acgraph.vector.Stage = function(opt_container, opt_width, opt_height) {
7382 * @type {!Element }
7483 * @private
7584 */
76- this . internalContainer_ = goog . dom . createDom ( goog . dom . TagName . DIV , { style : 'position:relative;left:0;top:0;overflow:hidden;' } ) ;
85+ // this.internalContainer_ = goog.dom.createDom(goog.dom.TagName.DIV, {style: 'position:relative;left:0;top:0;overflow:hidden;'});
86+ this . internalContainer_ = doc . createElement ( goog . dom . TagName . DIV ) ;
87+ goog . style . setStyle ( this . internalContainer_ , { 'position' : 'relative' , 'left' : 0 , 'top' : 0 , 'overflow' : 'hidden' } ) ;
7788
7889 /**
7990 * Root DOM element of stage object.
@@ -90,6 +101,8 @@ acgraph.vector.Stage = function(opt_container, opt_width, opt_height) {
90101 // Add class for check anychart-ui.css attached. (DVF-1619)
91102 goog . dom . classlist . add ( this . domElement_ , 'anychart-ui-support' ) ;
92103 goog . dom . appendChild ( this . internalContainer_ , this . domElement_ ) ;
104+ this . domElement_ . setAttribute ( 'ac-id' , id ) ;
105+
93106
94107 /**
95108 * Array of clips that should be rendered when stage is rendering.
@@ -137,7 +150,8 @@ acgraph.vector.Stage = function(opt_container, opt_width, opt_height) {
137150
138151 this . setWidth_ ( opt_width || '100%' ) ;
139152 this . setHeight_ ( opt_height || '100%' ) ;
140- this . container_ = goog . dom . getElement ( opt_container || null ) ;
153+ this . container_ = goog . isString ( opt_container ) ?
154+ doc . getElementById ( opt_container ) : opt_container ;
141155 if ( this . container_ )
142156 this . updateContainer_ ( ) ;
143157 this . checkSize ( true , true ) ;
@@ -765,6 +779,15 @@ acgraph.vector.Stage.prototype.clip = function(opt_value) {
765779} ;
766780
767781
782+ /**
783+ * Returns anychart charts for this stage.
784+ * @return {Object }
785+ */
786+ acgraph . vector . Stage . prototype . getCharts = function ( ) {
787+ return this . charts ;
788+ } ;
789+
790+
768791//endregion
769792//region --- Internal methods
770793//------------------------------------------------------------------------------
@@ -837,7 +860,7 @@ acgraph.vector.Stage.prototype.checkSize = function(opt_directCall, opt_silent)
837860 if ( ! opt_silent )
838861 this . dispatchEvent ( acgraph . vector . Stage . EventType . STAGE_RESIZE ) ;
839862 }
840- if ( this . container_ && isDynamicSize ) {
863+ if ( this . container_ && isDynamicSize && ! goog . global [ 'isNodeJS' ] ) {
841864 this . checkSizeTimer_ = setTimeout ( this . checkSize , this . maxResizeDelay_ ) ;
842865 }
843866} ;
@@ -2125,6 +2148,8 @@ acgraph.vector.Stage.prototype.disposeInternal = function() {
21252148 delete this . internalContainer_ ;
21262149 this . domElement_ = null ;
21272150
2151+ acgraph . getRenderer ( ) . disposeMeasurement ( ) ;
2152+
21282153 if ( this . credits_ ) {
21292154 this . credits_ . dispose ( ) ;
21302155 this . credits_ = null ;
@@ -2226,5 +2251,6 @@ acgraph.vector.Stage.prototype.disposeInternal = function() {
22262251 proto [ 'removeAllListeners' ] = proto . removeAllListeners ;
22272252 proto [ 'title' ] = proto . title ;
22282253 proto [ 'desc' ] = proto . desc ;
2254+ proto [ 'getCharts' ] = proto . getCharts ;
22292255} ) ( ) ;
22302256//endregion
0 commit comments