I am trying to draw multiple scatter plots on the same graph using Core-Plot. They have the same x-axis (time), but I want them to be drawn independently of each other. For eg, for two plots, I want the screen to be divided into two parts, the upper part showing one plot and the lower part showing the other (I intend to ultimately plot a real-time multi-channel input). Something like this:
I tried modifying the tutorial given in the following link to use two plotspaces instead of one:
http://www.raywenderlich.com/13271/how-to-draw-graphs-with-core-plot-part-2
However, there is no function to set the bounds of a plotspace. The functions xRange and yRange change the range of the axes, but both the plotspaces still occupy the whole screen.
Following is a code snippet that shows two ways in which I tried to accomplish setting bounds:
-(void)configurePlots {
//Get graph and plot space
CPTGraph *graph = self.hostView.hostedGraph;
CPTXYPlotSpace *aaplPlotSpace = (CPTXYPlotSpace *)graph.defaultPlotSpace;
//**Setting xRange and yRange doesn't work**
aaplPlotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromCGFloat(0.0)
length:CPTDecimalFromCGFloat(graph.bounds.size.width)];
aaplPlotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromCGFloat(0.0)
length:CPTDecimalFromCGFloat((graph.bounds.size.height)/3)];
CPTXYPlotSpace *googPlotSpace = [[CPTXYPlotSpace alloc] init];
googPlotSpace.xRange = aaplPlotSpace.xRange;
googPlotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromCGFloat((graph.bounds.size.height)/3)
length:CPTDecimalFromCGFloat((graph.bounds.size.height)/3)];
[graph addPlotSpace:googPlotSpace];
//Create Plots
//**Trying to set bounds using initWithFrame doesn't work either**
CGRect rect = CGRectMake(0.0, 0.0, graph.bounds.size.width, graph.bounds.size.height/2);
CPTScatterPlot *aaplPlot = [[CPTScatterPlot alloc] initWithFrame:rect];
aaplPlot.dataSource = self;
aaplPlot.identifier = CPDTickerSymbolAAPL;
CPTColor *aaplColor = [CPTColor redColor];
[graph addPlot:aaplPlot toPlotSpace:aaplPlotSpace];
rect = CGRectMake(0.0, graph.bounds.size.height/2, graph.bounds.size.width, graph.bounds.size.height/2);
CPTScatterPlot *googPlot = [[CPTScatterPlot alloc] initWithFrame:rect];
googPlot.dataSource = self;
googPlot.identifier = CPDTickerSymbolGOOG;
CPTColor *googColor = [CPTColor greenColor];
[graph addPlot:googPlot toPlotSpace:googPlotSpace];
//[graph addPlot:googPlot];
//Set up Plot space
[aaplPlotSpace scaleToFitPlots:[NSArray arrayWithObject:aaplPlot]];
CPTMutablePlotRange *xaRange = [aaplPlotSpace.xRange mutableCopy];
[xaRange expandRangeByFactor:CPTDecimalFromCGFloat(1.1f)];
aaplPlotSpace.xRange = xaRange;
CPTMutablePlotRange *yaRange = [aaplPlotSpace.yRange mutableCopy];
[yaRange expandRangeByFactor:CPTDecimalFromCGFloat(1.2f)];
aaplPlotSpace.yRange = yaRange;
//Create styles and symbols
CPTMutableLineStyle *aaplLineStyle = [aaplPlot.dataLineStyle mutableCopy];
aaplLineStyle.lineWidth = 2.5;
aaplLineStyle.lineColor = aaplColor;
aaplPlot.dataLineStyle = aaplLineStyle;
CPTMutableLineStyle *aaplSymbolLineStyle = [CPTMutableLineStyle lineStyle];
aaplSymbolLineStyle.lineColor = aaplColor;
CPTPlotSymbol *aaplSymbol = [CPTPlotSymbol ellipsePlotSymbol];
aaplSymbol.fill = [CPTFill fillWithColor:aaplColor];
aaplSymbol.lineStyle = aaplSymbolLineStyle;
aaplSymbol.size = CGSizeMake(6.0f, 6.0f);
aaplPlot.plotSymbol = aaplSymbol;
CPTMutableLineStyle *googLineStyle = [googPlot.dataLineStyle mutableCopy];
googLineStyle.lineWidth = 1.0;
googLineStyle.lineColor = googColor;
googPlot.dataLineStyle = googLineStyle;
CPTMutableLineStyle *googSymbolLineStyle = [CPTMutableLineStyle lineStyle];
googSymbolLineStyle.lineColor = googColor;
CPTPlotSymbol *googSymbol = [CPTPlotSymbol starPlotSymbol];
googSymbol.fill = [CPTFill fillWithColor:googColor];
googSymbol.lineStyle = googSymbolLineStyle;
googSymbol.size = CGSizeMake(6.0f, 6.0f);
googPlot.plotSymbol = googSymbol;
}
My question is, is my current approach correct in trying to set bounds on plotspaces or do I need to draw different graphs on the same screen and set the bounds on the graphs? And how do I set bounds on plotspaces or graphs (whichever is the right way!)?
Thanks!
Related
I have a data array with values:
[1,2,4,5,7..]
and after set auto labeling policy, it will auto draw data at each point.
but there will be gap between 2 and 4, 5 and 7.
my question is how to remove this gap between each data and have a normal behavior when pinch or scale the graph, also the position of data "4" with show 4 at x axis, data "2" will show 2 at x axis.
Another problem I met is that, when I drag with in the graph, the axis segment sometimes will disappear or total axis will disappear.
(I cannot upload image, there is a copy of that in
https://github.com/core-plot/core-plot/issues/113
Thanks in advance.
here is my graph setup code:
_graph = [[CPTXYGraph alloc] initWithFrame:CGRectZero];
CPTTheme * theme = [CPTTheme themeNamed:kCPTPlainWhiteTheme];
[_graph applyTheme:theme];
[_graph setCornerRadius:0.0f];
//
_graphHost = [[CPTGraphHostingView alloc] initWithFrame:CGRectMake(0, 0, hostView.width, hostView.height)];
[_graphHost setBackgroundColor:[UIColor whiteColor]];
_dynamicPrice = [[UILabel alloc] initWithFrame:CGRectMake(10, _graphHost.height/2, 35, 10) font:[UIFont systemFontOfSize:8.0] color:[UIColor blueColor] text:#"test"];
[_dynamicPrice setBackgroundColor:[UIColor grayColor]];
[_dynamicPrice setTextAlignment:NSTextAlignmentCenter];
_dynamicPrice.layer.transform = CATransform3DMakeRotation(M_PI, 1, 0, 0);
_graphHost.hostedGraph = _graph;
[_graphHost addSubview:_dynamicPrice];
[hostView addSubview:_graphHost];
CPTMutableLineStyle *borderLineStyle = [CPTMutableLineStyle lineStyle];
borderLineStyle.lineColor = [CPTColor whiteColor];
borderLineStyle.lineWidth = 0.1f;
_graph.plotAreaFrame.borderLineStyle = nil;
_graph.plotAreaFrame.paddingTop += 10.0;
_graph.plotAreaFrame.paddingRight += 10.0;
_graph.plotAreaFrame.paddingBottom += 10.0;
_graph.plotAreaFrame.paddingLeft += 25.0;
_graph.plotAreaFrame.masksToBorder = NO;
_graph.plotAreaFrame.plotArea.delegate = self;
//
CPTMutableLineStyle *majorGridLineStyle = [CPTMutableLineStyle lineStyle];
majorGridLineStyle.lineWidth = 0.3f;
majorGridLineStyle.lineColor = [[CPTColor colorWithGenericGray:0.2] colorWithAlphaComponent:0.75];
//
CPTMutableLineStyle *minorGridLineStyle = [CPTMutableLineStyle lineStyle];
minorGridLineStyle.lineWidth = 0.1f;
minorGridLineStyle.lineColor = [[CPTColor lightGrayColor] colorWithAlphaComponent:0.1];
UIFont *labelFont = [UIFont systemFontOfSize:8.0f];
CPTTextStyle *labelStyle = [CPTTextStyle textStyleWithAttributes:#{NSFontAttributeName:labelFont, NSForegroundColorAttributeName:[UIColor blueColor]}];
// NSBackgroundColorAttributeName:[UIColor grayColor]
// Axes
CPTXYAxisSet *xyAxisSet = (id)_graph.axisSet;
CPTXYAxis *x = xyAxisSet.xAxis;
x.labelingPolicy = CPTAxisLabelingPolicyAutomatic;
x.majorIntervalLength = CPTDecimalFromDouble(60*3);
x.minorTicksPerInterval = 0;
x.majorGridLineStyle = majorGridLineStyle;
x.minorGridLineStyle = minorGridLineStyle;
x.axisConstraints = [CPTConstraints constraintWithRelativeOffset:0.0];
x.labelTextStyle = labelStyle;
//x.minorTickLabelTextStyle = labelStyle;
[self setXLabelDateFormater:_currentKLineType];
CPTXYAxis *y = xyAxisSet.yAxis;
y.labelingPolicy = CPTAxisLabelingPolicyAutomatic;
y.orthogonalCoordinateDecimal = CPTDecimalFromDouble(20);
y.majorIntervalLength = CPTDecimalFromDouble(20);
y.minorTicksPerInterval = 0;
y.majorGridLineStyle = majorGridLineStyle;
y.minorGridLineStyle = minorGridLineStyle;
y.axisConstraints = [CPTConstraints constraintWithLowerOffset:0.0];
y.labelOffset = 0.0;
y.labelTextStyle = labelStyle;
y.labelFormatter = yFormater;
// OHLC plot
CPTMutableLineStyle *redLineStyle = [CPTMutableLineStyle lineStyle];
redLineStyle.lineColor = [CPTColor redColor];
redLineStyle.lineWidth = 1.0f;
CPTMutableLineStyle *greenLineStyle = [CPTMutableLineStyle lineStyle];
greenLineStyle.lineColor = [CPTColor greenColor];
greenLineStyle.lineWidth = 1.0f;
CPTTradingRangePlot *kLineChart= [[CPTTradingRangePlot alloc] initWithFrame:_graph.bounds];
kLineChart.identifier = PLOT_KLINE;
kLineChart.lineStyle = redLineStyle;
CPTMutableTextStyle *whiteTextStyle = [CPTMutableTextStyle textStyle];
whiteTextStyle.color = [CPTColor whiteColor];
whiteTextStyle.fontSize = 12.0;
kLineChart.labelOffset = 0.0;
kLineChart.barCornerRadius = 0.0;
kLineChart.barWidth = 15.0;
kLineChart.increaseFill = [CPTFill fillWithColor:[CPTColor redColor]];
kLineChart.decreaseFill = [CPTFill fillWithColor:[CPTColor greenColor]];
kLineChart.increaseLineStyle = redLineStyle;
kLineChart.decreaseLineStyle = greenLineStyle;
kLineChart.dataSource = self;
kLineChart.delegate = self;
kLineChart.plotStyle = CPTTradingRangePlotStyleCandleStick;
[_graph addPlot:kLineChart];
CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)_graph.defaultPlotSpace;
plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(-0.5) length:CPTDecimalFromDouble(oneDay * _kLineDataItems.count)];
plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromInteger(0) length:CPTDecimalFromInteger(4)];
plotSpace.allowsUserInteraction = YES;
plotSpace.delegate = self;
[plotSpace scaleToFitPlots:[_graph allPlots]];
when I pinch or scale the graph, I will set the plot range dynamic according to the postion shown in current view port.
What I need is a sooth change when scale or pinch, and fixed major grid position.
How can I implement that effect?
The bars for a trading range plot are drawn at the x-value provided by the datasource. If you want a bar at x=3, make sure the datasource provides one. Remember that the x-value is independent of the data index.
When my scatter plot appears, I see that :
But I would like to se that :
Directly after chart loading, I want that the user see a chart with all data displaying, and not just a small piece like in the first screenshot. How can I define the original "zoom" ?
EDIT : (here's my code)
[...]
CPTGraph *graph = self.hostView.hostedGraph;
CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *) graph.defaultPlotSpace;
CPTScatterPlot *myPlot = [[CPTScatterPlot alloc] init];
myPlot.dataSource = self;
myPlot.delegate = self;
CPTColor *myColor = [CPTColor greenColor];
[graph addPlot:myPlot toPlotSpace:plotSpace];
myPlot.plotSymbolMarginForHitDetection = 10.0f;
[plotSpace scaleToFitPlots:[NSArray arrayWithObject:myPlot]];
CPTMutablePlotRange *xRange = [plotSpace.xRange mutableCopy];
[xRange expandRangeByFactor:CPTDecimalFromCGFloat(DynamicValue)];
plotSpace.xRange = xRange;
CPTMutablePlotRange *yRange = [plotSpace.yRange mutableCopy];
[yRange expandRangeByFactor:CPTDecimalFromCGFloat(DynamicValue)];
plotSpace.yRange = yRange;
[...]
Many of the Core Plot example apps use -[CPTPlotSpace scaleToFitPlots:] to adjust the plot ranges to the plot data. If you already know the data range, you set the plot space xRange and/or yRange directly when setting up the graph.
I'm learning Core Plot and I've come to draw the following graph of the sinus function with Core Plot 1.2:
As you see, the axes aren't drawn, even if I configure my axes as in the following snippet.
CPTMutableLineStyle *axisLineStyle = [CPTMutableLineStyle lineStyle];
axisLineStyle.lineWidth = 2.0f;
axisLineStyle.lineColor = [CPTColor blackColor];
CPTXYAxisSet *axisSet = (CPTXYAxisSet *)self.graph.axisSet;
axisSet.xAxis.axisLineStyle = axisLineStyle;
axisSet.yAxis.axisLineStyle = axisLineStyle;
My question is: Why the axes aren't shown? How can I force CorePlot to draw them?.
Here's the full relevant code:
-(void)viewDidLoad
{
[super viewDidLoad];
self.graph = [[CPTXYGraph alloc] initWithFrame:self.view.frame];
CPTGraphHostingView *hostingView = (CPTGraphHostingView *)self.view;
hostingView.hostedGraph = self.graph;
CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)self.graph.defaultPlotSpace;
plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(-4) length:CPTDecimalFromFloat(8)];
plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(-2.0) length:CPTDecimalFromFloat(4.0)];
CPTScatterPlot *sinusPlot = [[CPTScatterPlot alloc] initWithFrame:self.graph.frame];
sinusPlot.dataSource = self;
sinusPlot.backgroundColor = [CPTColor whiteColor].cgColor;
CPTMutableLineStyle *axisLineStyle = [CPTMutableLineStyle lineStyle];
axisLineStyle.lineWidth = 2.0f;
axisLineStyle.lineColor = [CPTColor blackColor];
CPTXYAxisSet *axisSet = (CPTXYAxisSet *)self.graph.axisSet;
axisSet.xAxis.axisLineStyle = axisLineStyle;
axisSet.yAxis.axisLineStyle = axisLineStyle;
[self.graph addPlot:sinusPlot];
}
-(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot
{
return 101;
}
-(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)idx
{
static double pi = 3.14159;
double x = pi*((((double)idx) - 51.0)/50.0);
if (fieldEnum == CPTScatterPlotFieldX)
return [NSNumber numberWithDouble:x];
else
return [NSNumber numberWithDouble:sin(x + ((x<0)?2*pi:0))];
}
Adding the following line:
self.graph.backgroundColor = [CPTColor whiteColor].cgColor;
to viewDidLoad solved the issue.
My explanation is that the axis set is a property of the CPTGraphHostingView (here self.graph), and not of the plot. I was changing the plot's layer background color instead of changing the graph's layer background color. Since the axes still had the same color as the background of their containing layer, they weren't visible.
For future reference, a simple working version of viewDidLoad, is the following:
-(void)viewDidLoad
{
[super viewDidLoad];
self.graph = [[CPTXYGraph alloc] initWithFrame:self.view.frame];
CPTGraphHostingView *hostingView = (CPTGraphHostingView *)self.view;
hostingView.hostedGraph = self.graph;
CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)self.graph.defaultPlotSpace;
plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(-4) length:CPTDecimalFromFloat(8)];
plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(-2.0) length:CPTDecimalFromFloat(4.0)];
CPTScatterPlot *sinusPlot = [[CPTScatterPlot alloc] initWithFrame:self.graph.frame];
sinusPlot.dataSource = self;
self.graph.backgroundColor = [CPTColor whiteColor].cgColor;
[self.graph addPlot:sinusPlot];
}
I hope this will help CorePlot rookies like my current self.
I have added an additional x axis to my plot space in order to show zero values:
CPTMutableLineStyle *boldLineStyle = [xAxis.axisLineStyle mutableCopy];
boldLineStyle.lineWidth = 1;
boldLineStyle.lineColor = [CPTColor darkGrayColor];
boldLineStyle.lineCap = kCGLineCapRound;
CPTXYAxis *xZeroAxis = [[CPTXYAxis alloc] init];
xZeroAxis.coordinate = CPTCoordinateX;
xZeroAxis.plotSpace = plotSpace;
xZeroAxis.axisLineStyle = boldLineStyle;
Interestingly, the labels on this axis are shown, but not the axis itself:
xZeroAxis.axisLabels = [NSSet setWithArray:naLabels];
xZeroAxis.axisConstraints = [CPTConstraints constraintWithLowerOffset:0.0];
xyAxisSet.axes = #[xAxis, xLabelAxis, yAxis, xZeroAxis];
How would I need to change my code to show the x axis?
Thank you!
x.axisLineStyle is set as follows:
CPTMutableLineStyle *axisLineStyle = [CPTMutableLineStyle lineStyle];
axisLineStyle.lineWidth = 1.0;
axisLineStyle.lineCap = kCGLineCapRound;
axisLineStyle.lineColor = [CPTColor darkGrayColor];
CPTXYAxisSet *axisSet = (CPTXYAxisSet *)graph.axisSet;
CPPTXYAxis *x = axisSet.xAxis;
x.axisLineStyle = axisLineStyle;
This seems to be a bug in the current Core Plot release. The issue has been reported here: Core Plot Issue 514
I have a parent view with 6 UIViews to which I add my core-plot charts (This is working fine but only every second chart displays for some reason!)
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
if(!chartVC1){
chartVC1 = [[ChartVC alloc] initWithIdentifier:#"plot1"];
//[chartVC1 setKPlotIdentifier:#"plot1"];
[chartVC1.view setFrame:self.Panel1.frame];
}
[self.Panel1 addSubview:chartVC1.view];
if(!chartVC3){
chartVC3 = [[ChartVC alloc] initWithIdentifier:#"plot2"];
[chartVC3.view setFrame:self.Panel3.frame];
}
[self.Panel3 addSubview:chartVC3.view];
if(!chartVC2){
chartVC2 = [[ChartVC alloc] initWithIdentifier:#"plot3"];
[chartVC2.view setFrame:self.Panel2.frame];
}
[self.Panel2 addSubview:chartVC2.view];
if(!chartVC4){
chartVC4 = [[ChartVC alloc] initWithIdentifier:#"plot4"];
[chartVC4.view setFrame:self.Panel4.frame];
}
[self.Panel4 addSubview:chartVC4.view];
if(!chartVC5){
chartVC5 = [[ChartVC alloc] initWithIdentifier:#"plot5"];
[chartVC5.view setFrame:self.Panel5.frame];
}
[self.Panel5 addSubview:chartVC5.view];
if(!chartVC6){
chartVC6 = [[ChartVC alloc] initWithIdentifier:#"plot6"];
[chartVC6.view setFrame:self.Panel6.frame];
}
[self.Panel6 addSubview:chartVC6.view];
}
Here is some of my code for the class ChartVC
-(void)renderInLayer
{
CPTXYGraph *graph = [[[CPTXYGraph alloc] initWithFrame:self.view.bounds] autorelease];
[self addGraph:graph toHostingView:self.view];
[self applyTheme:nil toGraph:graph withDefault:[CPTTheme themeNamed:kCPTDarkGradientTheme]];
//[self setTitleDefaultsForGraph:graph withBounds:self.view.bounds];
//[self setPaddingDefaultsForGraph:graph withBounds:self.view.bounds];
graph.plotAreaFrame.paddingTop = -20.0;
graph.plotAreaFrame.paddingRight = -20.0;
graph.plotAreaFrame.paddingBottom = -20.0;
graph.plotAreaFrame.paddingLeft = -20.0;
graph.plotAreaFrame.plotArea.frame = self.view.bounds;
graph.backgroundColor = [[UIColor whiteColor] CGColor];
// Grid line styles
CPTMutableLineStyle *majorGridLineStyle = [CPTMutableLineStyle lineStyle];
majorGridLineStyle.lineWidth = 0.75;
majorGridLineStyle.lineColor = [[CPTColor colorWithGenericGray:0.2] colorWithAlphaComponent:0.75];
CPTMutableLineStyle *minorGridLineStyle = [CPTMutableLineStyle lineStyle];
minorGridLineStyle.lineWidth = 0.25;
minorGridLineStyle.lineColor = [[CPTColor whiteColor] colorWithAlphaComponent:0.1];
// Axes
// X axis
CPTXYAxisSet *axisSet = (CPTXYAxisSet *)graph.axisSet;
CPTXYAxis *x = axisSet.xAxis;
x.labelingPolicy = CPTAxisLabelingPolicyAutomatic;
x.orthogonalCoordinateDecimal = CPTDecimalFromUnsignedInteger(0);
x.majorGridLineStyle = majorGridLineStyle;
x.minorGridLineStyle = minorGridLineStyle;
x.minorTicksPerInterval = 9;
//x.title = #"X Axis";
//x.titleOffset = 35.0;
NSNumberFormatter *labelFormatter = [[NSNumberFormatter alloc] init];
labelFormatter.numberStyle = NSNumberFormatterNoStyle;
x.labelFormatter = labelFormatter;
[labelFormatter release];
// Y axis
CPTXYAxis *y = axisSet.yAxis;
y.labelingPolicy = CPTAxisLabelingPolicyAutomatic;
y.orthogonalCoordinateDecimal = CPTDecimalFromUnsignedInteger(0);
y.majorGridLineStyle = majorGridLineStyle;
y.minorGridLineStyle = minorGridLineStyle;
y.minorTicksPerInterval = 3;
//y.labelOffset = 5.0;
//y.title = #"Y Axis";
//y.titleOffset = 30.0;
y.axisConstraints = [CPTConstraints constraintWithLowerOffset:0.0];
// Rotate the labels by 45 degrees, just to show it can be done.
x.labelRotation = M_PI * 0.25;
// Create the plot
CPTScatterPlot *dataSourceLinePlot1 = [[[CPTScatterPlot alloc] init] autorelease];
dataSourceLinePlot1.identifier = [self kPlotIdentifier];
//NSLog(#"set identifier: %#", [self kPlotIdentifier]);
dataSourceLinePlot1.cachePrecision = CPTPlotCachePrecisionDouble;
CPTMutableLineStyle *lineStyle1 = [[dataSourceLinePlot1.dataLineStyle mutableCopy] autorelease];
lineStyle1.lineWidth = 1.0;
lineStyle1.lineColor = [CPTColor redColor];
dataSourceLinePlot1.dataLineStyle = lineStyle1;
dataSourceLinePlot1.dataSource = self;
[graph addPlot:dataSourceLinePlot1];
// Plot space
CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)graph.defaultPlotSpace;
plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromUnsignedInteger(0) length:CPTDecimalFromUnsignedInteger(kMaxDataPoints - 1)];
plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromUnsignedInteger(0) length:CPTDecimalFromUnsignedInteger(100)];
}
I would think the issue was my own fault if only the 1st chart displayed but because every second chart displays it doesn't make any sense to me..
My only guess is it is some sort of timing issue but I debugged it and delayed the creation of each chart and it made no difference..
I even removed the 3rd, 5th charts to see if the others now rendered but the same 3 charts that did not display previously were still not visible which really threw me off.. (ie. only the 1st chart displayed out of the 4 enabled!)
Any help on this much appreciated...
I may just use the code from the Apple Developer Library that renders the accelerometer data as it is very lightweight to support 6 charts on a screen at one time without issue...
Core-Plot just doesn't seem up to the task I guess...
You didn't say which graphs aren't showing up, but since it's always the same ones, I suspect there's an issue with the view hierarchy. Try changing
`[chartVC1.view setFrame:self.Panel1.frame];`
to
`[chartVC1.view setFrame:self.Panel1.bounds];`
for each graph.