Graph with no labels or padding to fill a view

17 views
Skip to first unread message

Demitri Muna

unread,
Jan 16, 2019, 2:28:42 AM1/16/19
to coreplot-discuss
Hi,

I’m trying to create a small thumbnail of a scatter plot in a 100x100 pixel CPTGraphHostingView. Given this size, I want to eliminate all labels (numeric and otherwise), and have the axes bump up against the view. Setting

graph.paddingTop = 0
graph.paddingRight = 0

works, i.e. where there are no labels, but the left and bottom still leave room for the labels. I can get the labels to not appear (labelingPolicy = CPTAxisLabelingPolicyNone, axisLabels = nil). The left and right padding seem to need to be set to negative values, but I haven’t found a way to programmatically determine what they should be. It might be nice to keep the grid, so just being able to determine the correct offset to move the labels off the view would be great.

Thanks,
Demitri

Eric

unread,
Jan 17, 2019, 9:03:57 PM1/17/19
to coreplot-discuss
Set the padding on all four sides to zero (0) on the graph. This will eliminate the border space around the graph.

The None labeling policy makes you responsible for providing the tick locations (tick marks and grid lines) as well as the labels. If you want to use one of the other labeling policies to position the tick marks and/or grid lines, just set the label text style and/or label formatter to nil to suppress the labels.

Eric
Reply all
Reply to author
Forward
0 new messages