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

Add Gradient to Bar Chart - BarChartDataSet #4385

Closed
svgupta97 opened this issue Jun 4, 2020 · 1 comment
Closed

Add Gradient to Bar Chart - BarChartDataSet #4385

svgupta97 opened this issue Jun 4, 2020 · 1 comment

Comments

@svgupta97
Copy link

I have tried researching trying to figure out how to add a gradient to my bar chart. However I am not able to to implement it. Many people have done something similar to :

let gradientColors = [UIColor.cyan.cgColor, UIColor.clear.cgColor] as CFArray // Colors of the gradient
let colorLocations:[CGFloat] = [1.0, 0.0] // Positioning of the gradient
let gradient = CGGradient.init(colorsSpace: CGColorSpaceCreateDeviceRGB(), colors: gradientColors, locations: colorLocations) // Gradient Object
yourDataSetName.fill = Fill.fillWithLinearGradient(gradient!, angle: 90.0) // Set the Gradient
set.drawFilledEnabled = true // Draw the Gradient

However it seems like this only works for line graphs since .drawFilledEnabled and .fill does not work with BarChartDataSet.

I get the error:
Value of type 'BarChartDataSet' has no member 'drawFilledEnabled' and
Value of type 'BarChartDataSet' has no member 'fill'

Would really appreciate if I can get some help on this! Thank you!!

@liuxuan30
Copy link
Member

I'm working on #4411 . wait for it merged.

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