Reputation: 128
I am getting the error "Assignment to readonly property" when trying to assign a value to the lineColor and lineWidth of a lineStyle. What I am trying to do is set the borderLineStyle property of a pie chart to be a lineStyle with my preferences.
I have made a property and synthesized it, but am still unable to set these values.
Below is the snippet of code that is located in the same place the other pieChart properties are being set.
self.myLineStyle = [CPTLineStyle lineStyle];
self.myLineStyle.lineColor = [CPTColor whiteColor]; //Assignment to readonly property
self.myLineStyle.lineWidth = 1.0; //Assignment to readonly property
pieChart.borderLineStyle = self.myLineStyle;
The goal is to be able to adjust the spacing between slices of the pie and change their color.
I had found this link when looking for how to do this : http://code.google.com/p/core-plot/issues/detail?id=193
Unfortunately there is not much there but that it can be done using the borderLineStyle property.
Thanks in advance for any help, chances are I am overlooking something silly.
Upvotes: 1
Views: 773
Reputation: 27381
CPTLineStyle
is immutable; use a mutable line style instead:
CPTMutableLineStyle *myLineStyle = [CPTMutableLineStyle lineStyle];
myLineStyle.lineColor = [CPTColor whiteColor];
myLineStyle.lineWidth = 1.0;
pieChart.borderLineStyle = myLineStyle;
Upvotes: 2