ios-charts

Remove Border and Margin around iOS Charts in Swift

荒凉一梦 提交于 2019-12-04 02:06:43
I am using iOS Charts with Swift 3, and I can't figure out how to do a couple things: I want to remove the margin around the chart. I know the chart goes edge-to-edge in my UI because if I change the chart's background color, it goes all the way to the edge. How do I remove the gap indicated by the red arrows below? How do I remove the border around the whole graph (note the black arrow)? I already have totalsGraph.drawBordersEnabled = false and it doesn't work. Is there a different option for that? Thank you! It is minOffset. /** Sets the minimum offset (padding) around the chart, defaults to

IOS-Charts set maximum visible x axis values

佐手、 提交于 2019-12-04 00:29:29
问题 I'm using ios-charts (https://github.com/danielgindi/Charts). I have a LineChartView with 12 values in the x axis. This however is far too many to see at the same time, so I want to display only 5 and then let the user drag to the right to see the next. I've tried this: let chart = LineChartView() chart.dragEnabled = true chart.setVisibleXRangeMaximum(5) let xAxis = chart.xAxis xAxis.axisMinValue = 0 xAxis.axisMaxValue = 5.0 xAxis.setLabelsToSkip(0) But still see all 11 values at the time.

Module file's deployment target is ios9.0 v9.0 with Xcode 7 / Swift 2

╄→尐↘猪︶ㄣ 提交于 2019-12-03 15:06:17
问题 I have a project using some modules that I have installed via cocoapods. One of them is Charts. In order to migrate my project from Swift 1.2 to Swift 2 I have gone through the wizard that comes up when first opening the project with Xcode 7. The Charts module is already available for Swift 2, and I have changed my Podfile to contain the following in order to upgrade to this newer and not yet officially released version: pod 'Charts', :git => 'https://github.com/danielgindi/ios-charts.git'

How to add “%” to data in ios-chart

◇◆丶佛笑我妖孽 提交于 2019-12-03 06:23:08
问题 chart, here is my code: private func setChart(pieChartView: PieChartView, values: [Double]) { var dataEntries: [PieChartDataEntry] = [] let dataPoints = ["Mar","Apr","May"] for i in 0..<dataPoints.count { let dataEntry = PieChartDataEntry(value: values[i], label: dataPoints[i]) dataEntries.append(dataEntry) } let pieChartDataSet = PieChartDataSet(values: dataEntries, label: "") pieChartDataSet.colors = [UIColor(red: 47/255, green: 164/255, blue: 59/255, alpha: 1.0),UIColor(red: 17/255, green:

Module file's deployment target is ios9.0 v9.0 with XCode 7 / Swift 2

不想你离开。 提交于 2019-12-03 04:46:54
I have a project using some modules that I have installed via cocoapods. One of them is Charts ( https://github.com/danielgindi/ios-charts ). In order to migrate my project from Swift 1.2 to Swift 2 I have gone through the wizard that comes up when first opening the project with XCode 7. The Charts module is already available for Swift 2, and I have changed my Podfile to contain the following in order to upgrade to this newer and not yet officially released version: pod 'Charts', :git => 'https://github.com/danielgindi/ios-charts.git' Now the project workspace opens fine in XCode except one

How to create a floating graph marker with ios-charts

感情迁移 提交于 2019-12-03 03:56:31
问题 I'm using the ios-charts framework and want to create a marker that floats over the graph when I touch and move my finger from side to side. I'm using a line chart just for reference. However, I can't figure out how to get the position of the marker on the chart when I touch it. I've read about subclassing MarkerView but that isn't working. Can you please show me how to get the position of the point that shows up when you touch an ios-chart? 回答1: So I finally got this to work and wanted to

How to add “%” to data in ios-chart

北慕城南 提交于 2019-12-02 19:48:56
chart, here is my code: private func setChart(pieChartView: PieChartView, values: [Double]) { var dataEntries: [PieChartDataEntry] = [] let dataPoints = ["Mar","Apr","May"] for i in 0..<dataPoints.count { let dataEntry = PieChartDataEntry(value: values[i], label: dataPoints[i]) dataEntries.append(dataEntry) } let pieChartDataSet = PieChartDataSet(values: dataEntries, label: "") pieChartDataSet.colors = [UIColor(red: 47/255, green: 164/255, blue: 59/255, alpha: 1.0),UIColor(red: 17/255, green: 128/255, blue: 127/255, alpha: 1.0),UIColor.orange] let pieChartData = PieChartData(dataSet:

How to create a floating graph marker with ios-charts

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 17:42:20
I'm using the ios-charts framework and want to create a marker that floats over the graph when I touch and move my finger from side to side. I'm using a line chart just for reference. However, I can't figure out how to get the position of the marker on the chart when I touch it. I've read about subclassing MarkerView but that isn't working. Can you please show me how to get the position of the point that shows up when you touch an ios-chart? So I finally got this to work and wanted to add it to the community. Here is what my chart looks like: When you run your finger over the chart the the

Allow PieChartView to hide value line for tiny slices in Swift

廉价感情. 提交于 2019-12-02 16:38:30
问题 I'm building a pie chart by chart iOS framework. I'm able to hide the value and label when the the slice is tiny but I can't hide the value line for tiny slice. If I add this code on setDataCount() set.valueLineWidth = 0.0 It will hide all the value line. How to hide it by the size of slice? @IBOutlet weak var myChart: PieChartView! var valueColors = [UIColor]() var dataEntries = [PieChartDataEntry]() var record = [Record]() var category = [String]() var categoryTotal : [Double] = [] var

How to stretch PieChartView the entire width and length of the parent View

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-02 01:07:55
I use the following charts library and have the following custom control: But after chart loaded i got the following picture: Its obvious that PieChartView has greater sizes than output chart. My question is how to make final chart to occupy entire PieChartView? Found a solution. When configuring PieChartDataSet let set = PieChartDataSet(...) //configuring and set selectionShift of the set to the zero (selection of the slices will be disabled) set.selectionShift = 0 Try this line of code if it helps.. pieChartView.contentMode = .ScaleAspectFill You can try PieChartView.setExtraOffsets(left: