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

Background Colour Changes #701

Closed
Shredivan opened this issue Jan 22, 2016 · 4 comments
Closed

Background Colour Changes #701

Shredivan opened this issue Jan 22, 2016 · 4 comments

Comments

@Shredivan
Copy link

Hi, I was wondering is their a way to change background colours? We're doing a chart for our app which is colour coded and have yet to find a way to implement the coloured backgrounds in our designs.

Thanks,
Dave

@liuxuan30
Copy link
Member

What you mean by background color? UIView already has it. of course you can override drawRect to fill the color you want I guess

@Shredivan
Copy link
Author

Sorry i should have been more specific, I meant to colour of the background of the graph itself not the data been on it. I've attached an image to show you what I mean.

screen shot 2016-01-25 at 5 03 17 p m

@liuxuan30
Copy link
Member

alright, if you are talking about the screenshot, it requires a lot of customization...
But it should not be hard:
the whole rect is defined as contentRect, so the bounding coordinates is known;
You first figure out, how many rects there and what's the sub rect frame value; and then you simply set the color and render it like

CGContextSetFillColorWithColor(context, subRectColor.CGColor)
CGContextFillRect(context, subRect)

you can wrap it in a function, and call it in drawExtras or some where else.

@BilalSalam
Copy link

BilalSalam commented Sep 15, 2019

Hello, Can you add the code that shows the green color @Shredivan

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

3 participants