Version
5.1.1
Steps to reproduce
Use the following in the editor
option = {
xAxis: {
type: 'value',
data: [1,2,3,4,5,6,7]
},
yAxis: {
type: 'value'
},
"legend": {
"show": true,
"type": "scroll",
"padding": 5,
"selector": [
"all",
"inverse"
],
"top": 5
},
series: [{
name: "a",
data: [120, 200, 150, 80, 70, 110, 130],
type: 'bar',
stack: 'one'
}, {
name: "b",
data: [120, 200, 150, 80, 70, 110, 130],
type: 'bar',
stack: 'one'
}]
};
What is expected?
I expected to see a stacked bar chart.
What is actually happening?
It shows only one of the two series.
Just change the type from 'value' to 'category' for xAxis and everything is good.
4条答案
按热度按时间n8ghc7c11#
Hi! We've received your issue and please be patient to get responded. 🎉
The average response time is expected to be within one day for weekdays.
In the meanwhile, please make sure that it containsa minimum reproducible demoand necessaryimagesto illustrate. Otherwise, our committers will ask you to do so.
You may also check out the API and chart option to get the answer.
If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org . Please attach the issue link if it's a technical question.
If you are interested in the project, you may also subscribe our mailing list .
Have a nice day! 🍵
qpgpyjmq2#
This is very lightly mentioned in the series-bar documentation, but should definitely be more prominent.
sqyvllje3#
Some fields like grade of the student are numeric. What I see with bar charts is that they work great with category axis type and the data being string. If it is value type and/or numeric data then there are challenges. Any reason for limiting the full bar chart capabilities for value type and numeric data?
li9yvcax4#
+1 for needing stacking on a value axis.
Biggest problem for me with this is missing values - there may be parts of your x-axis where none of your series have any observations. It's a pain to have to iterate through the dataset and prepare it so that it shows missing data.
For example:
Using a
category
axis with this data won't show 6 or 7 on the axis. Usingvalue
would work if stacking was possible.The current workaround for this would be to iterate through each of these series, see which x values are missing, and recreate the data so that 6 and 7 are included as rows in each dataset.
One approach that might work is to treat this situation in the same way as a histogram: