ios-charts

iOS Charts - single values not showing Swift

a 夏天 提交于 2019-12-06 06:12:23
When I have multiple points in an array for a line on a line graph, everything shows perfectly. But when there is only one point, the dot does not show. I dont know why? the delegate is being set elsewhere, but this doesnt seem to be the issue. The below examples shows Test 2 and Test exercise. The first image is where each has one value, the second they each have 2. heres my code func startChart(){ chart.dragEnabled = true chart.legend.form = .circle chart.drawGridBackgroundEnabled = false let xaxis = chart.xAxis xaxis.valueFormatter = axisFormatDelegate xaxis.labelCount = dataSets.count

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

别说谁变了你拦得住时间么 提交于 2019-12-05 11:22:55
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: [BarChartDataEntry] = [] for i in 0..<dataPoints.count { let dataEntry = BarChartDataEntry(x: Double

Different colors for bars in BarChart depend on value

眉间皱痕 提交于 2019-12-05 05:41:34
How can I change the color of a single bar, dependent on its value, in a bar chart? For example: I have five different values (= five different bars) in my bar chart. All bars that have a value less than 30 should be red, all bars between 30 and 70 orange, and all bars above 70 should be green. In ios-charts, the colors of the bars are set in an array. If your dataset is called barChartDataset, for example, you would set the colors like this barChartDataset.colors = [UIColor.red,UIColor.orange,UIColor.green,UIColor.black,UIColor.blue] The bars will have these colors in this order and will

How to remove the value label above each bar in bar chart for ios-charts

走远了吗. 提交于 2019-12-05 03:32:59
Each bar has a value above it, but whenever I get too many data entries graphed, these values are spilling over into each other and making themselves unreadable. The only way to edit these that I could find was setting them to either above or below each bar. However I would like to hide them completely. How do I do this in swift? There is a method called setDrawValues which allows you to enable or disable the label text. Here an example in Swift with LineChart: xValues = ["1","2"] yValues = [54.0, 42.0] var dataEntries: [ChartDataEntry] = [] for i in 0..<xValues.count { let dataEntry =

bitcode bundle could not be generated because iOS Charts

夙愿已清 提交于 2019-12-04 22:45:59
I make app with 3d library iOS-Charts . But I get the error bitcode bundle could not be generated because was built without full bitcode. from today widget. I installed it with help Carthage and I did all the instructions. I do not know how can I fix it? I made the following screenshot from today widget target. David Cheung Please check this SO thread and see if adding the -fembed-bitcode flag in build settings works for you. iOS library to BitCode Please try to change Enable Bitcode to No in Build Settings. 来源: https://stackoverflow.com/questions/34666247/bitcode-bundle-could-not-be-generated

How to set space between x axis labels in IOS Charts?

血红的双手。 提交于 2019-12-04 21:42:10
I have been facing this problem for a long time. I wish to set equal space between the x-axis labels in my ios chart. I referred to this solution and applied the code as lineChartView.xAxis.avoidFirstLastClippingEnabled = true , but it didn't work out. Then I did set the value to be false then it gave me somewhat equal spacing but now my first and last x-axis label is being hidden in the chart. Please help me out with this solution.Here is the code for the line chart customization: func setXaxis(){ lineChartView.xAxis.labelPosition = .bottom lineChartView.xAxis.avoidFirstLastClippingEnabled =

iOS-Charts How to put UIImage beside a point

≡放荡痞女 提交于 2019-12-04 19:15:39
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 = lineChartView.getPosition(dataEntries[i], axis: .Left) let image = UIImage(named: numbers[i]) let imageView =

Stacked bar chart with charts in Swift

拜拜、爱过 提交于 2019-12-04 18:54:58
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 = "" var months: [String]! override func viewDidLoad() { super.viewDidLoad() months = [receivedDate1,

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

别来无恙 提交于 2019-12-04 12:19:28
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 func viewDidLoad() { super.viewDidLoad() setChart(months, yValuesLineChart: unitsSold, yValuesBarChart:

iOS Charts ValueFormatter

我与影子孤独终老i 提交于 2019-12-04 12:11:27
I am using iOS charts plugin (line chart) and wish to style the chart values (the number above each point) to a decimal number. The value is a double, but charts by default is rounding it and displaying it as an integer. I have tried the following but not working: let valueformatter = NumberFormatter() valueformatter.numberStyle = .decimal valueformatter.locale = Locale.current lineChartDataSet.valueFormatter = valueformatter as? IValueFormatter I have tried various other properties but non of them change the format of the number in the dataset. How can I change the format of the displayed