Thanks for an awesome library, my app is using it extensively to plot stock market related data. When the app launches, I'll send a note in case you'd like to take a look.
I currently have a strange bug where the Y-axis values are being plotted incorrectly -- it looks like they're being slightly offset.

I'm not doing any custom scaling with the data. Here are the relevant code snippets below:
func setChartDefaults() {
// No data view
self.lineChartView!.noDataText = ""
self.lineChartView!.descriptionText = ""
self.lineChartView!.noDataTextDescription = ""
// Legend
self.lineChartView!.legend.enabled = false
// Interaction
self.lineChartView!.setScaleEnabled(true)
self.lineChartView!.pinchZoomEnabled = true
self.lineChartView!.doubleTapToZoomEnabled = true
// Background
self.lineChartView!.drawGridBackgroundEnabled = true
self.lineChartView!.gridBackgroundColor = UIColor.clearColor()
self.lineChartView!.backgroundColor = UIColor.clearColor()
// Borders
self.lineChartView!.borderColor = UIColor.clearColor()
self.lineChartView!.drawBordersEnabled = false
// Format x axis
self.lineChartView!.xAxis.enabled = true
self.lineChartView!.xAxis.labelPosition = .Bottom
self.lineChartView!.xAxis.drawAxisLineEnabled = false
self.lineChartView!.xAxis.drawGridLinesEnabled = false
self.lineChartView!.xAxis.labelFont = UIFont.TriggerFontSemiBold(11)
self.lineChartView!.xAxis.axisLineWidth = 1.0
self.lineChartView!.xAxis.spaceBetweenLabels = 9
self.lineChartView!.xAxis.avoidFirstLastClippingEnabled = true
// Remove left axis
self.lineChartView!.leftAxis.enabled = false
self.lineChartView!.leftAxis.drawAxisLineEnabled = false
self.lineChartView!.leftAxis.spaceTop = 0.5
self.lineChartView!.leftAxis.startAtZeroEnabled = false
self.lineChartView!.leftAxis.spaceBottom = 0.4
// Add right axis
self.lineChartView!.rightAxis.enabled = true
self.lineChartView!.rightAxis.drawAxisLineEnabled = true
self.lineChartView!.rightAxis.startAtZeroEnabled = false
self.lineChartView!.rightAxis.drawGridLinesEnabled = true
self.lineChartView!.rightAxis.drawAxisLineEnabled = false
// Format right axis font
self.lineChartView!.rightAxis.labelFont = UIFont.TriggerFontSemiBold(12)
self.lineChartView!.rightAxis.valueFormatter = NSNumberFormatter()
self.lineChartView!.rightAxis.valueFormatter?.maximumFractionDigits = 2
}
func setLineChartDataSetDefaults() { // Sets preferences
self.lineChartDataSet = LineChartDataSet()
self.lineChartData = LineChartData()
// Color of points
self.lineChartDataSet!.setColor(UIColor.TriggerWhiteColor())
// Width
self.lineChartDataSet!.lineWidth = 1.5
// Plot circles around points
self.lineChartDataSet!.highlightEnabled = false
self.lineChartDataSet!.drawCirclesEnabled = false
self.lineChartDataSet!.drawValuesEnabled = true
self.lineChartDataSet!.drawFilledEnabled = true
}
func graph(xData: [String], yData: [Double]) {
for i in 0..<ydata.count {
let dataEntry = ChartDataEntry(value: ydata[i], xIndex: i)
self.lineChartDataSet!.addEntry(dataEntry)
}
self.lineChartData!.addDataSet(self.lineChartDataSet)
for i in 0..<xdata.count {
self.lineChartData!.addXValue(NSDate.returnCustomFormattedDateString(xdata[i]))
}
self.lineChartView!.data = self.lineChartData
}
Thank you in advance for any help you can provide!
I don't see this issue on my side. And your code seems fine. What I can suggest is, try first setup up the chart, and set chartView.data at last.
If you still has the problem, could you use ChartsDemo to reproduce it and post the data set code?
Have you tried setting the axisDependency? Default ist a left dependency and I have not seen any code in the Framework to change that, if the left axis is disabled.
self.lineChartDataSet!.axisDependency = ChartYAxis.AxisDependency.Right
Oh yeah, I remember it, @adriansoghoian does not set axis dependency when he turns off left axis and enabled the right one. based on @AndreasIgelCC's comments, I believe it's the reason.
Closing
Awesome, many thanks @AndreasIgelCC! Confirming that setting the axis dependency has fixed the issue.
is there anyway to make the line chart look like IOS Stock App??
Most helpful comment
Have you tried setting the axisDependency? Default ist a left dependency and I have not seen any code in the Framework to change that, if the left axis is disabled.