【问题标题】:I need Show x and y axis major and minor line and points showing in Scatterplot on Core-plot我需要在核心图上的散点图中显示 x 和 y 轴的主要和次要线和点
【发布时间】:2012-03-27 12:48:15
【问题描述】:

我在代码下方生成散点图:

- (void)viewDidLoad
{
    [super viewDidLoad];
      [self generateDataSamples];

    CPTGraphHostingView *hostingview=[[CPTGraphHostingView alloc] initWithFrame:self.view.bounds];
    [self.view addSubview:hostingview];

    graph=[[CPTXYGraph alloc] initWithFrame:self.view.bounds];
    hostingview.hostedGraph =graph;

    CPTScatterPlot *datasourceLinePlot =[[CPTScatterPlot alloc] init];
    datasourceLinePlot.dataSource =self;

    [graph addPlot:datasourceLinePlot];

    [datasourceLinePlot release];
    [graph release];
    [hostingview release];

}

输出如下:

但是,我需要为 x 和 y 轴显示主线和次线...!

喜欢这个 y-0.5,1.0,1.5....!和 x-0.5,1.0,1.5...!

我想输出下图:

任何人都可以帮助我....!

谢谢...!

【问题讨论】:

    标签: iphone ios core-plot scatter-plot


    【解决方案1】:

    您只需要设置主要和次要刻度信息(x 轴示例如下所示):

    CPTMutableLineStyle *lineStyle = [CPTMutableLineStyle lineStyle];
    lineStyle.lineColor = [CPTColor blackColor];
    lineStyle.lineWidth = 2.0f;
    
    CPTXYAxisSet *axisSet = (CPTXYAxisSet *)graph.axisSet;
    axisSet.xAxis.axisLineStyle = lineStyle;
    axisSet.xAxis.majorTickLineStyle = lineStyle;
    axisSet.xAxis.minorTickLineStyle = lineStyle;
    axisSet.xAxis.majorIntervalLength = CPTDecimalFromString(@"5");
    axisSet.xAxis.majorTickLength = 7.0f;
    axisSet.xAxis.majorTickLength = 7.0f;
    

    【讨论】:

      猜你喜欢
      • 2021-12-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-12-08
      • 2017-11-02
      • 1970-01-01
      • 2019-07-07
      相关资源
      最近更新 更多