Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

arnieterm

macrumors regular
Original poster
Aug 28, 2008
201
0
Using CGContext functions, I am trying to plot a line graph for a particular month. In the graph we have weekdays on x-axis and respective data on y-axis. I have to plot this graph for several month in such a way that all the graphs appears inside a scrollview so that the user can scroll them.
All this requires use of CGContext method so before going into it deeply I would like to know what effect it will have on application performance?
As plotting line graph is very urgent
 

arnieterm

macrumors regular
Original poster
Aug 28, 2008
201
0
I have already created about 80% of chart. My only point of worry is as I have to show a scrollview containing UIViews on which these charts are being plooted [Each UIView will have one chart on it]. Will it cause any performance related problem as I have to create chart for each month of the year. Though I think of limiting the number of pages [UIViews with charts] to some fixed count when that count exceeds then remove those UIViews and add another set of UIViews to the scrollview. Usig a lot of CGContext methods in drawRect of UIView will cause any performance problem that is my point of worry
Thanks
Arnieterm
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
Let me get this straight. Every time you are asked to draw any part of any of these charts you draw the whole thing again? Why not cache the drawing into an image and only redraw if the underlying data changes?
 

firewood

macrumors G3
Jul 29, 2003
8,109
1,345
Silicon Valley
Why not draw only the month that's currently visible?

Look at the Accelerometer example for code that redraws 3 graphs in near real time, every frame.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.