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

Target Line for Bar Chart #1019

Closed
ghost opened this issue May 11, 2016 · 6 comments
Closed

Target Line for Bar Chart #1019

ghost opened this issue May 11, 2016 · 6 comments

Comments

@ghost
Copy link

ghost commented May 11, 2016

Hi guys, may I know how can I put the "target line" by using BarChartView element?

Attached with the Dropbox link below for the finishing that I trying to achieve.
https://www.dropbox.com/s/rwc6qfsjk2exezg/photo922167266029709323.jpg?dl=0

@liuxuan30
Copy link
Member

it's called ChartLimitLine.

BTW, you can just use github image service for a single image.

@ghost
Copy link
Author

ghost commented May 12, 2016

Hi @liuxuan30, thank you for the swift respond.

However, I manage to show the ChartLimitLine already with the codes below.
ChartLimitLine *llXAxis = [[ChartLimitLine alloc] initWithLimit:220.0 label:@"GOAL"];
llXAxis.lineWidth = 4.0;
llXAxis.lineColor = [UIColor redColor];

Not sure if you mind to explain further on how to show the image on the left?

Do I need to subclass ChartLimitLine in order to further explore on that piece?

@liuxuan30
Copy link
Member

Yes you need. The additional flag image should be customized renderering.
But be careful how you draw the limit line. It can draw above the data or beneath, and in different cases, the chart limit will be clipped or not. So I would suggest you take a look the drawRect function to figure out if overriding chart limit line renderer can do you a favor.
If not, then you have to write addional func to draw the image.

@ghost
Copy link
Author

ghost commented May 12, 2016

@liuxuan30 noted with thanks and will try it out.

Also, not sure if you have any sample code on this? I believe out there should have lots of people looking for the same thing.

@liuxuan30
Copy link
Member

no, currently you are the first one I guess. You can take a look at how the chart limit line's label is drawn. Should be similar.

@ghost
Copy link
Author

ghost commented May 12, 2016

Sure thing @liuxuan30, truly appreciate with all the swift responds.

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

1 participant