Search code examples
iosswift3ios-chartslinegraph

Line graph using ios charts swift 3


I am using ios chart to implement Line graph in Swift 3 . As in earlier versions of Swift, we had constructor to bind x values to Line graph, but there doesn't seems any such in Swift 3?

Kindly help if anyone has some inputs.


Solution

  • Please care to read the migration notes in Release Notes

    • All dataset constructors have changed - they do not take an array of x-indices anymore.
    • All entry constructors have changed - they take in an X and a Y.

    Basically, the x values are now taken from the entries.

    If you want to change which values are displayed on the x-axis, you can change xAxis.axisMinimum and xAxis.axisMaximum and format them using xAxis.valueFormatter.