hughess opened a new issue #15928:
URL: https://github.com/apache/echarts/issues/15928


   ### What problem does this feature solve?
   I am not sure if this is possible at the moment, but I haven't been able to 
find it in documentation and these Stack Overflow questions lead me to believe 
it's not solved:
   
https://stackoverflow.com/questions/69215766/echarts-separate-series-based-on-dataset-field
   
https://stackoverflow.com/questions/65847643/how-to-display-multiple-lines-in-echarts-using-encode
   
   This feature would allow you to pass in a single dataset and create multiple 
series from that dataset without having to transform, filter, or loop through 
the dataset. This is important for data stored in 'tidy' format, where one 
column contains the group that should be used to create the multiple series. 
This is a common data format for people using a data warehouse.
   
   There are two workarounds I've found so far, but neither is ideal:
   1. Use VisualMap piecewise categories, but this is not ideal because the 
legend is different than the normal series legend, and setting this up is 
confusing
   2. Loop through the dataset and filter for each distinct item in the column 
containing the group names, then create a series for each
   
   It seems like this might be the solution to this problem? 
https://github.com/apache/echarts/pull/15747
   
   I've added some sample code below showing an additional option in `encode`, 
but it probably shouldn't belong in `series` since that represents a single 
series.
   
   ### What does the proposed API look like?
   ```option = {
   dataset: {
       source: 
       [
       {group: "A", product: 'Matcha Latte', count: 823, score: 95.8},
       {group: "A", product: 'Milk Tea', count: 235, score: 81.4},
       {group: "A", product: 'Cheese Cocoa', count: 1042, score: 91.2},
       {group: "A", product: 'Walnut Brownie', count: 988, score: 76.9},
       {group: "B", product: 'Matcha Latte', count: 23, score: 95.8},
       {group: "B", product: 'Milk Tea', count: 25, score: 81.4},
       {group: "B", product: 'Cheese Cocoa', count: 142, score: 91.2},
       {group: "B", product: 'Walnut Brownie', count: 98, score: 76.9}
       ]
     },
     xAxis: {
       type: 'category'
     },
     yAxis: {
       type: 'value'
     },
     series: [
         {
              type: 'bar', 
              encode: 
                     {
                         x: 'product', 
                         y: 'count',
                         series: 'group'
                     }
         }
       ]
   };
   ```
   
   <!-- This issue is generated by echarts-issue-helper. DO NOT REMOVE -->
   <!-- This issue is in English. DO NOT REMOVE -->


-- 
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