gujjula / core-plot

Automatically exported from code.google.com/p/core-plot
0 stars 0 forks source link

Core plot not sizing the plot area appropriately for bar graph #247

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I've got a container view that holds 2 view controllers, each of which in turn 
hosts a CPGraphHostingView. The heirarchy is something like this

ContainerView - TopView - BottomView

I initialize topViewController(initWithNibName), resize the view to 70% of the 
height and add the topViewController.view to containerView subviews

Similarly for BottomView, except that the height is 30%

These 2 views now span the height of the container view.

However, the bar plot drawn in the bottom view does not respect the super views 
height coordinates and draws the bars out of range resulting in the need for a 
vertical scroll. I've also tried adjusting the plotScale post addition of 
graph, but causes me to lose some alignment.

Strangely, the scatter chart view in the top view seems to behave better and 
scales when i flip the top: bottom ratio to 3:7 from the original 7:3.

Are bar plots supposed to behave differently ? Or am i missing something here. 
Attached are the images for my issue. notice that in both cases , the top 
scatter chart seems to have scaled correctly.

Also, i tested by using the scatter chart code in the bottomViewController (to 
make sure that this wasn't some nib issue) and again with scatter chart the 
scaling seems to just work.

Thanks a lot.

Expected: Correct Sizing

Actual : bar graph not sizing correctly

OS : iOS4.2

Original issue reported on code.google.com by abhinavg...@gmail.com on 18 Jan 2011 at 9:14

Attachments:

GoogleCodeExporter commented 9 years ago
I don't see the problem to be honest. The bar plot spans the same plot range in 
all plots, as does the scatter plot. If you want the bars to be shorter, you 
need to adjust the y plot range of the CPXYPlotSpace. Or you can call 
scaleToFitPlots: on the plot space.

Core Plot leaves the plot ranges to you. It does not autoscale.

Original comment by drewmcco...@mac.com on 23 Jan 2011 at 8:29