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

Value labels for multiple ChartDataSets all aligned at the beginning (left) of each bar in HorizontalBarChart #2077

Closed
cdf1982 opened this issue Jan 15, 2017 · 2 comments

Comments

@cdf1982
Copy link

cdf1982 commented Jan 15, 2017

Hi and thanks for this amazing project!

I have an HorizontalBarChart with 3 BarChartDataSets and I'm close to the result I want: every bar showing a formatted value label for each data set.
In the following screenshot, for instance, the second bar (14/01/17) shows 11192 as label for the first BarChartDataSet value, 8.25 for the second (which is actually 8250, but formatted according to my needs) and 1 for the third BarChartDataSet (which will often have very small values comparing to the other datasets, so usually its actual bar won't be visible, and only the label will be shown... which is fine for me).

img_2585

My problem, or better my goal, is to have all three value labels aligned at the beginning of the bar, on the left, inside the bar. Like this (sorry for the quick and dirty photoshopping):

my_goal

Currently I have barChartView.drawValueAboveBarEnabled = true, but setting it false only brings the label inside the bars, but on the right side, which actually causes an even worse positioning for the label of the third BarChartDataSet, the one with small values, since that label overlaps with the dates.

Is there a way to have the value labels drawn at the beginning (left) of the bars that I am missing?

Thanks in advance for your help!

Cesare

@liuxuan30
Copy link
Member

liuxuan30 commented Jan 16, 2017

you can override drawValues() to draw at your desired position. And you are welcome to file a pull request to make it better if you think it's useful :) Just follow the code style

@cdf1982
Copy link
Author

cdf1982 commented Jan 16, 2017

@liuxuan30 it worked like a charm, thank you so much!

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