How开发者_StackOverflow中文版 to draw both bar and scatter plot together? I have created object of both in viewDidLoad and the datasource also read correctly. I add it to the same plotspace. But no use!
Have you looked at the example programs? Many of them show how to add multiple plots (of the same or different types) to a single graph.
What are you seeing? Does either plot show up, or neither of them?
Just add multiple plots to graph with graph addPlot
CPTScatterPlot * sPlot = [[CPTScatterPlot alloc] init];
dataLineStyle = [CPTMutableLineStyle lineStyle];
sPlot.identifier = @"SomeIdentifier"
dataLineStyle.lineWidth = 1.0f;
dataLineStyle.lineColor = [CPTColor redColor];
sPlot.dataLineStyle = dataLineStyle;
sPlot.dataSource = self;
greenCirclePlotSymbol = [CPTPlotSymbol ellipsePlotSymbol];
greenCirclePlotSymbol.fill = [CPTFill fillWithColor:[CPTColor redColor]];
greenCirclePlotSymbol.size = CGSizeMake(5.0, 5.0);
sPlot.plotSymbol = greenCirclePlotSymbol;
[graph addPlot:sPlot];
精彩评论