I have a graph with two plots. One plot shows 10 data points and is static. The second plot should only show one data point that is a function of a slider selection.
However, whenever I move the slider to compute the coordinates of the single data point, the plot generates a whole series of points until I stop sliding. I would like to remove this trail of dots and only show the one represented by the stopping position of the slider. Hope this makes sense.
Here is what the graph looks like (erroneously):
Oops, I'm too new to post an image, but I'm sure you get the picture.
Here is a portion of the code in the slider IBAction:
CPTScatterPlot *dotPlot = [[[CPTScatterPlot alloc] init] autorelease];
dotPlot.identifier = @"Blue Plot";
dotPlot.dataSource = self;
dotPlot.dataLineStyle = nil;
[graph addPlot:dotPlot];
NSMutableArray *dotArray = [NSMutableArray arrayWithCapacity:1];
NSNumber *xx = [NSNumber numberWithFloat:[estMonthNumber.text floatValue]];
NSNumber *yy = [NSNumber numberWithFloat:[estMonthYield.text floatValue]];
[dotArray addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:xx,@"x",yy,@"y", nil]];
CPTMutableLineStyle *dotLineStyle = [CPTMutableLineStyle lineStyle];
dotLineStyle.lineColor = [CPTColor blueColor];
CPTPlotSymbol *yieldSymbol = [CPTPlotSymbol ellipsePlotSymbol];
yieldSymbol.fill = [CPTFill fillWithColor:[CPTColor blueColor]];
yieldSymbol.size = CGSizeMake(10.0, 10.0);
dotPlot.plotSymbol = yieldSymbol;
self.dataForPlot = dotArray;
I've tried to reload the plot with [dotPlot reloadData] and even tried to remove and add back the dotPlot but neither seems to work or, perhaps, I am putting the instructions in the wrong place or wrong sequence.
Any advice would be greatly appreciated.