Hi i am looking for a chart where i can draw scatter plot over bar plot(line over bar chart), is it possible to draw line and bar chart in the same graph using core plot?
I tried following in order to get the same but i was not successfull.
CPTGraphHostingView *hostingView = [[CPTGraphHostingView alloc] initWithFrame:CGRectMake(0, 0, width, height)];
CPTXYGraph *graph = [[CPTXYGraph alloc] initWithFrame: hostingView.bounds];
hostingView.hostedGraph = graph;
CPTBarPlot *cptBarPlot = [[CPTBarPlot alloc] init];
cptBarPlot.fill = [CPTFill fillWithColor:color];
cptBarPlot.lineStyle = nil;
cptBarPlot.identifier = [columnSeries objectForKey:@"id"];
cptBarPlot.name = [columnSeries objectForKey:@"displayName"];
cptBarPlot.plotRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(BarInitialX) length:CPTDecimalFromDouble(xAxisLength)];
cptBarPlot.barWidth = CPTDecimalFromDouble(BarWidth);
cptBarPlot.dataSource = self;
//cptBarPlot.opacity = 0.0f;
cptBarPlot.delegate = self;
[graph addPlot:cptBarPlot];
CPTXYPlotSpace * secondPlotSpace = [[CPTXYPlotSpace alloc]init];
secondPlotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(BarInitialX) length:CPTDecimalFromDouble(xAxisLength+1)];
secondPlotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(0.0) length:CPTDecimalFromFloat(yAxisLength)];
//[graph addPlotSpace:secondPlotSpace];
CPTScatterPlot * linePlot = [[CPTScatterPlot alloc] init];
CPTMutableLineStyle * lineStyle = [CPTMutableLineStyle lineStyle];
lineStyle.lineWidth = 1.f;
lineStyle.lineColor = color;
lineStyle.dashPattern = [NSArray arrayWithObjects:[NSNumber numberWithFloat:3.0f],nil];
linePlot.dataLineStyle = lineStyle;
linePlot.identifier = [lineSeries objectForKey:@"id"];
linePlot.dataSource = self;
linePlot.name = [lineSeries objectForKey:@"displayName"];
//linePlot.plotRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(BarInitialX) length:CPTDecimalFromDouble(xAxisLength)];
[graph addPlot: linePlot];
i tried above and also tried to add the plots in differect plot space i.e. [graph addPlot:linePlot toPlotSpace:secondPlotSpace] still i was not successfull.
i think i am missing something but couldnt find it.
Thanks for help in advance.