piaoyongren / core-plot

Automatically exported from code.google.com/p/core-plot
0 stars 0 forks source link

4 calculations for each bar? #197

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
No Step

What is the expected output? What do you see instead?
I expect, that every Bar (i use the BarChart) will be calculated once. I want 
to plot for example 1 Bar 12 times for January, February,... This works fine, 
but i've got a memory problem because the following function is called 4 times 
for each Bar: 

-(NSNumber *)numberForPlot:(CPPlot *)plot field:(NSUInteger)fieldEnum 
recordIndex:(NSUInteger)index 

I also use the ScatterPlot, and so i'm wondering why the ScatterPlot is 
calculated 2 times in NumberForPlot and the BarPlot 4 times for each Bar! (in 
some cases, i use 10 Bars, and if every Bar will calculated 4 times the app 
crashes because of memory problems)

I'm sure that there is a problem in my code, but it wouldn't help if i add my 
whole project, or whould it help? Thank you very much,

Jonathan

Original issue reported on code.google.com by Hummer10...@gmail.com on 30 Aug 2010 at 9:34

GoogleCodeExporter commented 8 years ago
For the scatterplot, -numberForPlot:field:recordIndex: will be called twice for 
each index, once for the X value and once for the Y value. Check the field 
argument to see which value is being requested. What you're seeing is correct.

The bar plot works the same way. It should query the datasource twice for each 
bar, once for the location and once for the length. If you use the plotRange 
property, it will only ask for the lengths (the locations will be computed 
automatically).

Do you have more than one bar plot in your graph? Two bar plots would make a 
total of four datasource calls at each index.

Are you calling -reloadData on the graph or any of the bar plots? That method 
causes the plot request all of its data again.

Eric

Original comment by eskr...@mac.com on 30 Aug 2010 at 9:28

GoogleCodeExporter commented 8 years ago

Original comment by drewmcco...@mac.com on 13 Oct 2010 at 10:02