I have created a CPTXYGraph using Core Plot in Swift. The graph works just fine. Now I am trying to add a legend. I have looked at several examples and come up with the following to create the legend:
var theLegend=CPTLegend(graph: graph)
var legendFill=CPTFill(color: CPTColor.blueColor())
theLegend.fill = legendFill
var legendLineStyle = CPTMutableLineStyle()
legendLineStyle.lineColor = CPTColor.whiteColor()
theLegend.borderLineStyle = legendLineStyle
theLegend.cornerRadius = 2.0
theLegend.swatchSize = CGSizeMake(15.0, 15.0)
graph.legend = theLegend
graph.legendAnchor = CPTRectAnchor.TopLeft
graph.legendDisplacement = CGPointMake(100.0, -100.0)
When I run this, I get a blue square with slightly rounded corners that appears to be about 10 X 10 pixels. I tried setting the frame just to see if it would make a difference:
theLegend.frame = CGRectMake(0, 0, 200, 200)
This did not change anything.
Has anyone had any success with this in Swift?