ios-charts

Combined Chart (line- and bar chart) using iOS-Charts

血红的双手。 提交于 2020-01-12 08:38:51
问题 I am trying to combine a line- and bar chart in swift (iOS-charts). Both the x- and the y-axis seem to be scaled properly, but the data is not showing on the chart. What am I missing? import UIKit import Charts class CombinedChartsTest: UIViewController { @IBOutlet weak var combinedChart: CombinedChartView! let months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] let unitsSold = [2.0, 4.0, 6.0, 3.0, 12.0, 16.0, 4.0, 17.0, 2.0, 4.0, 5.0, 4.0] override

Compile time error in Charts library

。_饼干妹妹 提交于 2020-01-06 03:22:18
问题 I have integrated Charts into my swift project usind cocoapods. pod installation was successful and shows succes message as below Analyzing dependencies Downloading dependencies Installing Charts (2.2.5) Generating Pods project Integrating client project Sending stats Pod installation complete! There is 1 dependency from the Podfile and 1 total pod installed. The I opened my workspace and build the project then shows some compile time error in charts libary files (eg like, Expected expression

Change position of labels to be inside data set circles

允我心安 提交于 2020-01-05 03:37:09
问题 I am using the iOS-Charts framework and have the following chart: I would like to change the position of the numbers (labels) to appear within the circle. Is it possible to achieve this? 回答1: Inside LineChartRenderer.swift, increased the value of y when text is being drawn, I increase it by 30 in this example: if dataSet.isDrawValuesEnabled { ChartUtils.drawText( context: context, text: formatter.stringForValue( e.y, entry: e, dataSetIndex: i, viewPortHandler: viewPortHandler), point: CGPoint

Using CocoaPods for the “Charts” framework. Swift 2

旧巷老猫 提交于 2020-01-03 06:04:07
问题 I am a newbie when it comes to CocoaPods so please bear with me! I am looking at the tutorial (https://www.raywenderlich.com/97014/use-cocoapods-with-swift) however this is using the dependency "pod 'Alamofire', '2.0.2'". I have looked online for over a hour now and I can't find what to use for the Charts framework (https://cocoapods.org/?q=charts). So Far i have done the following steps: 1. sudo gem install cocoapods and got the following output: 2. pod setup --verbose and got the following

How to add labels for XAxis for BarChartView in ios-charts

痴心易碎 提交于 2020-01-02 05:03:07
问题 I added a bar chart to the storyboard, but I cannot properly set labels for my data entries. here is my code: var names = ["aaa", "bbb", "ccc", "ddd"] var values = [230.0, 280.0, 450.0, 340.0] setChart(dataPoints: names, values: values) setChart function: func setChart(dataPoints: [String], values: [Double]) { let formatter = BarChartFormatter() formatter.setValues(values: dataPoints) let xaxis:XAxis = XAxis() barChartView.noDataText = "You need to provide data for the chart." var dataEntries

iOS-Charts How to put UIImage beside a point

自闭症网瘾萝莉.ら 提交于 2020-01-01 19:37:34
问题 I want to use iOS-Charts with Swift to draw some line charts to show the data. Now, I have a requirement that put a small icon beside each point. Now I can add UIImage on the graph, but the problem is how can I get the CGPoint coordinates of each points correctly. If I change the orientation of device or device type, the position of images are still fixed, not change correspondingly. Here is iPhone 6s picture. Here is my current code: for i in 0..<dataPoints.count { let pointLeft =

Stacked bar chart with charts in Swift

痴心易碎 提交于 2020-01-01 19:35:18
问题 I am trying to build a stacked bar chart with the Charts framework (Swift) in my iOS project. All I can build at the moment is a grouped bar chart. Does someone know how to do this? All I found is: Convert bar chart to a grouped bar chart with danielgindi/ios-charts and Swift Here is my code: @IBOutlet var barChartView: BarChartView! var receivedDate1 : String = "" var receivedDate2 : String = "" var receivedDate3 : String = "" var receivedDate4 : String = "" var receivedDate5 : String = ""

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

家住魔仙堡 提交于 2019-12-31 02:46:07
问题 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? 回答1: 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 回答2: Try this line of

Convert bar chart to a grouped bar chart with danielgindi/ios-charts and Swift

≯℡__Kan透↙ 提交于 2019-12-30 02:20:19
问题 i have created the simple bar chart with the library at https://github.com/danielgindi/ios-charts still can't figure out how to make this a grouped bar chart. I've added the units sold array to the chart, but don't know how to get the unitBought array to the chart to make it a grouped chart.please help. @IBOutlet weak var barChartView: BarChartView! override func viewDidLoad() { super.viewDidLoad() months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]

Use iOS-Charts How to set the label position of the X axis and the position of the bar, line

六月ゝ 毕业季﹏ 提交于 2019-12-25 18:59:12
问题 I want need to be done like this, but I made this after I do not know how to do it. I want understand the attributes of the IOS chart, the first picture on both sides of the column does not show completely, I would like to two columns and X axis of the label indentation, how to set up? Can who help me? Thank you! 回答1: If I understand your question, you want to see the whole width of the yellow bar for April. This should force the bar to be shown: chartView.xAxis.axisMinimum = 0.0 chartView