You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by GitBox <gi...@apache.org> on 2018/08/05 07:33:44 UTC

[GitHub] Skullnick commented on issue #8815: Add dispatchAction of type: 'treemapZoomToNode' to treemap

Skullnick commented on issue #8815: Add dispatchAction of type: 'treemapZoomToNode' to treemap
URL: https://github.com/apache/incubator-echarts/issues/8815#issuecomment-410501834
 
 
   I'm not sure this is the intended use by I added the following function in echarts.js in the treemap section, under the render function : 
   `    /**
        * @override
        */
       highlight: function (seriesModel, ecModel, api, payload) {
           var targetInfo;        var targetInfo;
           var viewRoot = seriesModel.getViewRoot();
   
           viewRoot.eachNode({attr: 'viewChildren', order: 'preorder'}, function (node) {
               var bgEl = this._storage.background[node.getRawIndex()];
               if (bgEl) 
               {
                   if(payload.name === node.name)          
                       targetInfo = {node: node};
                   
               }
           }, this);
   
           if(payload.name !== "")      
               this._zoomToNode(targetInfo);
       }`
   
   I then called a dispatchAction of type 'highlight' like the following : 
   curChart.dispatchAction({type: 'highlight', name: sName});
   
   It does the job but I'm sure you could implement something cleaner :)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org
For additional commands, e-mail: dev-help@echarts.apache.org