Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Coreplot on iOS - How to remove the default padding so the chart fills the view completely without axis labels

I am trying to put 6 Coreplot charts on an iPad in landscape mode so each chart is 128pixels in height (ie. 768/6)

The issue I am having is that if I set all the padding to 0 the chart still has lots of padding around the chart being plotted.

Is there a way to remove this default padding from the chart?

Thanks in advance Damien

The pink marks in the image are the padding I want to remove

http://i.stack.imgur.com/nXzFv.png

or

http://s10.postimage.org/d2rl0ajsn/Image13.png


Here is the chart without the theme applied (The padding is still present) I added a pink border so you can see the actual size

Here is the chart without the theme applied (The padding is still present) I added a pink border so you can see the actual size

I also tried setting the padding to -20.0 and the same padding was present but the visible chart area was cutting the chart off.

There seems to be an outer frame which is setting this padding and holding the chart area..

like image 695
damien murphy. Avatar asked Apr 10 '12 09:04

damien murphy.


2 Answers

The default padding on the graph itself (not the plot area frame) is 20 pixels on each side. You can change that, too.

graph.paddingLeft = 0.0;
graph.paddingTop = 0.0;
graph.paddingRight = 0.0;
graph.paddingBottom = 0.0;
like image 200
Eric Skroch Avatar answered Sep 22 '22 13:09

Eric Skroch


HINT:

Temporarily set the background color of the different views to wild colors so that you can see the affect of various padding values.

self.graph.plotAreaFrame.backgroundColor = [[UIColor yellowColor] CGColor];

self.graph.plotAreaFrame.paddingTop = 2.0f;
self.graph.plotAreaFrame.paddingRight = 8.0f;
self.graph.plotAreaFrame.paddingBottom = 30.0f;
self.graph.plotAreaFrame.paddingLeft = 42.0f;


self.graph.backgroundColor = [[UIColor greenColor] CGColor];

self.graph.paddingTop = 2.0f;
self.graph.paddingRight = 2.0f;
self.graph.paddingBottom = 2.0f;
self.graph.paddingLeft = 2.0f;

// Tie the graph we've created with the hosting view.
self.hostingView.hostedGraph = self.graph;
self.hostingView.backgroundColor = [UIColor redColor];
like image 40
Andrew Lunde Avatar answered Sep 23 '22 13:09

Andrew Lunde