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

bar chart with gradient #398

Closed
vigyanhoon opened this issue Sep 19, 2015 · 12 comments
Closed

bar chart with gradient #398

vigyanhoon opened this issue Sep 19, 2015 · 12 comments

Comments

@vigyanhoon
Copy link

Hi,

Does this support two or more gradient color for bars?

Thanks.

@liuxuan30
Copy link
Member

What you mean for the gradient color for bars? It has fill color first; and you can customize the color for each dataSet

@vigyanhoon
Copy link
Author

I have a requirement to create a graph like this:

screen shot 2015-09-21 at 6 11 06 pm

@liuxuan30
Copy link
Member

hmm, it seems you need to implement the gradient layer by yourself. ios-charts does not support this right now.

But for the line chart, we already support the filling - check out drawLinearFill and enable it with dataSet.isDrawFilledEnabled
Feel free to reopen it if you have more questions

@throb
Copy link

throb commented Feb 1, 2016

Do you have any example code for the gradient fill on the line chart? I cannot seem to reproduce it in Swift. Thank you so much!

@tejas-ardeshna
Copy link

Any update on this? Still no gradient layer for Barcharts?

@liuxuan30
Copy link
Member

not yet. Busy with Chart 3.0

@SunSet1219
Copy link

SunSet1219 commented Apr 14, 2017

hi
I would like to know how to make Line Chart(gradient fill)

@Moa131
Copy link

Moa131 commented Apr 18, 2017

@Egor1219
Hi, you can do this with for example like this :

        let chartDataSet = LineChartDataSet(values: %%YOUR DATA ENTRIES %%, label: "Temperature")
        // Gradient
        let gradientColors = [UIColor.red.cgColor, UIColor.clear.cgColor] as CFArray // Colors of the gradient
        let colorLocations:[CGFloat] = [0.5, 0.0] // Positioning of the gradient
        let gradient = CGGradient.init(colorsSpace: CGColorSpaceCreateDeviceRGB(), colors: gradientColors, locations: colorLocations) // Gradient Object
        chartDataSet.fill = Fill.fillWithLinearGradient(gradient!, angle: 90.0) // Set the Gradient
        chartDataSet.drawFilledEnabled = true // Draw the Gradient
        
        
        chartDataSet.drawCubicEnabled = true
        chartDataSet.cubicIntensity = 0.09

Swift 3

@getabhishekified
Copy link

I have created a video tutorial for this task. Kindly refer to my video.

https://www.youtube.com/watch?v=zT6zMyYpkXM&t=13s

@WangZhongyong
Copy link

@vigyanhoon
Hi! Have you found the solution for BarChartView gradientColors?and coding by Objective-C

@vigyanhoon
Copy link
Author

Its pretty old issue. I have now moved to front end dev.

@lexuanquynh
Copy link

no one help me?

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

9 participants