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 2022/06/03 17:58:09 UTC

[GitHub] [echarts] Shaq76 opened a new issue, #17154: [Bug] Stacked bar chart is broken when you use encode to get the data

Shaq76 opened a new issue, #17154:
URL: https://github.com/apache/echarts/issues/17154

   ### Version
   
   5.3.2
   
   ### Link to Minimal Reproduction
   
   _No response_
   
   ### Steps to Reproduce
   
   `
   let data = [
   	["", "V1", "V2"],
   	['A', 6545, 6545],
   	['B', 2666, 5332],
   	['C', 687, 2061],
   	['D', 102, 408]
   ];
   
   let optionBroken = {
   	dataset: { source: data },
   	xAxis: { type: 'category' },
   	yAxis: {},
   	series: [
   		{
   			type: 'bar', encode: { x:0, y:1 }, stack: 'total'
   		},
   		{
   			type: 'bar', encode: { x:0, y:2 }, stack: 'total'
   		}
   	]
   };
   
   let optionWorks = {
   	xAxis: { type: 'category', data: data.map(x=>x[0]).filter((x,y)=>{return y!=0;}) },
   	yAxis: {},
   	series: [
   		{
   			type: 'bar',
   			data: data.map(x=>x[1]).filter((x,y)=>{return y!=0;}),
   			stack: 'total'
   		},
   		{
   			type: 'bar',
   			data: data.map(x=>x[2]).filter((x,y)=>{return y!=0;}),
   			stack: 'total'
   		}
   	]
   };
   
   //option = optionWorks
   option = optionBroken`
   
   ### Current Behavior
   
   The y axis appears to have no scale and one of the series is missing:
   ![image](https://user-images.githubusercontent.com/19664605/171919657-e05ea905-cc8a-4e6e-9c7a-8ef8687dd52f.png)
   
   
   ### Expected Behavior
   
   The y axis stacks, as with the explicit data assignment version:
   ![image](https://user-images.githubusercontent.com/19664605/171919784-f89fffc7-ce91-42a1-85a1-389c9b8c8471.png)
   
   
   ### Environment
   
   ```markdown
   - OS: Windows 10
   - Browser: Chrome
   ```
   
   
   ### Any additional comments?
   
   I would like to use the 'encode' version of the code as it's neater but I may have to revert all my code to work around this issue.
   Also I'm loving echarts, well done to all involved!
   


-- 
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.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] Shaq76 commented on issue #17154: [Bug] Stacked bar chart is broken when you use encode to get the data

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

   Brilliant, thanks @tyn1998 for your help, you've unblocked my days work!


-- 
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] tyn1998 commented on issue #17154: [Bug] Stacked bar chart is broken when you use encode to get the data

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

   Hi @Shaq76, I think dimention name cannot be "". Please give it a name then the `optionBroken` works too.
   
   <img width="1358" alt="image" src="https://user-images.githubusercontent.com/32434520/171971743-5b45abfc-cfc3-40b0-a2e3-3df360e71e70.png">
   
   By the way, if you want render your code correctly in comment, please wrap it with a pair of \``` rather single \`:
   
    \```javascript
   let 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