Version
4.9.0
Reproduction link
https://codepen.io/ChrisMash/pen/ExgXZLv
Steps to reproduce
Centering labels on second and third xAxis cannot be done in an intuitive manner when the number of items in each hierarchy or grouping is not even. The idea of hierarchies and grouped data (as to my understanding) is not fully supported?
What is expected?
What Im trying to achieve here is to produce a simple bar chart that has 2 series and 3 hierarchies. The code example i provided has this already implemented. The issue though (and what is expected) is a way to properly center the values on the second and third xAxis without having to add or remove empty strings in my xAxis data array.
What is actually happening?
The labels for second and third axes are always to the left since i have to provide empty strings always for my axes to work properly.
I used this issue to better understand how to use hierarchical data on a bar chart, please let me know if there is a better way to generate charts from such data.
Here is the example data i used and the expected result in excel.
Thank you very much for this great library 👌
9条答案
按热度按时间nzkunb0c1#
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 you have posted enough image to demo your request. 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! 🍵
sshcrbum2#
An example to workaround.
uxh89sit3#
Hello, I have question regarding this type of chart. If there is no data for all bars, then the chart still allocated space for the bar which leaves a gap. See the image below:
Is there any way to prevent creating this gap?
nsc4cvqm4#
@mortenamby where you able to figure something out?
I guess you want to achieve something like this:
It would be great if we could have grouppings with different lengths.
@pissang any idea if this is possible right now?
n7taea2i5#
I was able to imporve it:
I basically do the same as #4902 (comment) but when I use a dummy separator to indicate the sections and then I put the caption in the bar in the middle. This means that for pair groups it will still be a bit off (but at least it won't be in the first columns) and that for even groups it will be placed perfectly in the middle. To give you an idea:
z8dt9xmd6#
@DavidMarquezF
I didn't manage to find a solution myself. I worked around it by choosing a different chart design, so it is not really relevant to me anymore. It may still be relevant to others as I think the gap is an issue if you have many empty bars that will never get data, which was the issue I was facing.
But nice to see that you found a way to do it :D
sc4hvdpw7#
I was able to imporve it:
I basically do the same as #4902 (comment) but when I use a dummy separator to indicate the sections and then I put the caption in the bar in the middle. This means that for pair groups it will still be a bit off (but at least it won't be in the first columns) and that for even groups it will be placed perfectly in the middle. To give you an idea:
Could you help to share the full code? Thanks.
anhgbhbe8#
In my project I build the config dynamically so I don't have a single config for all available right now. However, the only important part you need is what i posted (the xAxis). The rest should be quite easy to lay down.
I actually improved the design a bit more so that the labels from the second groups are offset enough so that they don't overlap with the first row of categories. I will share my code but it's not copy paste material, you will need to figure it out a bit.
Then, for the rest of the config, just build a normal bar chart with a single series. You just use a single series and then the axis config is actually what does all of the work.
I'm sorry I can't share a full copy-paste example, I just don't have the time to do that right now. However, with this info it should be quite straight forward since the only complicated part about this is the xAxis itself and in the snippet I've shared that should work right of the bat.
zazmityj9#
Any chance that this will be officially supported? Tibco's Spotfire has a nice hierarchical axis representation that would be great to see in e-charts someday, even if it weren't interactive like the following example.