Core Plot Delegate函数未被调用

时间:2013-03-13 18:05:13

标签: objective-c core-plot

我一直试图将这些数据放到我的图表上,我可以看到轴但我无法使用CorePlot的这些委托函数将数据显示到图表上。首先,由于某些原因,它们没有被调用...我已将CPTPlotDataSource包含在我的.h文件中,并且已将其包含在我的.m文件中

- ( void ) reloadData {

    if ( !graph ) {

        graph = [[CPTXYGraph alloc] initWithFrame: CGRectMake(0,0,320,220)];

        CPTScatterPlot *dataSourceLinePlot = [[CPTScatterPlot alloc] initWithFrame: graph.bounds];

        CPTMutableLineStyle *lineStyle = [dataSourceLinePlot.dataLineStyle mutableCopy];
        lineStyle.lineWidth              = 1.f;
        lineStyle.lineColor              = [CPTColor redColor];
        dataSourceLinePlot.dataLineStyle = lineStyle;

        dataSourceLinePlot.dataSource = self;
        [graph addPlot: dataSourceLinePlot];

    }

    graphHost.hostedGraph = graph;

    CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)graph.defaultPlotSpace;
    plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(0.0) length:CPTDecimalFromDouble(5)];
    plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromDouble(0.0) length:CPTDecimalFromDouble(1010)];

    [graph reloadData];

}

这些是未被调用的函数....我对它们进行了NSLogging并且没有打印任何内容

    -(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot
    -(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index

我错过了什么?

0 个答案:

没有答案