【问题标题】:CorePlot CPTPlotAreaFrameCorePlot CPTPlotAreaFrame
【发布时间】:2020-04-15 01:56:51
【问题描述】:

尝试在图形的生命周期内更改 graph.plotAreaFrame 上的填充

func plotConfigurationViewControllerPadding(_ plotConfigurationViewController: PlotConfigurationViewController, userSelectedPaddingChanged changed: Bool, padding: CGFloat) {
       if changed {
            thisplot.padding = padding
            graph.plotAreaFrame?.paddingTop = thisplot.padding
            graph.plotAreaFrame?.paddingBottom = thisplot.padding
            graph.plotAreaFrame?.paddingLeft = thisplot.padding
            graph.plotAreaFrame?.paddingRight = thisplot.padding
            graph.plotAreaFrame?.plotArea?.updateAxisSetLayers(for: CPTGraphLayerType.majorGridLines)
            graph.plotAreaFrame?.plotArea?.updateAxisSetLayers(for: CPTGraphLayerType.minorGridLines)
            graph.plotAreaFrame?.needsDisplayOnBoundsChange = true

            saveToDatabase()
        }
    }

此处的代码会重新定位绘图,但不会移动轴、标签、网格线等 我该如何完成这项工作?

【问题讨论】:

  • 请更具体。 “移动”轴等是什么意思?你能提供一个说明问题的屏幕截图吗?
  • 在这种情况下,移位意味着重新定位轴、标签、网格线以适应填充值的变化。

标签: core-plot


【解决方案1】:

您还可以在graph 上设置填充。这将从图的边缘插入所有内容。

您通常不需要致电updateAxisSetLayers()。 Core Plot 在需要时在内部调用它。

【讨论】:

  • 不,我不得不从头开始重新绘制整个图表
猜你喜欢
  • 2012-02-15
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多