You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm trying to make my bar chart look like this
and this is what I currently am at
The problem I have is that there is the small grey line going through each of the bars. It appears to be some kind of gridline. I have tried disabling the grid lines and axes but nothing seems to work.
Here is my code ` var chartEntries = BarChartDataEntry
var times = [50,120,150,250,250,350,430,500]
let shows = ["The Wire \n \n ","Game of Thrones \n \n ","The Sopranos \n \n ","Breaking Bad \n \n ","Billions \n \n ","House of Cards \n \n ","Attack on Titan \n \n ", "Mad Men \n \n "]
for i in 0 ..< times.count {
let chartEntry = BarChartDataEntry(x:Double(i), y: Double(times[i]))
chartEntries.append(chartEntry)
//categories[i] = shows[i] + "\n" + String(times[i])
}
let chartDataSet = BarChartDataSet(values: chartEntries, label: "Categories")
let chartData = BarChartData(dataSet: chartDataSet)
//chartDataSet.colors = [UIColor.clear]
chartData.barWidth = 0.2
barChart.leftAxis.axisMinimum = 0
barChart.data = chartData
barChart.chartDescription?.text = ""
barChart.legend.enabled = false
barChart.xAxis.labelPosition = .bottomInside
barChart.leftAxis.enabled = false
barChart.rightAxis.enabled = false
barChart.drawValueAboveBarEnabled = true
barChart.xAxis.valueFormatter = IndexAxisValueFormatter(values:shows)
barChart.xAxis.granularity = 1
barChart.xAxis.drawAxisLineEnabled = false
barChart.drawGridBackgroundEnabled = false
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
for e in chartEntries{
let bounds = self.barChart.getBarBounds(entry: e)
let gradientLayer = CAGradientLayer()
gradientLayer.frame = bounds
gradientLayer.colors = [UIColor(red: 0, green:30,blue:189).cgColor , UIColor(red:2, green:201, blue:255).cgColor]
gradientLayer.startPoint = CGPoint(x: 0.0, y: 0.5)
gradientLayer.endPoint = CGPoint(x: 1.0, y: 0.5)
self.barChart.layer.addSublayer(gradientLayer)
}
}
`
Any help is greatly appreciated
The text was updated successfully, but these errors were encountered:
Hi, I'm trying to make my bar chart look like this
![screen shot 2017-06-10 at 2 54 53 pm](https://user-images.githubusercontent.com/14302659/27265580-ee156e0e-544c-11e7-9cfc-68db2a0b85e4.png)
![screen shot 2017-06-18 at 5 37 21 pm](https://user-images.githubusercontent.com/14302659/27265584-fab0642a-544c-11e7-94b2-00e2eb8bad6c.png)
and this is what I currently am at
The problem I have is that there is the small grey line going through each of the bars. It appears to be some kind of gridline. I have tried disabling the grid lines and axes but nothing seems to work.
Here is my code ` var chartEntries = BarChartDataEntry
Any help is greatly appreciated
The text was updated successfully, but these errors were encountered: