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

Gradient Background for LineChart. (Not Working) #1826

Closed
iAviatorJose opened this issue Nov 14, 2016 · 1 comment
Closed

Gradient Background for LineChart. (Not Working) #1826

iAviatorJose opened this issue Nov 14, 2016 · 1 comment

Comments

@iAviatorJose
Copy link

iAviatorJose commented Nov 14, 2016

I tried the below Code

  let colorTop =  UIColor(red: 255.0/255.0, green: 149.0/255.0, blue: 0.0/255.0, alpha: 1.0).CGColor
        let colorBottom = UIColor(red: 255.0/255.0, green: 94.0/255.0, blue: 58.0/255.0, alpha: 1.0).CGColor
        let gradientLayer = CAGradientLayer()
        gradientLayer.colors = [ colorTop, colorBottom]
        gradientLayer.locations = [ 0.0, 1.0]
        gradientLayer.frame = self.lineChartView.bounds
        lineChartView.layer.addSublayer(gradientLayer)

And ended up having a View where the gradient layer Hidding the lineChart.

Is it possible to have gradient backgrounds.

@iAviatorJose iAviatorJose changed the title Gradient Background for LineChart. Gradient Background for LineChart. (Not Working) Nov 14, 2016
@liuxuan30
Copy link
Member

liuxuan30 commented Nov 15, 2016

May I ask what is "Not Working" for the library? I don't remember it support gradient background.. Another fact is, you are adding a gradient layer into the chart view, so you should check the layer stack and opaque/alpha property of your view/layer, to make sure your layer can be seen.

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