You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by GitBox <gi...@apache.org> on 2021/12/01 08:34:30 UTC

[GitHub] [echarts] dirslashls opened a new issue #16152: [Feature] Multi-level drill-down

dirslashls opened a new issue #16152:
URL: https://github.com/apache/echarts/issues/16152


   ### What problem does this feature solve?
   
   The 5.2.0 feature of Universal Transition works great for drilling down 1 level. I am trying to create drilling down to multi-levels and can't figure out how to do it. My idea was that the groupId from the previous level becomes dataGroupId of the current level and the current level will use the itemGroupId for the groups of the current dataset. However, specifying itemGroupId in the second level completely stopped the animation.
   
   ### What does the proposed API look like?
   
   I think there should be a way to distinguish between the group a data item belongs to from the drill-through group and also a group it forms for further drill-down.


-- 
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: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [echarts] dirslashls commented on issue #16152: [Feature] Multi-level drill-down

Posted by GitBox <gi...@apache.org>.
dirslashls commented on issue #16152:
URL: https://github.com/apache/echarts/issues/16152#issuecomment-983725274


   Hello please use the following code which is a slight modification of the bar chart animation at https://echarts.apache.org/examples/en/editor.html?c=bar-drilldown. That one has 2 levels and I am trying to create 3 levels.
   
   In the below code, I have an option indicating commenting "groupId" shows the universal transition from level 1 to 2. But drilling level 2 to 3 will not be possible as I won't know the level 3 grouping from level 2 data. To support multi-level drill-down I think there needs to be two group ids. One about the group a data item belongs to w.r.t the parent and one about the group the child data elements belong to.
   
   ```js
   option = {
     xAxis: {
       data: ['Animals', 'Fruits', 'Cars']
     },
     yAxis: {},
     dataGroupId: '',
     animationDurationUpdate: 500,
     series: {
       type: 'bar',
       id: 'sales',
       data: [
         {
           value: 5,
           groupId: 'animals'
         },
         {
           value: 2,
           groupId: 'fruits'
         },
         {
           value: 4,
           groupId: 'cars'
         }
       ],
       universalTransition: {
         enabled: true,
         divideShape: 'clone'
       }
     }
   };
   const drilldownData = [
     {
       dataGroupId: 'animals',
       data: [
         ['Cats', 4,'household'],
         ['Dogs', 2,'household'],
         ['Cows', 1,'farm'],
         ['Sheep', 2,'farm'],
         ['Pigs', 1,'farm']
       ]
     },
     {
       dataGroupId: 'fruits',
       data: [
         ['Apples', 4,'sweet'],
         ['Oranges', 2,'sour']
       ]
     },
     {
       dataGroupId: 'cars',
       data: [
         ['Toyota', 4,'japanese'],
         ['Opel', 2,'german'],
         ['Volkswagen', 2,'german']
       ]
     }
   ];
   
   const drilldownData2 = [
     { dataGroupId: 'household',
       data: [['Canine',2],['Feline',1]]
     },
   ]
   
   let level = 0;
   myChart.on('click', function (event) {
     level = (level+1)%3;
     console.debug(level);
     if (event.data) {
       var subData = (level === 1 ? drilldownData : drilldownData2).find(function (data) {
         return data.dataGroupId === event.data.groupId;
       });
       if (!subData) {
         return;
       }
       myChart.setOption({
         xAxis: {
           data: subData.data.map(function (item) {
             return item[0];
           })
         },
         series: {
           type: 'bar',
           id: 'sales',
           dataGroupId: subData.dataGroupId,
           data: subData.data.map(function (item) {
             return { value: item[1] , 
                  groupId: item[2] /* comment groupId and the universal transition works but not 2nd level drill */ 
             };
           }),
           universalTransition: {
             enabled: true,
             divideShape: 'clone'
           }
         },
         graphic: [
           {
             type: 'text',
             left: 50,
             top: 20,
             style: {
               text: 'Back',
               fontSize: 18
             },
             onclick: function () {
               level = -1;
               myChart.setOption(option);
             }
           }
         ]
       });
     }
   });
   ```


-- 
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: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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


[GitHub] [echarts] echarts-bot[bot] commented on issue #16152: [Feature] Multi-level drill-down

Posted by GitBox <gi...@apache.org>.
echarts-bot[bot] commented on issue #16152:
URL: https://github.com/apache/echarts/issues/16152#issuecomment-983517626


   @dirslashls Please provide a demo for the issue either with https://codepen.io/Ovilia/pen/dyYWXWM , https://www.makeapie.com/editor.html or https://codesandbox.io/s/mystifying-bash-2uthz.


-- 
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: commits-unsubscribe@echarts.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



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