【发布时间】:2019-06-25 21:52:15
【问题描述】:
从xScaleType.linear 切换到.log(或.logModulus)时遇到问题。
以下代码导致绘图在 X 方向消失,即仍然可以看到 Y 轴及其刻度,但是 X 轴消失并且在 Y 轴上看到一条数据线。仅当您平移到最左侧的 X 位置 0 时才会出现此问题。如果不为零,则没有问题。
如果我从.log 类型开始,那么一切都很好。我可以毫无问题地平移/缩放到位置 0,如果之前设置为 .linear,则会出现问题。
要重现的代码:
// Set as linear
let plotSpace = ((hostView.hostedGraph as? CPTXYGraph)?.defaultPlotSpace as? CPTXYPlotSpace)
plotSpace?.xScaleType = .linear
plotSpace?.graph?.plot(withIdentifier: plotId as NSCopying?)?.reloadData()
// Some UI user interaction to trigger next code
// Set as log (or logModulus)
plotSpace?.xScaleType = .log
plotSpace?.graph?.plot(withIdentifier: plotId as NSCopying?)?.reloadData()
// Pan to location 0(if not already there).
有人遇到过这种情况或有解决方法吗?
【问题讨论】: