The main plot: How to hide the plot, axis and tags?

I have a graph with the Y and X axes drawn on the default graphics space along with the main plot, and then I have separate plot spaces for auxiliary graphs, each with its own Y-axes (the X axis is the same for all sections).

I am implementing buttons to turn auxiliary graphs on and off, and I would like this to include basically the entire plot space (graph, user y axis and labels for the user y axis). It seems that there is no “hidden” property for the plot space, and all hard plot and axis have “hidden” properties, setting them to “YES” so that they display axis labels.

  • What is the best way to completely hide the plot space contents without causing more redrawing than necessary?

I suggest that one way would be to completely remove the graph and the graph from the graph, but this seems unintuitive.

+8
ios core-plot
source share
3 answers

you can also hide all shortcuts

CPTAxis *axis = someAxis; hidden = YES; axis.hidden = hidden; for (CPTAxisLabel *axisLabel in axis.axisLabels) { axisLabel.contentLayer.hidden = hidden; } 
+6
source share

Set hidden to YES on the axis you want to hide. If you use custom labels ( CPTAxisLabelingPolicyNone labeling CPTAxisLabelingPolicyNone ), just set axisLabels to nil . Set new shortcuts when you want them to reappear. For other labeling policies, set labelFormatter to nil to hide labels and designate a valid formatter if you want them to be visible.

+6
source share

You can set all axes as hidden at the axisSet level, and you can also hide labels by assigning CPTAxisLabelingPolicyNone to the labeling rules for the axes. This solution worked out well for me:

 CPTXYAxisSet *axisSet = (CPTXYAxisSet *) self.graphHostingView.hostedGraph.axisSet; axisSet.hidden = YES; CPTAxis *y = axisSet.yAxis; y.labelingPolicy = CPTAxisLabelingPolicyNone; CPTXYAxis *x = axisSet.xAxis; x.labelingPolicy = CPTAxisLabelingPolicyNone; 
+6
source share

All Articles