ios-charts

Negative values not displayed in line charts using ios-charts using Swift

北城余情 提交于 2019-12-11 09:53:49
问题 I have negative values in my line chart using ios-charts. Positive values are displayed but negative values are clipped at 0. I have set the left and right axes not to start at 0 but no help. LineChart1.leftAxis.startAtZeroEnabled = false LineChart1.rightAxis.startAtZeroEnabled = false Any ideas? TIA. Code snippet below. override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. self.navigationController?.navigationBar.translucent = false self.title =

How to detect tap gesture on chart marker?

纵然是瞬间 提交于 2019-12-11 06:36:51
问题 I am using Charts to create custom graphs in an application. The one thing I am having trouble with is detecting touch events on the chart marker that is presented for the current value. I want to perform and action based on the marker that was tapped. The action should take in the data entry represented by the tapped marker. I have read through Selectable marker view & images at Y axis, but still haven't been able to produce a viable solution. It would be great if someone could provide a

iOS Charts moveViewToX does not seem to work

孤人 提交于 2019-12-11 04:19:36
问题 I am trying to move the current displayed data range. Reading the documents, it seems that I should be able to use moveViewToX function to move the left side of the view to the given x value. I made a test code that has 1 View with a button. The graph is displayed correctly when the view loads in simulator. When the button is clicked, it calls moveViewToX . However, nothing happens when I click the button (the print text is printed to console when the button is clicked, the graph view remains

Correct data not showing in ios Charts

百般思念 提交于 2019-12-11 04:13:28
问题 Im using Charts Version 3.0.1. Im currently teaching myself Swift by converting my Rails project. I have no knowledge of Objective C so please bear with me; I've done ok so far. My code below is/may not be formatted correctly as Im missing the days array in the PieChart : Numbers seem not to be correct. The code: @IBOutlet weak var chartView: PieChartView! override func viewDidLoad() { super.viewDidLoad() let days = ["Mo", "Tu", "Wed", "Thur", "Fri", "Sat", "Sun"] let gross = [11.00, 90.95,

Set an horizontal scroll to my Barchart in swift

孤人 提交于 2019-12-10 23:09:24
问题 I am using the Charts framework from Daniel Cohen Gindi which is great but: I would like my barchart to scroll horizontally to see additional data. I've tried to add a scroll view but it didn't worked. I also tried different value like barChart.setVisibleXRangeMaximum(10) barChart.moveViewToX(90) but it didn't work. Is anyone managed it ? Fingers crossed 回答1: the scroll will only happen if you zoomed in. By default, all data are plotted on the canvas, so nothing to scroll. You can try

Make line chart with values and dates

青春壹個敷衍的年華 提交于 2019-12-10 22:19:37
问题 In my app i use ios-charts library (swift alternative of MPAndroidChart). All i need is to display line chart with dates and values. Right now i use this function to display chart func setChart(dataPoints: [String], values: [Double]) { var dataEntries: [ChartDataEntry] = [] for i in 0..<dataPoints.count { let dataEntry = ChartDataEntry(value: values[i], xIndex: i) dataEntries.append(dataEntry) } let lineChartDataSet = LineChartDataSet(yVals: dataEntries, label: "Items count") let

Vertical lines at X Axis iOS-charts

╄→гoц情女王★ 提交于 2019-12-10 17:45:05
问题 Maybe this is a simple question but I wanted to know how I can draw vertical lines under X Axis and upper labels in X Axis in iOS-charts. (See the pic, like red lines) UPDATE: the library I'm using is this https://github.com/danielgindi/ios-charts 回答1: You could, but you have to override some methods, take a look at drawGridLine() and drawLabels() in x axis renderer for example. drawGridLine gives you the full details about how to draw a grid line in ios-charts, understaning it will be very

add an image for each slice in iOS-chart pieChart

假装没事ソ 提交于 2019-12-10 10:44:01
问题 I'm using ios-charts. I want to create a pie chart like below image. I have done all the confings, but I have problem with adding the image in the circle beside the values outside the circle. Can anybody help me how to to add the circles and image inside it ? UPDATED : note that the pie chart will scroll and those images should scroll with the related slices. UPDATED : I used @Aditya Garg sample code to draw images beside the position of labels, and my chart is now looks like this : I set the

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

一曲冷凌霜 提交于 2019-12-10 03:02:17
问题 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? 回答1: 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"]

How to override internal framework method in application (outside framework)

青春壹個敷衍的年華 提交于 2019-12-08 15:58:44
问题 Is there anyway to override internal framework method when subclassing in Swift? Ex. Superclass public class BarChartRenderer: ChartDataRendererBase { internal func drawDataSet(context context: CGContext, dataSet: BarChartDataSet, index: Int) { ... } } and I want to override this method to draw differently that dataSet (iOS-Charts) public class ESBarChartRenderer: BarChartRenderer { overide func drawDataSet(context context: CGContext, dataSet: BarChartDataSet, index: Int) { ... } } but when I