核心情节 - 情节标签超越边界

时间:2013-07-07 08:37:11

标签: iphone ios xcode core-plot

使用Core Plot显示折线图。情节标签在边界附近(虽然不在外面)时会被切断,如下所示

enter image description here

但是,正如您在XCode Storyboard(下图)中所看到的那样,每个图形的边界远远高于(高度),并且似乎没有理由为什么图形的标签会被切割。< / p>

enter image description here

我已将图形托管视图的框架设置为与XCode中的框架大小相匹配。

    self.graphHostView = [(CPTGraphHostingView *) [CPTGraphHostingView alloc]
                          initWithFrame:CGRectMake(self.view.frame.origin.x, self.view.frame.origin.y,
                                                   self.view.frame.size.width, self.view.frame.size.height)];
    self.graph = [[CPTXYGraph alloc] initWithFrame:self.graphHostView.bounds];

另外,如何摆脱X轴(最左边的1.0和最右边的5.0)中的标签名称?

EDITED

@EricSkroch,我尝试了以下内容:

CASE 1 设置     plotAreaFrame.paddingTop = 20.0     plotAreaFrame.paddingBottom = 15.0

enter image description here

案例2     graph.paddingTop = 20.0     graph.paddingBottom = 15.0 (没有为plotAreaFrame设置任何内容)

enter image description here

CASE 3 设置上述两者(plotAreaFrame&amp; graph padding)     plotAreaFrame.paddingTop = 20.0     plotAreaFrame.paddingBottom = 15.0     graph.paddingTop = 20.0     graph.paddingBottom = 15.0

enter image description here

CASE 4 - 似乎是最好的输出! (虽然顶部仍然被裁剪) 将plotArea和amp;的顶部填充设置为0帧     graph.paddingTop = 0.0     plotAreaFrame.paddingTop = 0.0

enter image description here

CASE 5 如果我尝试增加plotAreaFrame或graph的top-padding,这就是我得到的     graph.paddingTop = 5.0

enter image description here

1 个答案:

答案 0 :(得分:2)

在图形和/或绘图区域框架(paddingLeftpaddingRight等)中添加一些填充。这将使绘图区域远离图形边缘,为标签留出空间。