코어 플롯으로 표시되는 간단한 산점도를 얻으 려하지만 어떤 이유로 든 선이 표시되지 않습니다. 내 대리자 메서드 은 (numberOfRecordsForPlot:
및 numberForPlot:field:recordIndex:
)이라고합니다. 여기에 내가 그래프 설정하고있어 무엇 : 내가 전에 다른 프로젝트에서 핵심 플롯을 사용하고 난 내 코드를 비교하고 내가 돈으로코어 플롯에 산점도가 표시되지 않습니다.
CPTGraphHostingView* extendedHost = [[CPTGraphHostingView alloc] initWithFrame:CGRectMake(0, extendedView.frameBottom, self.view.frameWidth, roomForScrollingComponentAndGraph - extendedForecastView.frameHeight)];
[extendedHost setBackgroundColor:backgroundColor(1.f)];
[self.view addSubview:extendedHost];
CPTXYGraph* extendedGraph = [[CPTXYGraph alloc] initWithFrame:extendedHost.bounds];
extendedGraph.paddingBottom = graphPadding;
extendedGraph.paddingLeft = graphPadding;
extendedGraph.paddingRight = graphPadding;
extendedGraph.paddingTop = graphPadding;
CPTXYPlotSpace* extendedPlotSpace = (CPTXYPlotSpace*)extendedGraph.defaultPlotSpace;
extendedPlotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromInt(0) length:CPTDecimalFromInt(20)];
extendedPlotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromInt(0) length:CPTDecimalFromInt(100)];
[extendedGraph applyTheme:[CPTTheme themeNamed:kCPTDarkGradientTheme]];
CPTXYAxisSet* extendedAxisSet = (CPTXYAxisSet*)extendedGraph.axisSet;
CPTXYAxis* extendedX = extendedAxisSet.xAxis;
extendedX.minorTicksPerInterval = 0;
extendedX.titleTextStyle = style;
extendedX.orthogonalCoordinateDecimal = CPTDecimalFromInt(0);
NSMutableArray* extendedMajorTicks = [[NSMutableArray alloc] init];
for(int idx = 0; idx < 14; idx++) {
[extendedMajorTicks addObject:@(idx)];
}
extendedX.majorTickLocations = [NSSet setWithArray:extendedMajorTicks];
extendedX.labelingPolicy = CPTAxisLabelingPolicyLocationsProvided;
extendedX.delegate = self;
CPTXYAxis* extendedY = extendedAxisSet.yAxis;
extendedY.preferredNumberOfMajorTicks = 4;
extendedY.minorTicksPerInterval = 1;
extendedY.labelingPolicy = CPTAxisLabelingPolicyEqualDivisions;
extendedY.titleTextStyle = style;
extendedY.orthogonalCoordinateDecimal = CPTDecimalFromInt(0);
extendedY.delegate = self;
CPTScatterPlot* extendedPlot = [[CPTScatterPlot alloc] init];
extendedPlot.delegate = self;
CPTMutableLineStyle *extendedLineStyle = [CPTMutableLineStyle lineStyle];
extendedLineStyle.lineJoin = kCGLineJoinRound;
extendedLineStyle.lineCap = kCGLineCapRound;
extendedLineStyle.miterLimit = 2.f;
extendedLineStyle.lineWidth = 2.f;
extendedLineStyle.lineColor = [CPTColor colorWithCGColor:[UIColor whiteColor].CGColor];
extendedPlot.dataLineStyle = extendedLineStyle;
extendedPlot.dataSource = self;
extendedPlot.title = @"Extended";
_extendedPlot = extendedPlot;
[extendedGraph addPlot:extendedPlot];
_extendedGraph = extendedGraph;
[extendedHost setHostedGraph:_extendedGraph];
나는 기분을 내가 부족 것을 작은 뭔가 '있어 나는 중요한 무엇인가 놓치고 있다고 생각하지 않지만 슬프 도다.
플롯 공간 범위가 플롯 데이터를 둘러싸고 있습니까? 기본 범위는 x와 y 둘 다 [0, 1]입니다. –
이전에는 그렇게하지 않았지만 플롯 공간 범위를 추가 한 후 (위 코드를 편집했는데 범위가 플롯이 하단 근처에 생성 된 후에 설정 됨) 아무 변화가 없습니다. 데이터는 다양하지만 내가 게시 한 범위 안에 들어 있다는 것을 알고 있습니다. –