【问题标题】:Coreplot majorTickLocations using view coordinatesCoreplot majorTickLocations 使用视图坐标
【发布时间】:2014-01-23 21:30:35
【问题描述】:

我想在我的视图中将主要网格线与背景图像对齐,所以到目前为止我已经这样做了:

CPTXYAxisSet *axisSet = (CPTXYAxisSet *) self.hostView.hostedGraph.axisSet;
CPTAxis *x = axisSet.xAxis;
x.labelingPolicy = CPTAxisLabelingPolicyLocationsProvided;
//Other x axis config
NSMutableSet *xMajorLocations = [NSMutableSet set];
[xMajorLocations addObject:[NSNumber numberWithFloat:0.0f]];
[xMajorLocations addObject:[NSNumber numberWithFloat:341.0f]]; 
[xMajorLocations addObject:[NSNumber numberWithFloat:638.0f]];
x.majorTickLocations = xMajorLocations;

问题是主要位置与绘制的数据相关。有没有办法改用视图坐标?并且当我像CPTAxisLabelingPolicyEqualDivisions 一样缩放时,我想让它们保持静止@

【问题讨论】:

  • 你可以在背景图片中添加线条吗?
  • 我可以,但他们不会喜欢 x 轴标签,对吧?

标签: ios core-plot gridlines


【解决方案1】:

刻度位置(以及扩展的网格线位置)始终以数据坐标给出。如果您希望刻度线、网格线和标签在绘图范围更改时保持在屏幕上的同一位置,则需要使用绘图空间委托监视更改。根据需要更新代理中的刻度位置,标签将自动更新以匹配新位置。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2020-06-01
  • 1970-01-01
  • 2014-12-10
  • 2022-06-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多