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

Line chart - LineChartDataSet Background color. #2272

Closed
Kiee79 opened this issue Mar 23, 2017 · 14 comments
Closed

Line chart - LineChartDataSet Background color. #2272

Kiee79 opened this issue Mar 23, 2017 · 14 comments

Comments

@Kiee79
Copy link

Kiee79 commented Mar 23, 2017

Hi ,

I am new with charts so is it maybe easy way to have different background colors for each LineChartDataSet ? @liuxuan30

@dangell7
Copy link

Yeah, you would just have to set the chart data for the different data sets...

@Kiee79
Copy link
Author

Kiee79 commented Mar 24, 2017

No , I mean change grid background for different sets ,no line color etc :)

@dangell7
Copy link

self.lineChartView.gridBackgroundColor = UIColor.darkGray

@Kiee79
Copy link
Author

Kiee79 commented Mar 24, 2017

Yes but I want to divide grid by sets and set different color for different part of grid :)

@dangell7
Copy link

dangell7 commented Mar 24, 2017

So first set:

var dataSetFirst: Bool = false
var dataSetSecond: Bool = false

Then in your code set your bools:

dataSetFirst = true
dataSetFirst = true

Then when you initialize your graphs use

if dataSetFirst == true {
self.lineChartView.gridBackgroundColor = UIColor.darkGray
} else if dataSetSecond == true {
self.lineChartView.gridBackgroundColor = UIColor.darkGray
}

@Kiee79
Copy link
Author

Kiee79 commented Mar 24, 2017

It won't work when I have 3 sets on 1 chart and I need 3 colors at the same time.

@dangell7
Copy link

Wait different "part" of the grid? I dont know if thats possible

@dangell7
Copy link

I get it now, sorry...

@Kiee79
Copy link
Author

Kiee79 commented Mar 24, 2017

Yes. 1 chart , 3 sets , 3 grid colors at the same time. No problem, thanks for your help anyway :)

@dangell7
Copy link

You could remove the grid and change the color of the line maybe?

@dangell7
Copy link

But Im not sure you can achieve what you want

@Kiee79
Copy link
Author

Kiee79 commented Mar 24, 2017

I guess I need to do sth with method "drawGridBackground" but i
I counted that someone had already done it.

@dangell7
Copy link

Hmm, well please post here if you figure it out, I would be interested in checking it out.

@liuxuan30
Copy link
Member

if you mean fill beneath the line, enable drawFilledEnabled
if you are asking drawGridBackground, it's in the code.
The library does not have something called data set grid background.

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