piaoyongren / core-plot

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

Setting xRange with a large location slows down graph loading. #171

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I want to create a Date graph. 
here I set xRange:
NSDate *upperTime = [NSDate date];
NSDate *lowerTime = [upperTime addTimeInterval:-kMinute];
double xMin = [lowerTime timeIntervalSince1970]; !!!! large number !!!!
double xMax = [upperTime timeIntervalSince1970];
double length = xMax - xMin;
CPPlotRange *xRange = [CPPlotRange 
plotRangeWithLocation:CPDecimalFromDouble(xMin) 
length:CPDecimalFromDouble(length)];
defaultPlotSpace.xRange = xRange;

the problem is that when I’m using a large number for plotRange.location it 
significantly slows down graph loading.

Original issue reported on code.google.com by Yakubovi...@gmail.com on 8 Jul 2010 at 10:36

GoogleCodeExporter commented 8 years ago
The range location shouldn't matter, but the length does. What value are you 
using for kMinute?

What are you using for majorIntervalLength? If the majorIntervalLength is too 
short, the axis might be trying to generate thousands of major tick marks 
and/or labels which would definitely take some time.

Original comment by eskr...@mac.com on 9 Jul 2010 at 12:27

GoogleCodeExporter commented 8 years ago
You are right. The hold-up is in 
CPAxis::tickLocationsBeginningAt:increasing:majorTickLocations:minorTickLocation
s function. The solution works for me is changing the labelingPolicy.
I didn’t set up majorIntervalLength. I want the plot space range length to be 
quite small, but the range location to be large (because of converting current 
time to seconds from 1970 year). Will setting majorIntervalLength could anyhow 
solve this problem? Thank you.

Original comment by Yakubovi...@gmail.com on 9 Jul 2010 at 8:19

GoogleCodeExporter commented 8 years ago
kMinute is just 60. xMin and xMax are seconds from 1970

Original comment by Yakubovi...@gmail.com on 9 Jul 2010 at 8:21

GoogleCodeExporter commented 8 years ago
I think this was fixed recently. See revision 5f5f1734a0. Pull the latest 
source and let us know if you're still having the problem.

You'll still get 61 major tick marks and labels, but it should be much faster. 
Increase the majorIntervalLength to reduce the number of ticks. You might try 
something like 10 to start with (it defaults to one).

Original comment by eskr...@mac.com on 9 Jul 2010 at 12:04

GoogleCodeExporter commented 8 years ago
Yes. this bug is fixed already. thanks you

Original comment by Yakubovi...@gmail.com on 14 Jul 2010 at 12:48

GoogleCodeExporter commented 8 years ago

Original comment by drewmcco...@mac.com on 14 Jul 2010 at 1:50