2

enter image description hereI am using the iOS-charts library in (Swift 3) to plot my data into a scatter chart. I can do this part easily but now I am trying to get a non-linear best fit line to display too. Does the charts library have any easy functions for finding a best fit line, and if not how do I create a line from a function if a have to derive the best fit line function myself. I know how to create a line graph from data points but do not know if charts allows you to make one from a function. An example of what I'm trying to do is above. Any help is appreciated thanks.

Link to iOS-charts http://www.appcoda.com/ios-charts-api-tutorial/

Quinn
  • 89
  • 2
  • 10
  • I am not clear what you want here You want combine chart with scatter and line chart both or something else ? can you please elaborate your question ? – CodeChanger Jun 08 '17 at 08:51
  • Yes I have a scatter chart and now would like a line chart. The line chart I would like to make from a function like f(x) = x^(1/2). I do not know how to create a chart from a function instead of data points. My function I graph will be the best fit line from my scatter chart data the one above is just an example – Quinn Jun 08 '17 at 16:11
  • So in that case you can use Combine Chart for your requirement thats the best way to show line & scatter in single chart. – CodeChanger Jun 09 '17 at 06:02
  • I know how to combine charts. I don't know how to make a chart from a function instead of data points – Quinn Jun 09 '17 at 07:52
  • Make extension of Data Point and create function in that extension and call it from ur main class. – CodeChanger Jun 09 '17 at 08:51
  • Is there any sample documentation of a line graph of sin, cos, or any non-linear function for iOS-charts? – Quinn Jun 09 '17 at 16:44

0 Answers0