Bilge commented on issue #14700:
URL: https://github.com/apache/echarts/issues/14700#issuecomment-825934349


   @Ovilia Thank you for giving me the opportunity to explain myself again with 
pictures. Hopefully this will make things clearer.
   
   Here is a picture of what we want to achieve:
   
   
![image](https://user-images.githubusercontent.com/470626/115929899-7758a780-a480-11eb-9557-a334ca96a9b4.png)
 😁 ✔️ 
   
   This picture is created with different charting software (not ECharts 😞).
   
   To recreate this with ECharts we might do something like this:
   
   ```js
   color: ['#00e396', '#bd2b41'],
   series: [
       {
           name: 'Positive reviews',
           stack: 'reviews',
       },
       {
           name: 'Negative reviews',
           stack: 'reviews',
       },
   ],
   ```
   
   This creates the following chart:
   
   
![image](https://user-images.githubusercontent.com/470626/115930253-0a91dd00-a481-11eb-933f-af0596ba23f4.png)
 🤔 ❌ 
   
   Notice that the stacking order is wrong: we want the positive series (green 
`#00e396`) ***above*** the negative series (red `#bd2b41`).
   
   Currently, the only way to do this is to **redefine the order** the series 
are declared in (which also means we need to swap the colour definition order), 
like this:
   
   ```js
   color: ['#bd2b41', '#00e396'],
   series: [
       {
           name: 'Negative reviews',
           stack: 'reviews',
       },
       {
           name: 'Positive reviews',
           stack: 'reviews',
       },
   ],
   ```
   
   This creates the following chart:
   
   
![image](https://user-images.githubusercontent.com/470626/115931248-b851bb80-a482-11eb-8c9f-acd41d015c54.png)
 😫 ❌ 
   
   This fixes the stacking order of the line series, but it causes the 
**legend** and **tooltip** to reverse order, which we do not want. We can fix 
the tooltip by asking it to also reverse its order as follows (or by writing a 
custom formatter).
   
   ```
   tooltip: {
       order: 'seriesDesc',
   },
   ```
   
   
![image](https://user-images.githubusercontent.com/470626/115931063-6e68d580-a482-11eb-86ea-c67921eedf1d.png)
 😩💨 ❌ 
   
   But this still leaves the legend order being the opposite of what we want 
and there is **no way to reverse the legend order**.
   
   ---
   
   All this brings me back to my point: I could request that you add a way to 
**reverse the legend order**, but I don't think it's a good solution. All we 
wanted to do was **reverse the stacking order** of the lines series, so it 
would be better to have an option to just do that **without changing the series 
declaration order**, which causes all other components' behaviour to change in 
ways that we do not want.


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

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