Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set label for each column in group bar chart #691

Closed
minhthuc251 opened this issue Jan 21, 2016 · 5 comments
Closed

Set label for each column in group bar chart #691

minhthuc251 opened this issue Jan 21, 2016 · 5 comments

Comments

@minhthuc251
Copy link

I want to set label of xAxis for each column in each group bar chart .
I want column 876 has label : cafe sua da and column 10 has Sinh to dau . But i don't know how to do that.
screen shot 2016-01-21 at 2 57 56 pm

@liuxuan30
Copy link
Member

You are having two data sets, and they share the same xIndex and x value. Either use a single data set so you can put x value for each data. Or you can override the x axis renderer 'drawLabels' to what you need.

@minhthuc251
Copy link
Author

How can i set dependency for each member if using single data set and how i can group 2 member in 1

@liuxuan30
Copy link
Member

what you mean set dependency? There is axisDependency, not sure if you are asking for it.

If you are using single data set, you can just have single bar chart, or stacked bar chart.
One bar group means one data set. If you want to have two bars at same xIndex, you will need two data sets.

@minhthuc251
Copy link
Author

I want to set axisDependency , one to left and one to right and i want to have two bars at same xIndex. So how i can set label for each member of group using two data sets. Can you give me an example about using drawLabels, liuxuan30

@liuxuan30
Copy link
Member

As I said, you have to do some customizations about the x axis renderer.
If it just exists in horizontal bar chart, you could try set two lines of text like 'abc\n123', maybe a trick to let it draw two lines of labels automatically. If this trick does not work, you have to draw your text twice at different positions.
The example is drawLabels itself. The whole point is knowing what's the y position for your two labels; the default one is in the center of each bar group as you can see in the screenshot. So if you don't want very precise result, simply use this y and add some offset above and beneath to draw your text.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants