tyn1998 commented on issue #16152:
URL: https://github.com/apache/echarts/issues/16152#issuecomment-1136973507

   I think first we should know what universalTransition does. The feature 
enables animation between **different** series like [this 
demo](https://echarts.apache.org/examples/zh/editor.html?c=scatter-aggregate-bar)
 shows . 
   
   You may already be familiar with feeding **different data** to the option 
variable and using chart.setOption to get a smooth animation. With 
universalTransition, now you can also feed **different series types** to the 
option variable and using chart.setOption to get an amazing animation, too!
   
   When it happens that you feed **different series but in same type**, such as 
two bar series but have different xAxis categories, universalTransition will 
function like "downdrill". So downdrill is **still a transition** between 
**two** given options and it does not know your data levels at all.
   
   So we should do some extra work (structure & logic) to let echarts "knows" 
levels. The snippet above has several `data_` variables on top, from which you 
will have a sense of "levels". And I use these variables to generate 
`allOptions` which are identical to each other except their `dataGroupId` and 
`data` fields. Notice that I use `encode` to map `data[0]` to `x` and map 
`data[2]` to `itemGroupId`.
   
   Then I use an array variable `dataGroupIdStack` as a stack to "remember" the 
downdrill sequence. And with two other functions `goForward` and `goBack` 
called respectively by two onclick callbacks, the tree-levels downdrill demo 
then is worked out!
   
   So this is a workaround that works. But maybe echarts can do some 
capsulation work so that users can directly input leveled data to use multiple 
downdrill feature without doing things like this by themselves.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to