0
votes

I want to add Core Plot Touch to my project. I found this tutorial: http://www.switchonthecode.com/tutorials/using-core-plot-in-an-iphone-application

However, I've downloaded the newest version of CorePlotTouch and it seems that some things have changed because I can't set all of the properties. I receive plenty of errors which say that property is readonly.

For example:

CPTScatterPlot *xSquaredPlot = [[CPTScatterPlot alloc] 
                                    initWithFrame:graph.bounds];


    xSquaredPlot.dataLineStyle.lineColor = [CPTColor redColor];
    xSquaredPlot.dataLineStyle.lineWidth = 1.0f;

Both lineColor and lineWidth are readonly properties and I can't find different way of changing them. So how can I change line's color or width?

1

1 Answers

4
votes

You need to create a CPTMutableLineStyle object and set its properties.

CPTScatterPlot *xSquredPlot = [[CPTScatterPlot alloc] init];
CPTMutableLineStyle *lineStyle = [CPTMutableLineStyle lineStyle];
lineStyle.lineWidth = 1.0f;
lineStyle.lineColor = [CPTColor redColor];
xSquredPlot.dataLineStyle = lineStyle;