I've had a pretty good look around for an answer to this, and tried several solutions in my code, nothing found so far.
I have a line graph that I am plotting, a CPTScatterPlot
graph, and I have got points adding to it correctly. I want to show each of these points as a dot about 3-5 pixels in diameter, and connected by lines that are about 3 pixels wide. This all works fine.
The problem is that when the plot is a straight along one of the edges of the graph hosting view, the lines and dots are clipped and don't look right at all.
This is a mockup of what it should look like:
And this is the effect I am seeing much of the time at the moment:
I apologise for the small images, but hopefully you can see that in the second one, the line and dots are rendered only a few pixels into the graph view, not fully in view. In the second one the data is actually at y=1 for the first 75%, then falls down to y=0.
How can I inset the drawing of the graph components by several pixels to prevent the clipping of any shapes?
So far:
I have tried setting the padding on the graph, but that just contracts the area it draws to, I suppose to make room for titles which I am not using.
I have also tried adding to the min/max x/y range settings which I recalculate based on the data I am updating in the background. This works, but obviously only if the amount I add to those values is correct in relation to the drawing scale that will be used for the data values I am inputting.
I am on Mac OS using NSView (actually CPTGraphHostingView) so
clipsToBounds
isn't available. Also, I triedmasksToBounds
andmasksToBorder
on CPTXYGraph.