views:

48

answers:

1

Hi All,

How do I draw a vertical line on plotSymbol using Custom PlotSymbol? If it would be grateful, give any samples regarding that.

Sri

+1  A: 

You simply create a CGPath that describes the outline of your custom symbol. Here's a sample from CPTestApp (in the CorePlot/examples folder):

CPPlotSymbol *symbol = [[[CPPlotSymbol alloc] init] autorelease];
CGMutablePathRef path = CGPathCreateMutable();
CGPathMoveToPoint(path, NULL, 0., 0.);

CGPathAddEllipseInRect(path, NULL, CGRectMake(0., 0., 10., 10.));
CGPathAddEllipseInRect(path, NULL, CGRectMake(1.5, 4., 3., 3.));
CGPathAddEllipseInRect(path, NULL, CGRectMake(5.5, 4., 3., 3.));
CGPathMoveToPoint(path, NULL, 5., 2.);
CGPathAddArc(path, NULL, 5., 3.3, 2.8, 0., pi, TRUE);
CGPathCloseSubpath(path);

symbol.customSymbolPath = path;
symbol.usesEvenOddClipRule = YES;
CGPathRelease(path);

You can set the plotSymbol property on the scatter plot to apply your symbol to every point or use the -symbolForScatterPlot:recordIndex: or -symbolsForScatterPlot:recordIndexRange: datasource method to apply it to some of the points.

Eric Skroch
Thanks for your valuable answer. is it support iphone os?
sri
Yes, nearly everything in Core Plot is cross-platform between MacOS and iOS. In cases where there are platform differences (e.g., NSView vs. UIView) there is usually a platform-specific implementation of that feature.
Eric Skroch