https://github.com/mallikarjunh/charts_examples
Line Chart, Bar Chart and Pie Charts
https://github.com/mallikarjunh/charts_examples
barchart charts cocoapods ios linechart pie-charts swift
Last synced: 6 months ago
JSON representation
Line Chart, Bar Chart and Pie Charts
- Host: GitHub
- URL: https://github.com/mallikarjunh/charts_examples
- Owner: MallikarjunH
- Created: 2019-07-26T09:47:26.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-10-23T07:27:25.000Z (almost 6 years ago)
- Last Synced: 2025-03-26T14:50:46.927Z (6 months ago)
- Topics: barchart, charts, cocoapods, ios, linechart, pie-charts, swift
- Language: Swift
- Size: 1.18 MB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
**Line Chart, Bar Chart and Pie Charts Examples**
**Library**: https://github.com/danielgindi/Charts
**Example 1 - 7** -Output Screens


**Example 7** - Line-Chart_3_Final4_Swift4 - This example work fine with swift 4**Following line/code is not available after 4.0 versions** (i.e 4.2, 5.0 swift verions)
chartViewOutlet.xAxis.valueFormatter = IndexAxisValueFormatter(value: months)
**Solutions**: - You need to add following code in order to show values on X- Axislet customFormater = CustomFormatter()
customFormater.labels = months
chartViewOutlet.xAxis.valueFormatter = customFormater
and write seperate class like below,
final class CustomFormatter: IAxisValueFormatter{
var labels: [String] = []
func stringForValue(_ value: Double, axis: AxisBase?) -> String {
let count = self.labels.count
guard let axis = axis, count > 0 else {
return ""
}
let factor = axis.axisMaximum / Double(count)
let index = Int((value / factor).rounded())
if index >= 0 && index < count {
return self.labels[index]
}
return ""
}
}**Bar Chart** - Output Screens

**Pie Chart** - Output Screen