1- #import " CPBarPlotPlugIn .h"
1+ #import " CPTBarPlotPlugIn .h"
22
3- @implementation CPBarPlotPlugIn
3+ @implementation CPTBarPlotPlugIn
44
55/*
66 NOTE: It seems that QC plugins don't inherit dynamic input ports which is
@@ -30,8 +30,8 @@ @implementation CPBarPlotPlugIn
3030+ (NSDictionary *) attributes
3131{
3232 return [NSDictionary dictionaryWithObjectsAndKeys:
33- @" Core Plot Bar Chart" , QCPlugInAttributeNameKey ,
34- @" Bar chart" , QCPlugInAttributeDescriptionKey ,
33+ @" Core Plot Bar Chart" , QCPTlugInAttributeNameKey ,
34+ @" Bar chart" , QCPTlugInAttributeDescriptionKey ,
3535 nil ];
3636}
3737
@@ -41,51 +41,51 @@ + (NSDictionary*) attributesForPropertyPortWithKey:(NSString*)key
4141
4242 if ([key isEqualToString: @" inputBarWidth" ])
4343 return [NSDictionary dictionaryWithObjectsAndKeys:
44- @" Bar Width" , QCPortAttributeNameKey ,
45- [NSNumber numberWithFloat: 1.0 ], QCPortAttributeDefaultValueKey ,
46- [NSNumber numberWithFloat: 0.0 ], QCPortAttributeMinimumValueKey ,
44+ @" Bar Width" , QCPTortAttributeNameKey ,
45+ [NSNumber numberWithFloat: 1.0 ], QCPTortAttributeDefaultValueKey ,
46+ [NSNumber numberWithFloat: 0.0 ], QCPTortAttributeMinimumValueKey ,
4747 nil ];
4848
4949 if ([key isEqualToString: @" inputBarOffset" ])
5050 return [NSDictionary dictionaryWithObjectsAndKeys:
51- @" Bar Offset" , QCPortAttributeNameKey ,
52- [NSNumber numberWithFloat: 0.5 ], QCPortAttributeDefaultValueKey ,
51+ @" Bar Offset" , QCPTortAttributeNameKey ,
52+ [NSNumber numberWithFloat: 0.5 ], QCPTortAttributeDefaultValueKey ,
5353 nil ];
5454
5555 if ([key isEqualToString: @" inputBaseValue" ])
5656 return [NSDictionary dictionaryWithObjectsAndKeys:
57- @" Base Value" , QCPortAttributeNameKey ,
58- [NSNumber numberWithFloat: 0.0 ], QCPortAttributeDefaultValueKey ,
57+ @" Base Value" , QCPTortAttributeNameKey ,
58+ [NSNumber numberWithFloat: 0.0 ], QCPTortAttributeDefaultValueKey ,
5959 nil ];
6060
6161 if ([key isEqualToString: @" inputHorizontalBars" ])
6262 return [NSDictionary dictionaryWithObjectsAndKeys:
63- @" Horizontal Bars" , QCPortAttributeNameKey ,
64- [NSNumber numberWithBool: NO ], QCPortAttributeDefaultValueKey ,
63+ @" Horizontal Bars" , QCPTortAttributeNameKey ,
64+ [NSNumber numberWithBool: NO ], QCPTortAttributeDefaultValueKey ,
6565 nil ];
6666
6767 if ([key isEqualToString: @" inputXMin" ])
6868 return [NSDictionary dictionaryWithObjectsAndKeys:
69- @" X Range Min" , QCPortAttributeNameKey ,
70- [NSNumber numberWithFloat: 0.0 ], QCPortAttributeDefaultValueKey ,
69+ @" X Range Min" , QCPTortAttributeNameKey ,
70+ [NSNumber numberWithFloat: 0.0 ], QCPTortAttributeDefaultValueKey ,
7171 nil ];
7272
7373 if ([key isEqualToString: @" inputXMax" ])
7474 return [NSDictionary dictionaryWithObjectsAndKeys:
75- @" X Range Max" , QCPortAttributeNameKey ,
76- [NSNumber numberWithFloat: 5.0 ], QCPortAttributeDefaultValueKey ,
75+ @" X Range Max" , QCPTortAttributeNameKey ,
76+ [NSNumber numberWithFloat: 5.0 ], QCPTortAttributeDefaultValueKey ,
7777 nil ];
7878
7979 if ([key isEqualToString: @" inputYMin" ])
8080 return [NSDictionary dictionaryWithObjectsAndKeys:
81- @" Y Range Min" , QCPortAttributeNameKey ,
82- [NSNumber numberWithFloat: 0.0 ], QCPortAttributeDefaultValueKey ,
81+ @" Y Range Min" , QCPTortAttributeNameKey ,
82+ [NSNumber numberWithFloat: 0.0 ], QCPTortAttributeDefaultValueKey ,
8383 nil ];
8484
8585 if ([key isEqualToString: @" inputYMax" ])
8686 return [NSDictionary dictionaryWithObjectsAndKeys:
87- @" Y Range Max" , QCPortAttributeNameKey ,
88- [NSNumber numberWithFloat: 5.0 ], QCPortAttributeDefaultValueKey ,
87+ @" Y Range Max" , QCPTortAttributeNameKey ,
88+ [NSNumber numberWithFloat: 5.0 ], QCPTortAttributeDefaultValueKey ,
8989 nil ];
9090
9191 return [super attributesForPropertyPortWithKey: key];
@@ -95,40 +95,40 @@ - (void) addPlotWithIndex:(NSUInteger)index
9595{
9696 // Create input ports for the new plot
9797
98- [self addInputPortWithType: QCPortTypeStructure
98+ [self addInputPortWithType: QCPTortTypeStructure
9999 forKey: [NSString stringWithFormat: @" plotNumbers%i " , index]
100100 withAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
101- [NSString stringWithFormat: @" Values %i " , index+1 ], QCPortAttributeNameKey ,
102- QCPortTypeStructure , QCPortAttributeTypeKey ,
101+ [NSString stringWithFormat: @" Values %i " , index+1 ], QCPTortAttributeNameKey ,
102+ QCPTortTypeStructure, QCPTortAttributeTypeKey ,
103103 nil ]];
104104
105- [self addInputPortWithType: QCPortTypeColor
105+ [self addInputPortWithType: QCPTortTypeColor
106106 forKey: [NSString stringWithFormat: @" plotDataLineColor%i " , index]
107107 withAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
108- [NSString stringWithFormat: @" Plot Line Color %i " , index+1 ], QCPortAttributeNameKey ,
109- QCPortTypeColor , QCPortAttributeTypeKey ,
110- [self defaultColorForPlot: index alpha: 1.0 ], QCPortAttributeDefaultValueKey ,
108+ [NSString stringWithFormat: @" Plot Line Color %i " , index+1 ], QCPTortAttributeNameKey ,
109+ QCPTortTypeColor, QCPTortAttributeTypeKey ,
110+ [self defaultColorForPlot: index alpha: 1.0 ], QCPTortAttributeDefaultValueKey ,
111111 nil ]];
112112
113- [self addInputPortWithType: QCPortTypeColor
113+ [self addInputPortWithType: QCPTortTypeColor
114114 forKey: [NSString stringWithFormat: @" plotFillColor%i " , index]
115115 withAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
116- [NSString stringWithFormat: @" Plot Fill Color %i " , index+1 ], QCPortAttributeNameKey ,
117- QCPortTypeColor , QCPortAttributeTypeKey ,
118- [self defaultColorForPlot: index alpha: 0.25 ], QCPortAttributeDefaultValueKey ,
116+ [NSString stringWithFormat: @" Plot Fill Color %i " , index+1 ], QCPTortAttributeNameKey ,
117+ QCPTortTypeColor, QCPTortAttributeTypeKey ,
118+ [self defaultColorForPlot: index alpha: 0.25 ], QCPTortAttributeDefaultValueKey ,
119119 nil ]];
120120
121- [self addInputPortWithType: QCPortTypeNumber
121+ [self addInputPortWithType: QCPTortTypeNumber
122122 forKey: [NSString stringWithFormat: @" plotDataLineWidth%i " , index]
123123 withAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
124- [NSString stringWithFormat: @" Plot Line Width %i " , index+1 ], QCPortAttributeNameKey ,
125- QCPortTypeNumber , QCPortAttributeTypeKey ,
126- [NSNumber numberWithInt: 1.0 ], QCPortAttributeDefaultValueKey ,
127- [NSNumber numberWithFloat: 0.0 ], QCPortAttributeMinimumValueKey ,
124+ [NSString stringWithFormat: @" Plot Line Width %i " , index+1 ], QCPTortAttributeNameKey ,
125+ QCPTortTypeNumber, QCPTortAttributeTypeKey ,
126+ [NSNumber numberWithInt: 1.0 ], QCPTortAttributeDefaultValueKey ,
127+ [NSNumber numberWithFloat: 0.0 ], QCPTortAttributeMinimumValueKey ,
128128 nil ]];
129129
130130 // Add the new plot to the graph
131- CPBarPlot *barPlot = [CPBarPlot tubularBarPlotWithColor: [CPColor greenColor ] horizontalBars: NO ];
131+ CPTBarPlot *barPlot = [CPTBarPlot tubularBarPlotWithColor: [CPTColor greenColor ] horizontalBars: NO ];
132132 barPlot.identifier = [NSString stringWithFormat: @" Bar Plot %i " , index+1 ];
133133 barPlot.dataSource = self;
134134 [graph addPlot: barPlot];
@@ -157,18 +157,18 @@ - (BOOL) configurePlots
157157 double barWidth = self.inputBarWidth *unitWidth/count;
158158
159159 // Configure scatter plots for active plot inputs
160- for (CPBarPlot * plot in [graph allPlots ])
160+ for (CPTBarPlot * plot in [graph allPlots ])
161161 {
162162 int index = [[graph allPlots ] indexOfObject: plot];
163- CPMutableLineStyle *lineStyle = [CPMutableLineStyle lineStyle ];
164- lineStyle.lineColor = [CPColor colorWithCGColor: [self dataLineColor: index]];
163+ CPTMutableLineStyle *lineStyle = [CPTMutableLineStyle lineStyle ];
164+ lineStyle.lineColor = [CPTColor colorWithCGColor: [self dataLineColor: index]];
165165 lineStyle.lineWidth = [self dataLineWidth: index];
166166 plot.lineStyle = lineStyle;
167- plot.baseValue = CPDecimalFromDouble (self.inputBaseValue );
168- plot.barWidth = CPDecimalFromDouble (barWidth);
169- plot.barOffset = CPDecimalFromDouble (self.inputBarOffset );
167+ plot.baseValue = CPTDecimalFromDouble (self.inputBaseValue );
168+ plot.barWidth = CPTDecimalFromDouble (barWidth);
169+ plot.barOffset = CPTDecimalFromDouble (self.inputBarOffset );
170170 plot.barsAreHorizontal = self.inputHorizontalBars ;
171- plot.fill = [CPFill fillWithColor: [CPColor colorWithCGColor: [self areaFillColor: index]]];
171+ plot.fill = [CPTFill fillWithColor: [CPTColor colorWithCGColor: [self areaFillColor: index]]];
172172
173173 [plot reloadData ];
174174 }
@@ -179,12 +179,12 @@ - (BOOL) configurePlots
179179#pragma mark -
180180#pragma markData source methods
181181
182- -(CPFill *) barFillForBarPlot : (CPBarPlot *)barPlot recordIndex : (NSNumber *)index
182+ -(CPTFill *) barFillForBarPlot : (CPTBarPlot *)barPlot recordIndex : (NSNumber *)index
183183{
184184 return nil ;
185185}
186186
187- -(NSUInteger )numberOfRecordsForPlot : (CPPlot *)plot
187+ -(NSUInteger )numberOfRecordsForPlot : (CPTPlot *)plot
188188{
189189 NSUInteger plotIndex = [[graph allPlots ] indexOfObject: plot];
190190 NSString *key = [NSString stringWithFormat: @" plotNumbers%i " , plotIndex];
@@ -195,7 +195,7 @@ -(NSUInteger)numberOfRecordsForPlot:(CPPlot *)plot
195195 return [[self valueForInputKey: key] count ];
196196}
197197
198- - (NSArray *)numbersForPlot : (CPBarPlot *)plot field : (NSUInteger )fieldEnum recordIndexRange : (NSRange )indexRange
198+ - (NSArray *)numbersForPlot : (CPTBarPlot *)plot field : (NSUInteger )fieldEnum recordIndexRange : (NSRange )indexRange
199199{
200200 NSUInteger plotIndex = [[graph allPlots ] indexOfObject: plot];
201201 NSString *key = [NSString stringWithFormat: @" plotNumbers%i " , plotIndex];
@@ -206,7 +206,7 @@ - (NSArray *)numbersForPlot:(CPBarPlot *)plot field:(NSUInteger)fieldEnum record
206206 NSDictionary *dict = [self valueForInputKey: key];
207207 NSMutableArray *array = [NSMutableArray array ];
208208
209- if (fieldEnum == CPBarPlotFieldBarLocation )
209+ if (fieldEnum == CPTBarPlotFieldBarLocation )
210210 {
211211 // Calculate horizontal position of bar - nth bar index + barWidth*plotIndex + 0.5
212212 float xpos;
0 commit comments