ios-charts

iOS-Charts Float to Integer YAxis

拈花ヽ惹草 提交于 2019-12-18 05:56:39
问题 I'm building a chart using iOS-charts I'm trying to convert the floats into int, but iOS-charts only allows for Floats in the data entry: let result = ChartDataEntry(value: Float(month), xIndex: i) Does anyone know the method for making sure only ints are used? 回答1: You just need to adjust the NSNumberFormatter ... Example: yAxis.valueFormatter = NSNumberFormatter() yAxis.valueFormatter.minimumFractionDigits = 0 NSNumberFormatter is a very powerful class, you can do much much more with it. :-

Gradient Fill in Swift for iOS-Charts

梦想的初衷 提交于 2019-12-18 03:38:04
问题 I am trying to create a nice gradient fill as seen in the demos on the ios-charts page. However, I cannot figure this out in swift vs obj-c. Here is the obj-c code: NSArray *gradientColors = @[ (id)[ChartColorTemplates colorFromString:@"#00ff0000"].CGColor, (id)[ChartColorTemplates colorFromString:@"#ffff0000"].CGColor ]; CGGradientRef gradient = CGGradientCreateWithColors(nil, (CFArrayRef)gradientColors, nil); set1.fillAlpha = 1.f; set1.fill = [ChartFill fillWithLinearGradient:gradient angle

How to create multiple y-axis Line chart in danielgindi iOS chart?

前提是你 提交于 2019-12-13 14:11:54
问题 I want to create a graph with multiple y-axis. Duel y-axis graph is possible in danielgindi chart but I want more the two y-axis graph. Like below image: let set1 = LineChartDataSet(values: yVals1, label: "DataSet 1") set1.axisDependency = .left set1.setColor(UIColor(red: 51/255, green: 181/255, blue: 229/255, alpha: 1)) set1.setCircleColor(.white) set1.lineWidth = 2 set1.circleRadius = 3 set1.fillAlpha = 65/255 set1.fillColor = UIColor(red: 51/255, green: 181/255, blue: 229/255, alpha: 1)

iOS Charts, wavy lines

杀马特。学长 韩版系。学妹 提交于 2019-12-13 09:30:50
问题 Let's get straight to the point: I started to use iOS Charts by Daniel Gindi, but I just can't reproduce this wavy lines in my line chart (and please notice that this image is picked form the repository of iOS charts!) All I get is just this, simple straight lines with no curves And this is the code in viewDidLoad that I used for showing that: let ys1 = Array(1..<10).map { x in return sin(Double(x) / 2.0 / 3.141 * 1.5) } let ys2 = Array(1..<10).map { x in return cos(Double(x) / 2.0 / 3.141) }

ioschart not showing the linechart

不打扰是莪最后的温柔 提交于 2019-12-13 09:10:01
问题 I'm having a issue in displaying a simple linechart using ioschart library. I followed this tutorial and it works. When I try to put my data on the graph it displays correctly the grid and values on axis, but not the line. Here my code: func setChartData(xLabel: [Double], yLabel: [Double]){ let values = (0..<15).map { (i) -> ChartDataEntry in return ChartDataEntry(x: xLabel[i], y: yLabel[i]) } let set1 = LineChartDataSet(values: values, label: "DataSet") let data = LineChartData(dataSet: set1

Pie Chart entries outside slices have different position offsets

懵懂的女人 提交于 2019-12-13 03:58:02
问题 The Charts library I'm using: Daniel Gindi - Charts If you look at the above image, the position offset of entries outside each slice are variable both in distance from the slice as well as in alignment. What I want: Align the entry text to be at the center outside the slice. [Look at 1 & 3] Keep all the slice texts equidistant from the slice. [Look at 3 & 6] What I tried so far: I tried to play with valueLinePart1Length and valueLinePart2Length , but this just helped a little, didn't solve

How can I fit x-axis labels according with its bar?

夙愿已清 提交于 2019-12-12 05:49:56
问题 I am using ios-chart library and I have a CombinedBarChart in which I made zoom on it by default combinedBarChart.setScaleMinima(2, scaleY: 1) combinedBarChart.setScaleEnabled(false) I would like that each x-axis label will stay above each bar but I cannot make it work properly. Here is my example: As you can see, x-axis labels does not correspond with their bars respectively. How can I make that each x-axis label will be above of its bar? Thanks in advance! 回答1: I was not able to reproduce

chartValueSelected never gets called

时光怂恿深爱的人放手 提交于 2019-12-12 04:28:25
问题 I utilize https://github.com/danielgindi/Charts in my project. Here is my code, this is how I declare my ViewController class: class ViewController: UIViewController, ChartViewDelegate declaration of chartView @IBOutlet weak var chartView: LineChartView! inside viewDidLoad() self.chartView.delegate = self and this is how I implement delegate method func chartValueSelected(chartView: ChartViewBase, entry: ChartDataEntry, dataSetIndex: Int, highlight: Highlight) { print(dataSetIndex) } For some

PieChart for ios-charts broken in Swift 2.0?

删除回忆录丶 提交于 2019-12-12 02:28:13
问题 So I upgraded my project, and pods, to work with Swift 2.0 and Xcode 7. But now my PieChart isn't working as expected anymore. My Pies are all starting from the 0 degree angle, which means that they are all beginning in the same place, above each other. The data is added the same way as before and if I highlight them I can see that they are all there, but not originating from their respective places. Code for adding my pieChartData : var dataEntries: [ChartDataEntry] = [] var dataPoints:

Display three label on XAxis of chart

旧城冷巷雨未停 提交于 2019-12-11 12:05:48
问题 I'm using iOS Chart to display line graph in my application. I have facing one issue while display xAxis. I have following code which are used to configure chart and display data on it. import UIKit import Charts class TotalSalesVC: BaseVC { //------------------------------------------------------------------------------ // MARK:- // MARK:- Outlets //------------------------------------------------------------------------------ @IBOutlet weak var lineChartView : LineChartView! //-------------