5

I am able to plot a curve, but it is not smooth. In fact, it is totally distracted and wavy. Can anyone help me or suggest a method to make that curve line smooth?

Thanks in advance.

trashgod
  • 203,806
  • 29
  • 246
  • 1,045
Dhruv
  • 2,153
  • 3
  • 21
  • 45
  • Can you provide a sample of your code? What have you achieved so far? Consider revising your question with more information. – Zack Brown May 17 '12 at 08:19
  • @CaptainRedmuff : Using Set of points i managed to get curve,but they bend according to their pixel positions.. so i want that line to be straight so that it looks smooth curve,without any bend. – Dhruv May 17 '12 at 09:00
  • 3
    See this [this](http://code.google.com/p/core-plot/wiki/UsingCorePlotInApplications) and [this](http://stackoverflow.com/questions/5076622/iphone-smooth-sketch-drawing-algorithm) and [this](http://www.switchonthecode.com/tutorials/using-core-plot-in-an-iphone-application) may help you. This explain about coreplot framework. – Kapil Choubisa May 17 '12 at 09:27

1 Answers1

18

A new option was added to the Core Plot framework after the 1.0 release that draws scatter plots with a smoothed line. You'll need to get the latest code with Mercurial or wait for the next release, currently unscheduled.

plot.interpolation = CPTScatterPlotInterpolationCurved;
Eric Skroch
  • 27,381
  • 3
  • 29
  • 36
  • Google Code: http://code.google.com/p/core-plot/source/checkout See this wiki page for help with Mercurial: http://code.google.com/p/core-plot/wiki/UsingMercurial – Eric Skroch May 18 '12 at 22:46
  • I heard about Mercurial to get the smooth curve. But i am not getting how to use it?? Can anyone help ?? – Mansi Panchal Jun 07 '12 at 05:31
  • How to use Mercurial or the curved line in a scatter plot? – Eric Skroch Jun 07 '12 at 10:55
  • Hi Eric! Tried doing this, downloaded the latest source, built the library from within the associated xcodeproject and copied the file and any headers over. However, I get the following error when trying to run the new code; 'Interpolation method not supported in scatter plot'. I suppose I failed to build the new version of the .a file properly. (I also note that the size of the new .a file is about 2.4 mb compared to the 4.8mb of the binary release from CP1.0). Any pointers? :) – Setomidor Jun 24 '12 at 11:08
  • The release package is built from the "Universal Library" target which combines the device and simulator builds into one library. Your app is still linking to an old copy of the Core Plot library. Make sure your app project points to the new library. You might also need to do a clean build. – Eric Skroch Jun 24 '12 at 13:49
  • Thanks, working now after building the universal lib and adding it after cleaning out the previous version completely. :) – Setomidor Jun 25 '12 at 07:18
  • I downloaded the 1.0 zip and copied the new .a and headers to my project, but the CPTScatterPlotInterpolationCurved is nowhere to be seen - not event in the .h? – RunLoop Jul 06 '12 at 05:40
  • @RunLoop - It's not in the 1.0 release. You need to pull the latest code with Mercurial or wait for the next release (not scheduled yet). – Eric Skroch Jul 06 '12 at 11:14
  • @Eric Thanks, sorry for the noob question, but I cant seem to figure out how to build the library from the project - I have tried buiding and archiving the different targets but the .a stays red - how should I proceed please? – RunLoop Jul 08 '12 at 06:48
  • Build the "Universal Library" target. The build script will make release builds for both device and simulator and combine them into one library. The static library file will be in the "Release-universal" folder in your build folder. – Eric Skroch Jul 08 '12 at 17:05
  • I tried this.. But it doesn't seem to help.. may be some data filtering will do it.. – user739711 Sep 10 '12 at 18:10