agrawalyogesh

agrawalyogesh
- Name: [not set]
- Favorite Languages: [not set]
- Website: [not set]
- Location: [not set]
- About Me: [not set]
-
Using Core Plot in an iPhone Application
11/13/2010 - 12:30
Hi,
Finally I have got the code working: The only one change that you have to do apart from look into the below code is, in the interface builder use CPGraphHostingView instead of CPLayerHostingView for your view class.
If you want to install the core-plot using sdk and not the way it is described above, then please go over the the following link
http://stackoverflow.com/questions/4146341/core-plot-configuration-error/4173170#4173170
- (void)viewDidLoad {
[super viewDidLoad];
graph = [[CPXYGraph alloc] initWithFrame: self.view.bounds];
self.view = [[CPGraphHostingView alloc]initWithFrame:[UIScreen mainScreen].bounds];
CPGraphHostingView *hostingView = (CPGraphHostingView *)self.view;
hostingView.hostedGraph = graph;
graph.paddingLeft = 20.0;
graph.paddingTop = 20.0;
graph.paddingRight = 20.0;
graph.paddingBottom = 20.0;
CPXYPlotSpace *plotSpace = (CPXYPlotSpace *)graph.defaultPlotSpace;
plotSpace.xRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(-6)
length:CPDecimalFromFloat(12)];
plotSpace.yRange = [CPPlotRange plotRangeWithLocation:CPDecimalFromFloat(-5)
length:CPDecimalFromFloat(30)];
CPLineStyle *lineStyle = [CPLineStyle lineStyle];
lineStyle.lineColor = [CPColor blackColor];
lineStyle.lineWidth = 2.0f;
CPXYAxisSet *axisSet = (CPXYAxisSet *)graph.axisSet;
axisSet.xAxis.majorIntervalLength = [[NSDecimalNumber decimalNumberWithString:@"5"] decimalValue];
axisSet.xAxis.minorTicksPerInterval = 4;
axisSet.xAxis.majorTickLineStyle = lineStyle;
axisSet.xAxis.minorTickLineStyle = lineStyle;
axisSet.xAxis.axisLineStyle = lineStyle;
axisSet.xAxis.minorTickLength = 5.0f;
axisSet.xAxis.majorTickLength = 7.0f;
// axisSet.xAxis.axisLabelOffset = 3.0f;
axisSet.yAxis.majorIntervalLength = [[NSDecimalNumber decimalNumberWithString:@"5"] decimalValue];
axisSet.yAxis.minorTicksPerInterval = 4;
axisSet.yAxis.majorTickLineStyle = lineStyle;
axisSet.yAxis.minorTickLineStyle = lineStyle;
axisSet.yAxis.axisLineStyle = lineStyle;
axisSet.yAxis.minorTickLength = 5.0f;
axisSet.yAxis.majorTickLength = 7.0f;
// axisSet.yAxis.axisLabelOffset = 3.0f;
CPScatterPlot *xSquaredPlot = [[CPScatterPlot alloc] init];
//initWithFrame:graph.defaultPlotSpace.bounds] autorelease];
xSquaredPlot.identifier = @"X Squared Plot";
xSquaredPlot.dataLineStyle.lineWidth = 1.0f;
xSquaredPlot.dataLineStyle.lineColor = [CPColor redColor];
xSquaredPlot.dataSource = self;
[graph addPlot:xSquaredPlot];
CPPlotSymbol *greenCirclePlotSymbol = [CPPlotSymbol ellipsePlotSymbol];
greenCirclePlotSymbol.fill = [CPFill fillWithColor:[CPColor greenColor]];
greenCirclePlotSymbol.size = CGSizeMake(2.0, 2.0);
xSquaredPlot.plotSymbol = greenCirclePlotSymbol;
CPScatterPlot *xInversePlot = [[CPScatterPlot alloc] init];
//initWithFrame:graph.defaultPlotSpace.bounds] autorelease];
xInversePlot.identifier = @"X Inverse Plot";
xInversePlot.dataLineStyle.lineWidth = 1.0f;
xInversePlot.dataLineStyle.lineColor = [CPColor blueColor];
xInversePlot.dataSource = self;
[graph addPlot:xInversePlot];
} -
Using Core Plot in an iPhone Application
11/12/2010 - 10:25
Hi Jimmy, How do we use this code, into our project?
-
Using Core Plot in an iPhone Application
11/11/2010 - 12:44
Hi,
I tried everything that has been said here but I am getting following error
Library not found for -lCorePlot
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 failed with exit code 1
I am using 4.2 compiler and 4.1 iOS
Please help
Thanks,
-
Using Core Plot in an iPhone Application
11/11/2010 - 12:37
Ajit, what did you do to get this working
Recent Comments