@@ -27,10 +27,10 @@ @implementation CPPieChartPlugIn
27
27
28
28
+(NSDictionary *)attributes
29
29
{
30
- return [ NSDictionary dictionaryWithObjectsAndKeys:
31
- @" Core Plot Pie Chart" , QCPlugInAttributeNameKey ,
32
- @" Pie chart" , QCPlugInAttributeDescriptionKey ,
33
- nil ] ;
30
+ return @{
31
+ QCPlugInAttributeNameKey : @" Core Plot Pie Chart" ,
32
+ QCPlugInAttributeDescriptionKey : @" Pie chart"
33
+ } ;
34
34
}
35
35
36
36
-(double )inputXMax
@@ -62,7 +62,7 @@ -(QCPlugInViewController *)createViewController
62
62
63
63
+(NSArray *)sortedPropertyPortKeys
64
64
{
65
- NSArray *pieChartPropertyPortKeys = [ NSArray arrayWithObjects: @" inputPieRadius" , @" inputSliceLabelOffset" , @" inputStartAngle" , @" inputSliceDirection" , @" inputBorderColor" , @" inputBorderWidth" , nil ];
65
+ NSArray *pieChartPropertyPortKeys = @[ @" inputPieRadius" , @" inputSliceLabelOffset" , @" inputStartAngle" , @" inputSliceDirection" , @" inputBorderColor" , @" inputBorderWidth" ];
66
66
67
67
return [[super sortedPropertyPortKeys ] arrayByAddingObjectsFromArray: pieChartPropertyPortKeys];
68
68
}
@@ -71,54 +71,54 @@ +(NSDictionary *)attributesForPropertyPortWithKey:(NSString *)key
71
71
{
72
72
// A few additional ports for the pie chart type ...
73
73
if ( [key isEqualToString: @" inputPieRadius" ] ) {
74
- return [ NSDictionary dictionaryWithObjectsAndKeys:
75
- @" Pie Radius" , QCPortAttributeNameKey ,
76
- [ NSNumber numberWithFloat: 0.0 ], QCPortAttributeMinimumValueKey ,
77
- [ NSNumber numberWithFloat: 0.75 ], QCPortAttributeDefaultValueKey ,
78
- nil ] ;
74
+ return @{
75
+ QCPortAttributeNameKey : @" Pie Radius" ,
76
+ QCPortAttributeMinimumValueKey : @ 0.0 ,
77
+ QCPortAttributeDefaultValueKey : @ 0.75
78
+ } ;
79
79
}
80
80
else if ( [key isEqualToString: @" inputSliceLabelOffset" ] ) {
81
- return [ NSDictionary dictionaryWithObjectsAndKeys:
82
- @" Label Offset" , QCPortAttributeNameKey ,
83
- [ NSNumber numberWithFloat: 20.0 ], QCPortAttributeDefaultValueKey ,
84
- nil ] ;
81
+ return @{
82
+ QCPortAttributeNameKey : @" Label Offset" ,
83
+ QCPortAttributeDefaultValueKey : @ 20.0
84
+ } ;
85
85
}
86
86
else if ( [key isEqualToString: @" inputStartAngle" ] ) {
87
- return [ NSDictionary dictionaryWithObjectsAndKeys:
88
- @" Start Angle" , QCPortAttributeNameKey ,
89
- [ NSNumber numberWithFloat: 0.0 ], QCPortAttributeDefaultValueKey ,
90
- nil ] ;
87
+ return @{
88
+ QCPortAttributeNameKey : @" Start Angle" ,
89
+ QCPortAttributeDefaultValueKey : @ 0.0
90
+ } ;
91
91
}
92
92
else if ( [key isEqualToString: @" inputSliceDirection" ] ) {
93
- return [ NSDictionary dictionaryWithObjectsAndKeys:
94
- @" Slice Direction" , QCPortAttributeNameKey ,
95
- [ NSNumber numberWithInt: 1 ], QCPortAttributeMaximumValueKey ,
96
- [ NSArray arrayWithObjects: @ " Clockwise" , @" Counter-Clockwise" , nil ], QCPortAttributeMenuItemsKey ,
97
- [ NSNumber numberWithInt: 0 ], QCPortAttributeDefaultValueKey ,
98
- nil ] ;
93
+ return @{
94
+ QCPortAttributeNameKey : @" Slice Direction" ,
95
+ QCPortAttributeMaximumValueKey : @ 1 ,
96
+ QCPortAttributeMenuItemsKey : @[ @ " Clockwise" , @" Counter-Clockwise" ] ,
97
+ QCPortAttributeDefaultValueKey : @ 0
98
+ } ;
99
99
}
100
100
else if ( [key isEqualToString: @" inputBorderWidth" ] ) {
101
- return [ NSDictionary dictionaryWithObjectsAndKeys:
102
- @" Border Width" , QCPortAttributeNameKey ,
103
- [ NSNumber numberWithFloat: 0.0 ], QCPortAttributeMinimumValueKey ,
104
- [ NSNumber numberWithFloat: 1.0 ], QCPortAttributeDefaultValueKey ,
105
- nil ] ;
101
+ return @{
102
+ QCPortAttributeNameKey : @" Border Width" ,
103
+ QCPortAttributeMinimumValueKey : @ 0.0 ,
104
+ QCPortAttributeDefaultValueKey : @ 1.0
105
+ } ;
106
106
}
107
107
else if ( [key isEqualToString: @" inputBorderColor" ] ) {
108
108
CGColorRef grayColor = CGColorCreateGenericGray (0.0 , 1.0 );
109
- NSDictionary *result = [ NSDictionary dictionaryWithObjectsAndKeys:
110
- @" Border Color" , QCPortAttributeNameKey ,
111
- grayColor, QCPortAttributeDefaultValueKey ,
112
- nil ] ;
109
+ NSDictionary *result = @{
110
+ QCPortAttributeNameKey : @" Border Color" ,
111
+ QCPortAttributeDefaultValueKey : ( id ) grayColor
112
+ } ;
113
113
CGColorRelease (grayColor);
114
114
return result;
115
115
}
116
116
else if ( [key isEqualToString: @" inputLabelColor" ] ) {
117
117
CGColorRef grayColor = CGColorCreateGenericGray (1.0 , 1.0 );
118
- NSDictionary *result = [ NSDictionary dictionaryWithObjectsAndKeys:
119
- @" Label Color" , QCPortAttributeNameKey ,
120
- grayColor, QCPortAttributeDefaultValueKey ,
121
- nil ] ;
118
+ NSDictionary *result = @{
119
+ QCPortAttributeNameKey : @" Label Color" ,
120
+ QCPortAttributeDefaultValueKey : ( id ) grayColor
121
+ } ;
122
122
CGColorRelease (grayColor);
123
123
return result;
124
124
}
@@ -132,28 +132,25 @@ -(void)addPlotWithIndex:(NSUInteger)index
132
132
if ( index == 0 ) {
133
133
[self addInputPortWithType: QCPortTypeStructure
134
134
forKey: [NSString stringWithFormat: @" plotNumbers%lu " , (unsigned long )index]
135
- withAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
136
- [NSString stringWithFormat: @" Data Values %u " , (unsigned )(index + 1 )], QCPortAttributeNameKey ,
137
- QCPortTypeStructure , QCPortAttributeTypeKey ,
138
- nil ]];
135
+ withAttributes: @{ QCPortAttributeNameKey : [NSString stringWithFormat: @" Data Values %u " , (unsigned )(index + 1 )],
136
+ QCPortAttributeTypeKey : QCPortTypeStructure }
137
+ ];
139
138
140
139
[self addInputPortWithType: QCPortTypeStructure
141
140
forKey: [NSString stringWithFormat: @" plotLabels%lu " , (unsigned long )index]
142
- withAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
143
- [NSString stringWithFormat: @" Data Labels %lu " , (unsigned long )(index + 1 )], QCPortAttributeNameKey ,
144
- QCPortTypeStructure , QCPortAttributeTypeKey ,
145
- nil ]];
141
+ withAttributes: @{ QCPortAttributeNameKey : [NSString stringWithFormat: @" Data Labels %lu " , (unsigned long )(index + 1 )],
142
+ QCPortAttributeTypeKey : QCPortTypeStructure }
143
+ ];
146
144
147
145
// TODO: add support for used defined fill colors. As of now we use a single color
148
146
// multiplied against the 'default' pie chart colors
149
147
CGColorRef grayColor = CGColorCreateGenericGray (1.0 , 1.0 );
150
148
[self addInputPortWithType: QCPortTypeColor
151
149
forKey: [NSString stringWithFormat: @" plotFillColor%lu " , (unsigned long )index]
152
- withAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
153
- [NSString stringWithFormat: @" Primary Fill Color %lu " , (unsigned long )(index + 1 )], QCPortAttributeNameKey ,
154
- QCPortTypeColor , QCPortAttributeTypeKey ,
155
- grayColor, QCPortAttributeDefaultValueKey ,
156
- nil ]];
150
+ withAttributes: @{ QCPortAttributeNameKey : [NSString stringWithFormat: @" Primary Fill Color %lu " , (unsigned long )(index + 1 )],
151
+ QCPortAttributeTypeKey : QCPortTypeColor ,
152
+ QCPortAttributeDefaultValueKey : (id )grayColor }
153
+ ];
157
154
CGColorRelease (grayColor);
158
155
159
156
// Add the new plot to the graph
@@ -261,7 +258,7 @@ -(CPTFill *)sliceFillForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUInteger
261
258
262
259
CGColorRelease (fillColor);
263
260
264
- return [[(CPTFill *) [CPTFill alloc ] initWithColor : fillCPColor] autorelease ];
261
+ return [[[CPTFill alloc ] initWithColor: fillCPColor] autorelease ];
265
262
}
266
263
267
264
-(CPTTextLayer *)sliceLabelForPieChart : (CPTPieChart *)pieChart recordIndex : (NSUInteger )index
0 commit comments