Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LineChartView] Issues with circles positions #4200

Closed
nastasiupta opened this issue Oct 29, 2019 · 1 comment
Closed

[LineChartView] Issues with circles positions #4200

nastasiupta opened this issue Oct 29, 2019 · 1 comment

Comments

@nastasiupta
Copy link

nastasiupta commented Oct 29, 2019

[*] I've read, understood, and done my best to follow the *CONTRIBUTING guidelines.

What did you do?

lineChartView?.xAxis.labelPosition = .bottom
lineChartView?.xAxis.valueFormatter = self
lineChartView?.xAxis.labelTextColor = Color.main.color
lineChartView?.xAxis.labelFont = AppFonts.regular.font.withSize(7)
lineChartView?.xAxis.gridColor = UIColor(red: 224.0/255.0, green: 231.0/255.0, blue: 255.0/255.0, alpha: 1.0)
lineChartView?.leftAxis.labelTextColor = Color.main.color
lineChartView?.leftAxis.labelFont = AppFonts.regular.font.withSize(9)
lineChartView?.leftAxis.gridColor = UIColor(red: 224.0/255.0, green: 231.0/255.0, blue: 255.0/255.0, alpha: 1.0)
lineChartView?.leftAxis.axisMinimum = 0
lineChartView?.rightAxis.enabled = false
lineChartView?.legend.enabled = false
lineChartView?.isUserInteractionEnabled = false
var dataEntries: [ChartDataEntry] = []
for i in 0 ..< viewModel.values.count {
let dataEntry = ChartDataEntry(x: Double(i), y: Double(viewModel.values[i]))
dataEntries.append(dataEntry)
}
let lineDataSet = LineChartDataSet(entries: dataEntries)
lineDataSet.colors = [viewModel.graphColor]
lineDataSet.lineWidth = 2.0
lineDataSet.circleRadius = 4.0
lineDataSet.circleColors = [viewModel.graphColor]
let chartData = LineChartData(dataSet: lineDataSet)
lineChartView?.data = chartData

What did you expect to happen?

See each bubble, aligned with the X-axis line, not delayed as we have here:
Only the first one is having the position correct:
Screenshot 2019-10-29 at 14 48 16

What happened instead?

The 2nd, 3rd and 4th position is wrong

Also,
func stringForValue(_ value: Double, axis: AxisBase?) -> String

value: Double is having the value 0.3, 0.6, 1.3 :| instead of 0, 1, 2, 3 etc

Charts Environment

Charts version/Branch/Commit Number: 3.4.0
Xcode version: 11.1 (11A1027)
Swift version: 5.0
Platform(s) running Charts: iPhone X iOS 13.1
macOS version running Xcode: macOS Catalina 10.15

@liuxuan30
Copy link
Member

liuxuan30 commented Nov 5, 2019

I suggest you take a look at ChartsDemo. This looks like your data issue, as the x axis label value and circle x value is not the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants