@@ -31,9 +31,9 @@ -(void)viewDidAppear:(BOOL)animated
3131 // Add a rotation animation
3232 CABasicAnimation *rotation = [CABasicAnimation animationWithKeyPath: @" transform.rotation" ];
3333 rotation.removedOnCompletion = YES ;
34- rotation.fromValue = [NSNumber numberWithFloat :M_PI * 5 ];
35- rotation.toValue = [NSNumber numberWithFloat :0 .0f ];
36- rotation.duration = 1 .0f ;
34+ rotation.fromValue = [NSNumber numberWithDouble :M_PI * 5 ];
35+ rotation.toValue = [NSNumber numberWithDouble :0.0 ];
36+ rotation.duration = 1.0 ;
3737 rotation.timingFunction = [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseOut ];
3838 rotation.delegate = self;
3939 [piePlot addAnimation: rotation forKey: @" rotation" ];
@@ -56,15 +56,15 @@ -(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOr
5656{
5757 if ( UIInterfaceOrientationIsLandscape (fromInterfaceOrientation) ) {
5858 // Move the plots into place for portrait
59- scatterPlotView.frame = CGRectMake (20 .0f , 55 .0f , 728 .0f , 556 .0f );
60- barChartView.frame = CGRectMake (20 .0f , 644 .0f , 340 .0f , 340 .0f );
61- pieChartView.frame = CGRectMake (408 .0f , 644 .0f , 340 .0f , 340 .0f );
59+ scatterPlotView.frame = CGRectMake (20.0 , 55.0 , 728.0 , 556.0 );
60+ barChartView.frame = CGRectMake (20.0 , 644.0 , 340.0 , 340.0 );
61+ pieChartView.frame = CGRectMake (408.0 , 644.0 , 340.0 , 340.0 );
6262 }
6363 else {
6464 // Move the plots into place for landscape
65- scatterPlotView.frame = CGRectMake (20 .0f , 51 .0f , 628 .0f , 677 .0f );
66- barChartView.frame = CGRectMake (684 .0f , 51 .0f , 320 .0f , 320 .0f );
67- pieChartView.frame = CGRectMake (684 .0f , 408 .0f , 320 .0f , 320 .0f );
65+ scatterPlotView.frame = CGRectMake (20.0 , 51.0 , 628.0 , 677.0 );
66+ barChartView.frame = CGRectMake (684.0 , 51.0 , 320.0 , 320.0 );
67+ pieChartView.frame = CGRectMake (684.0 , 408.0 , 320.0 , 320.0 );
6868 }
6969}
7070
@@ -101,30 +101,30 @@ -(void)constructScatterPlot
101101 // Setup plot space
102102 CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)graph.defaultPlotSpace ;
103103 plotSpace.allowsUserInteraction = YES ;
104- plotSpace.xRange = [CPTPlotRange plotRangeWithLocation: CPTDecimalFromFloat (1.0 ) length: CPTDecimalFromFloat (2.0 )];
105- plotSpace.yRange = [CPTPlotRange plotRangeWithLocation: CPTDecimalFromFloat (1.0 ) length: CPTDecimalFromFloat (3.0 )];
104+ plotSpace.xRange = [CPTPlotRange plotRangeWithLocation: CPTDecimalFromDouble (1.0 ) length: CPTDecimalFromDouble (2.0 )];
105+ plotSpace.yRange = [CPTPlotRange plotRangeWithLocation: CPTDecimalFromDouble (1.0 ) length: CPTDecimalFromDouble (3.0 )];
106106
107107 // Axes
108108 CPTXYAxisSet *axisSet = (CPTXYAxisSet *)graph.axisSet ;
109109 CPTXYAxis *x = axisSet.xAxis ;
110- x.majorIntervalLength = CPTDecimalFromString ( @" 0.5" );
111- x.orthogonalCoordinateDecimal = CPTDecimalFromString ( @" 2 " );
110+ x.majorIntervalLength = CPTDecimalFromDouble ( 0.5 );
111+ x.orthogonalCoordinateDecimal = CPTDecimalFromDouble ( 2.0 );
112112 x.minorTicksPerInterval = 2 ;
113113 NSArray *exclusionRanges = [NSArray arrayWithObjects:
114- [CPTPlotRange plotRangeWithLocation: CPTDecimalFromFloat (1.99 ) length: CPTDecimalFromFloat (0.02 )],
115- [CPTPlotRange plotRangeWithLocation: CPTDecimalFromFloat (0.99 ) length: CPTDecimalFromFloat (0.02 )],
116- [CPTPlotRange plotRangeWithLocation: CPTDecimalFromFloat (2.99 ) length: CPTDecimalFromFloat (0.02 )],
114+ [CPTPlotRange plotRangeWithLocation: CPTDecimalFromDouble (1.99 ) length: CPTDecimalFromDouble (0.02 )],
115+ [CPTPlotRange plotRangeWithLocation: CPTDecimalFromDouble (0.99 ) length: CPTDecimalFromDouble (0.02 )],
116+ [CPTPlotRange plotRangeWithLocation: CPTDecimalFromDouble (2.99 ) length: CPTDecimalFromDouble (0.02 )],
117117 nil ];
118118 x.labelExclusionRanges = exclusionRanges;
119119
120120 CPTXYAxis *y = axisSet.yAxis ;
121- y.majorIntervalLength = CPTDecimalFromString ( @" 0.5" );
121+ y.majorIntervalLength = CPTDecimalFromDouble ( 0.5 );
122122 y.minorTicksPerInterval = 5 ;
123- y.orthogonalCoordinateDecimal = CPTDecimalFromString ( @" 2 " );
123+ y.orthogonalCoordinateDecimal = CPTDecimalFromDouble ( 2.0 );
124124 exclusionRanges = [NSArray arrayWithObjects:
125- [CPTPlotRange plotRangeWithLocation: CPTDecimalFromFloat (1.99 ) length: CPTDecimalFromFloat (0.02 )],
126- [CPTPlotRange plotRangeWithLocation: CPTDecimalFromFloat (0.99 ) length: CPTDecimalFromFloat (0.02 )],
127- [CPTPlotRange plotRangeWithLocation: CPTDecimalFromFloat (3.99 ) length: CPTDecimalFromFloat (0.02 )],
125+ [CPTPlotRange plotRangeWithLocation: CPTDecimalFromDouble (1.99 ) length: CPTDecimalFromDouble (0.02 )],
126+ [CPTPlotRange plotRangeWithLocation: CPTDecimalFromDouble (0.99 ) length: CPTDecimalFromDouble (0.02 )],
127+ [CPTPlotRange plotRangeWithLocation: CPTDecimalFromDouble (3.99 ) length: CPTDecimalFromDouble (0.02 )],
128128 nil ];
129129 y.labelExclusionRanges = exclusionRanges;
130130
@@ -133,7 +133,7 @@ -(void)constructScatterPlot
133133 dataSourceLinePlot.identifier = @" Green Plot" ;
134134
135135 CPTMutableLineStyle *lineStyle = [dataSourceLinePlot.dataLineStyle mutableCopy ];
136- lineStyle.lineWidth = 3 .f ;
136+ lineStyle.lineWidth = 3.0 ;
137137 lineStyle.lineColor = [CPTColor greenColor ];
138138 lineStyle.dashPattern = [NSArray arrayWithObjects: [NSNumber numberWithFloat: 5 .0f ], [NSNumber numberWithFloat: 5 .0f ], nil ];
139139 dataSourceLinePlot.dataLineStyle = lineStyle;
@@ -143,18 +143,18 @@ -(void)constructScatterPlot
143143 // Put an area gradient under the plot above
144144 CPTColor *areaColor = [CPTColor colorWithComponentRed: 0.3 green: 1.0 blue: 0.3 alpha: 0.8 ];
145145 CPTGradient *areaGradient = [CPTGradient gradientWithBeginningColor: areaColor endingColor: [CPTColor clearColor ]];
146- areaGradient.angle = -90 .0f ;
146+ areaGradient.angle = -90.0 ;
147147 CPTFill *areaGradientFill = [CPTFill fillWithGradient: areaGradient];
148148 dataSourceLinePlot.areaFill = areaGradientFill;
149- dataSourceLinePlot.areaBaseValue = CPTDecimalFromString ( @" 1.75" );
149+ dataSourceLinePlot.areaBaseValue = CPTDecimalFromDouble ( 1.75 );
150150
151151 // Animate in the new plot, as an example
152- dataSourceLinePlot.opacity = 0 .0f ;
152+ dataSourceLinePlot.opacity = 0.0 ;
153153 dataSourceLinePlot.cachePrecision = CPTPlotCachePrecisionDecimal;
154154 [graph addPlot: dataSourceLinePlot];
155155
156156 CABasicAnimation *fadeInAnimation = [CABasicAnimation animationWithKeyPath: @" opacity" ];
157- fadeInAnimation.duration = 1 .0f ;
157+ fadeInAnimation.duration = 1.0 ;
158158 fadeInAnimation.removedOnCompletion = NO ;
159159 fadeInAnimation.fillMode = kCAFillModeForwards ;
160160 fadeInAnimation.toValue = [NSNumber numberWithFloat: 1.0 ];
@@ -165,8 +165,8 @@ -(void)constructScatterPlot
165165 boundLinePlot.identifier = @" Blue Plot" ;
166166
167167 lineStyle = [boundLinePlot.dataLineStyle mutableCopy ];
168- lineStyle.miterLimit = 1 .0f ;
169- lineStyle.lineWidth = 3 .0f ;
168+ lineStyle.miterLimit = 1.0 ;
169+ lineStyle.lineWidth = 3.0 ;
170170 lineStyle.lineColor = [CPTColor blueColor ];
171171
172172 boundLinePlot.dataSource = self;
@@ -177,7 +177,7 @@ -(void)constructScatterPlot
177177 // Do a blue gradient
178178 CPTColor *areaColor1 = [CPTColor colorWithComponentRed: 0.3 green: 0.3 blue: 1.0 alpha: 0.8 ];
179179 CPTGradient *areaGradient1 = [CPTGradient gradientWithBeginningColor: areaColor1 endingColor: [CPTColor clearColor ]];
180- areaGradient1.angle = -90 .0f ;
180+ areaGradient1.angle = -90.0 ;
181181 areaGradientFill = [CPTFill fillWithGradient: areaGradient1];
182182 boundLinePlot.areaFill = areaGradientFill;
183183 boundLinePlot.areaBaseValue = [[NSDecimalNumber zero ] decimalValue ];
@@ -195,8 +195,8 @@ -(void)constructScatterPlot
195195 NSMutableArray *contentArray = [NSMutableArray arrayWithCapacity: 100 ];
196196 NSUInteger i;
197197 for ( i = 0 ; i < 60 ; i++ ) {
198- id x = [NSNumber numberWithFloat: 1 + i * 0.05 ];
199- id y = [NSNumber numberWithFloat: 1.2 * rand () / (float )RAND_MAX + 1.2 ];
198+ NSNumber * x = [NSNumber numberWithFloat: 1 + i * 0.05 ];
199+ NSNumber * y = [NSNumber numberWithFloat: 1.2 * rand () / (float )RAND_MAX + 1.2 ];
200200 [contentArray addObject: [NSMutableDictionary dictionaryWithObjectsAndKeys: x, @" x" , y, @" y" , nil ]];
201201 }
202202 self.dataForPlot = contentArray;
@@ -226,42 +226,42 @@ -(void)constructBarChart
226226 x.axisLineStyle = nil ;
227227 x.majorTickLineStyle = nil ;
228228 x.minorTickLineStyle = nil ;
229- x.majorIntervalLength = CPTDecimalFromString ( @" 5 " );
230- x.orthogonalCoordinateDecimal = CPTDecimalFromString ( @" 0 " );
229+ x.majorIntervalLength = CPTDecimalFromDouble ( 5.0 );
230+ x.orthogonalCoordinateDecimal = CPTDecimalFromDouble ( 0.0 );
231231 x.title = @" X Axis" ;
232232 x.titleLocation = CPTDecimalFromFloat (7 .5f );
233- x.titleOffset = 55 .0f ;
233+ x.titleOffset = 55.0 ;
234234
235235 // Define some custom labels for the data elements
236- x.labelRotation = M_PI / 4 ;
236+ x.labelRotation = M_PI_4 ;
237237 x.labelingPolicy = CPTAxisLabelingPolicyNone;
238238 NSArray *customTickLocations = [NSArray arrayWithObjects: [NSDecimalNumber numberWithInt: 1 ], [NSDecimalNumber numberWithInt: 5 ], [NSDecimalNumber numberWithInt: 10 ], [NSDecimalNumber numberWithInt: 15 ], nil ];
239- NSArray *xAxisLabels = [NSArray arrayWithObjects: @" Label A" , @" Label B" , @" Label C" , @" Label D" , @" Label E " , nil ];
239+ NSArray *xAxisLabels = [NSArray arrayWithObjects: @" Label A" , @" Label B" , @" Label C" , @" Label D" , nil ];
240240 NSUInteger labelLocation = 0 ;
241- NSMutableArray *customLabels = [NSMutableArray arrayWithCapacity : [xAxisLabels count ]];
241+ NSMutableSet *customLabels = [NSMutableSet setWithCapacity : [xAxisLabels count ]];
242242 for ( NSNumber *tickLocation in customTickLocations ) {
243243 CPTAxisLabel *newLabel = [[CPTAxisLabel alloc ] initWithText: [xAxisLabels objectAtIndex: labelLocation++] textStyle: x.labelTextStyle];
244244 newLabel.tickLocation = [tickLocation decimalValue ];
245245 newLabel.offset = x.labelOffset + x.majorTickLength ;
246- newLabel.rotation = M_PI / 4 ;
246+ newLabel.rotation = M_PI_4 ;
247247 [customLabels addObject: newLabel];
248248 }
249249
250- x.axisLabels = [ NSSet setWithArray: customLabels] ;
250+ x.axisLabels = customLabels;
251251
252252 CPTXYAxis *y = axisSet.yAxis ;
253253 y.axisLineStyle = nil ;
254254 y.majorTickLineStyle = nil ;
255255 y.minorTickLineStyle = nil ;
256- y.majorIntervalLength = CPTDecimalFromString ( @" 50 " );
257- y.orthogonalCoordinateDecimal = CPTDecimalFromString ( @" 0 " );
256+ y.majorIntervalLength = CPTDecimalFromDouble ( 50.0 );
257+ y.orthogonalCoordinateDecimal = CPTDecimalFromDouble ( 0.0 );
258258 y.title = @" Y Axis" ;
259- y.titleOffset = 45 .0f ;
259+ y.titleOffset = 45.0 ;
260260 y.titleLocation = CPTDecimalFromFloat (150 .0f );
261261
262262 // First bar plot
263263 CPTBarPlot *barPlot = [CPTBarPlot tubularBarPlotWithColor: [CPTColor darkGrayColor ] horizontalBars: NO ];
264- barPlot.baseValue = CPTDecimalFromString ( @" 0 " );
264+ barPlot.baseValue = CPTDecimalFromDouble ( 0.0 );
265265 barPlot.dataSource = self;
266266 barPlot.barOffset = CPTDecimalFromFloat (-0 .25f );
267267 barPlot.identifier = @" Bar Plot 1" ;
@@ -270,9 +270,9 @@ -(void)constructBarChart
270270 // Second bar plot
271271 barPlot = [CPTBarPlot tubularBarPlotWithColor: [CPTColor blueColor ] horizontalBars: NO ];
272272 barPlot.dataSource = self;
273- barPlot.baseValue = CPTDecimalFromString ( @" 0 " );
273+ barPlot.baseValue = CPTDecimalFromDouble ( 0.0 );
274274 barPlot.barOffset = CPTDecimalFromFloat (0 .25f );
275- barPlot.barCornerRadius = 2 .0f ;
275+ barPlot.barCornerRadius = 2.0 ;
276276 barPlot.identifier = @" Bar Plot 2" ;
277277 barPlot.delegate = self;
278278 [barChart addPlot: barPlot toPlotSpace: plotSpace];
0 commit comments