iphone - 核心图 - 超出边界的图标签

标签 iphone ios xcode core-plot

我使用 Core Plot 来显示折线图。当绘图的标签靠近(但不在边界之外)边界时,它会被剪切,如下所示

enter image description here

不过,正如您在 XCode Storyboard(下图)中看到的那样,每个图形的边框都远高于(高度),并且似乎没有理由为什么绘图的标签被剪切。

enter image description here

我已将图形托管 View 的框架设置为与 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)?

已编辑

@EricSkroch,我尝试了以下方法:

案例 1 环境 绘图区域框架.paddingTop=20.0 plotAreaFrame.paddingBottom=15.0

enter image description here

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

enter image description here

案例 3 设置上述两项(plotAreaFrame 和图形填充) 绘图区域框架.paddingTop=20.0 绘图区域框架.paddingBottom=15.0 图.paddingTop=20.0 graph.paddingBottom=15.0

enter image description here

案例 4 - 似乎是最好的输出! (虽然顶部仍然被裁剪) 将绘图区域和框架的顶部填充设置为 0 图.paddingTop=0.0 plotAreaFrame.paddingTop=0.0

enter image description here

案例 5 如果我尝试增加plotAreaFrame或图形的顶部填充,这就是我得到的 graph.paddingTop=5.0

enter image description here

最佳答案

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

关于iphone - 核心图 - 超出边界的图标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17510516/

相关文章:

ios - 如何使用 collectionView 自动滑动图像

ios - 某些代码未在从另一个 ViewController 调用的方法中执行

ios - 从 'int *' 分配到 'int' 的指针转换不兼容的整数

xcode - iTunesConnect (OSX) 无法识别 CFBundleLocalizations 中的本地化内容

ios - 通过 CloudKit 将 iCloud 用于用户偏好设置

iphone - AFNetworking : How to know if response is using cache or not ? 304 或 200

iphone - 如何在 MKCircle on Map 中以米为单位显示半径

ios - 防止 iOS App Extension 中的屏幕变暗

ios - popViewController(动画 : true) animation works slow

iphone - UIView 调整大小动画故障