ChartsOrg/Charts

IndexAxisValueFormatter behaves not as expected

appleManic opened this issue · 0 comments

These are my coordinates to draw the scatter plot

[{ "y": 83.0, "x": 0.0 },
{ "y": 73.0, "x": 15.0 },
{ "y": 63.0, "x": 30.0 }.....]

my x axis is incrementing with 15 points. 0,15,30,45,50...

If I do not use IndexAxisValueFormatter, it draws

DefaultIssue

Where as If I use IndexAxisValueFormatter with the values [0,15,30...]. It draws xAxis wrongly
problematicIssue

I'm using following chart properties. My chart is scrollable

chartView.setVisibleXRangeMinimum(3)
chartView.setVisibleXRangeMaximum(200
chartView.setScaleEnabled(false)
chartView.dragEnabled = true
chartView.scaleXEnabled = false
chartView.pinchZoomEnabled = false

//X axis
let xAxis = chartView.xAxis
xAxis.drawGridLinesEnabled = false
xAxis.drawLabelsEnabled = true
xAxis.labelPosition = .bottom

xAxis.granularity = 15

I'm suppose to change this 15, 30, 45 to Date format "hh:mm a" based on the first timestamp. I guess if the IndexAxisValueFormatter draws it correctly, date formatted string will also be correct. Please let me know what went wrong

What did you do?

ℹ Please replace this with what you did.

What did you expect to happen?

ℹ Please replace this with what you expected to happen.

What happened instead?

ℹ Please replace this with of what happened instead.

DGCharts Environment

DGCharts version/Branch/Commit Number:
Xcode version:
Swift version:
Platform(s) running DGCharts:
macOS version running Xcode:

Demo Project

ℹ Please link to or upload a project we can download that reproduces the issue.