Trying to change the padding on the graph.plotAreaFrame during the life of the graph
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()
}
}
Code here repositions the plots, but doesn't shift axes, labels, gridlines etc How to I make this work?
You can also set the padding on the
graph. This will inset everything from the edges of the graph.You don't normally need to call
updateAxisSetLayers(). Core Plot calls it internally when required.