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

Custom text over bar chart. #84

Closed
BurhanMughal opened this issue May 13, 2015 · 20 comments
Closed

Custom text over bar chart. #84

BurhanMughal opened this issue May 13, 2015 · 20 comments

Comments

@BurhanMughal
Copy link

Hi Daniel,
Hope you are doing good.

Can we show our custom value/Text over every bar in Bar chart ?

Currently : Bar value is shown above bar.
Expected Behavior: Show custom value/text over every bar.

Thanks.

@BurhanMughal
Copy link
Author

Waiting for positive reply

@danielgindi
Copy link
Collaborator

Use a custom number formatter

@BurhanMughal
Copy link
Author

I think you didn't get my point.

Data values are something like this : 105,115,120,129,154 etc.

I have type against every data value i.e. Walking,Running,Cycling etc.

I want to draw graph on the bases of values and draw my type over each bar.

I think I have explained much.

@danielgindi
Copy link
Collaborator

I didn't quite understand you.

@BurhanMughal
Copy link
Author

Well this is what I am looking to achieve.
Thanks.

screenshot_2015-05-15-12-37-48

@danielgindi
Copy link
Collaborator

Still you can use a custom NSNumberFormatter. You will receive the value
that you need - and output a String...

On Fri, May 15, 2015 at 12:51 PM, BurhanMughal notifications@github.com
wrote:

Well this is what I am looking to achieve.
Thanks.

[image: screenshot_2015-05-15-12-37-48]
https://cloud.githubusercontent.com/assets/12183139/7650616/b9b85b3a-fb11-11e4-8bd6-ead385184bcb.png


Reply to this email directly or view it on GitHub
#84 (comment)
.

@BurhanMughal
Copy link
Author

I think I can only pass two arrays i.e. xAxis and yAxis containing numbers. How can I pas number and string simultaneously ?

@danielgindi
Copy link
Collaborator

Well you do not pass a String. You said you do not want the value to show,
only a String right?
If so - then you can use a custom NSNumberFormatter - that will return your
custom String per value.
If you want to show both numeric value and a custom String - that's a
different case that we would have to consider.

On Fri, May 15, 2015 at 12:54 PM, BurhanMughal notifications@github.com
wrote:

I think I can only pass two arrays i.e. xAxis and yAxis containing
numbers. How can I pas number and string simultaneously ?


Reply to this email directly or view it on GitHub
#84 (comment)
.

@BurhanMughal
Copy link
Author

Sorry I couldn't quite get your idea, If it will return my custom string not value then how the graph will be populated ?
Getting confused.

@danielgindi
Copy link
Collaborator

The charts are populated with real values. The NSNumberFormatter is used to
generate the Strings that are rendered on the chart.

On Fri, May 15, 2015 at 1:10 PM, BurhanMughal notifications@github.com
wrote:

Sorry I couldn't quite get your idea, If it will return my custom string
not value then how the graph will be populated ?
Getting confused.


Reply to this email directly or view it on GitHub
#84 (comment)
.

@danielgindi
Copy link
Collaborator

Neither. When I say custom NSNumberFormatter, I mean custom
NSNumberFormatter.

On Fri, May 15, 2015 at 1:36 PM, BurhanMughal notifications@github.com
wrote:

Should I modify ChartViewBase or ChartRenderer ?


Reply to this email directly or view it on GitHub
#84 (comment)
.

@danielgindi
Copy link
Collaborator

Subclass the damn thing. You should really read some of Apple's
documentation on their APIs.

On Fri, May 15, 2015 at 1:53 PM, BurhanMughal notifications@github.com
wrote:

I can't understand your idea of using NSNumberFormatter :(


Reply to this email directly or view it on GitHub
#84 (comment)
.

@BurhanMughal
Copy link
Author

I solved it.. Thanks for your support. I just made changes in swift code and it works fine :) 👍

@danielgindi
Copy link
Collaborator

That is not the correct approach, as updated to the project will keep coming. There are APIs for almost anything, and standard ways to customize things.

@BurhanMughal
Copy link
Author

Yes you are right, It will take some time to apply your suggested approach and I can't afford time loss at this moment that's y I did this. Thanks anyway for suggestion I will eventually apply that one.

Regards.

@BurhanMughal
Copy link
Author

I found it ultimately Daniel, there are two methods for init the BarDataEntry object one is without data and other one with additional (id) data __nullable parameter. I just populate my custom text in that parameter against each data entry and use it in drawText method in BarChartRenderer :).

@rajasekharmagna
Copy link

Hi BurhanMughal..please send your Applied code ..i want to show as it is your functionalities..

@ChetanPTPote
Copy link

hello Sir

@ChetanPTPote
Copy link

ChetanPTPote commented Feb 26, 2018

image 2018-02-26 11 39 12

how to set that blue bubble on stacked bar chart in Charts with total

@kamrulhassansabuj
Copy link

I solved it.. Thanks for your support. I just made changes in swift code and it works fine :) 👍

hey, can you please share the solution. I'm facing the same problem. i have grouped bar with budget and actual expenses but i want to show custom data (subcategory of budget and actual) in the marker view. please help.

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

5 participants