核心图:y 轴标签最初位于外部,但随后位于图内部
我正在使用 Core-Plot 0.9,并且遇到了一个看似奇怪的问题。我有一个 XY 图,y 轴上有标签。最初显示绘图时,标签正确定位在轴本身左侧的刻度线(实际上偏移 1.0)上,这是正确的。
然后,我使用 UIPickerView 选择要显示的一组新数据,以设置 x 轴起点并重新生成绘图。在该绘图以及所有后续的绘图中,y 轴标签显示在绘图内部(轴的右侧),而不是在刻度线上(实际上向上移动了一点)。
我已经创建了我认为足够的空间 如下:
graph.paddingLeft = 0.0;
graph.plotAreaFrame.paddingLeft = 25.0;
y.labelOffset = 1.0f;
y.labelAlignment = CPTAlignmentLeft;
这是初始加载时 y 轴标签的正确表示。
在图的左侧包含 y 轴标签,我的代码 .sstatic.net/ykMG2.png" rel="nofollow noreferrer">
(来源:msyapps.com)
这是不正确的滚动左侧选取器视图并重新生成绘图后 y 轴标签的表示。
(来源:msyapps.com)
I'm using Core-Plot 0.9 and have a seemingly peculiar problem. I have an X-Y plot with labels on the y-axis. When the plot is initially displayed, the labels are correctly positioned on the tick marks (actually offset 1.0) to the left of the axis itself, which is correct.
Then, I select a new set of data to display using a UIPickerView to set the x-axis starting point and regenerate the plot. On this and all subsequent regenerations of the plot, the y-axis labels show up inside the plot (to the right of the axis) and not on the tick marks (actually shifted upwards a bit.
I have created what I think is enough room on the left hand side of the plot to contain the y-axis labels. In particular, I have code as follows:
graph.paddingLeft = 0.0;
graph.plotAreaFrame.paddingLeft = 25.0;
y.labelOffset = 1.0f;
y.labelAlignment = CPTAlignmentLeft;
Here is the correct representation of the y-axis labels on initial loading.
(source: msyapps.com)
Here is the incorrect representation of the y-axis labels after scrolling the picker view on the left and regenerating the plot.
(source: msyapps.com)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否正在更改
tickDirection
属性?这就是控制标签位于哪一侧的原因。Are you changing the
tickDirection
property? That's what controls which side the labels are on.我有一个可行的解决方案,但它违反了显示 y 轴的通常建议的操作。下面代码片段中的注释表明了我认为我在哪里偏离了约定,以及我认为我在哪里添加了一个独特的解决方案,用于在后续重绘绘图时将 y 轴固定到位。
I have a workable solution, but it violates the commonly recommended action for displaying the y-axis. The annotations in the code snippet below indicates where I think I deviated from conventions and where I think I have added a unique solution for fixing the y-axis in place on subsequent redrawing of plot.