NSObject(SM2DGraphDelegate)



Discussion

An object can implement any of the optional methods in this category to gain greater control over a particular graph view.

Methods

twoDGraphView:didClickPoint:

- (void)twoDGraphView:(SM2DGraphView *)inGraphView didClickPoint:(NSPoint)inPoint; 

Implementing this method is optional. The delegate has a chance to respond to the user clicking the mouse in the graph paper area of the view.

You may want to use -convertPoint:fromView:toLineIndex: to get the point into the coordinate system of a particular data line.

Parameters

NameDescription
inGraphViewThe graph view making the call.
inPointThe clicked position in the graph view coordinate system.

twoDGraphView:doneDrawingLineIndex:

- (void)twoDGraphView:(SM2DGraphView *)inGraphView doneDrawingLineIndex:(unsigned int)inLineIndex; 

Implementing this method is optional. The delegate can be notified when each of the lines completes drawing. This is called from the -drawRect: method of the view. This could be useful for a progress bar or timing information.

Parameters

NameDescription
inGraphViewThe graph view making the call.
inLineIndexThe zero based data line index that just got done drawing.

twoDGraphView:labelForTickMarkIndex:forAxis:defaultLabel:

- (NSString *)twoDGraphView:(SM2DGraphView *)inGraphView labelForTickMarkIndex:(unsigned int)inTickMarkIndex
             forAxis:(SM2DGraphAxisEnum)inAxis defaultLabel:(NSString *)inDefault; 

Implementing this method is optional. The delegate has a chance to change the tick mark labels drawn on each axis of the graph. If the delegate does not respond to this message the default label is used. If nil is returned, no label is drawn.

The default label is a number based on the position of the tick mark and the scale reported by the datasource for the first data line.

Parameters

NameDescription
inGraphViewThe graph view making the call.
inTickMarkIndexThe zero based data line index to return.
inAxisThe axis the tick mark is on.
inDefaultThe default value of the label; will always be a number based on the position of the tick mark and the scale of the first line.
Result: A string to draw at the tick mark location; can return nil if no label is wanted.

twoDGraphView:willDisplayBarIndex:forLineIndex:withAttributes:

Abstract: Allows the delegate to change the way individual bars of a bar graph are drawn.
- (void)twoDGraphView:(SM2DGraphView *)inGraphView willDisplayBarIndex:(unsigned int)inBarIndex forLineIndex:(unsigned int)inLineIndex withAttributes:(NSMutableDictionary *)attr; 

Implementing this method is optional. Informs the delegate that inGraphView will display the bar inBarIndex of the inLineIndex line using the attributes in attr. The delegate can modify the attributes contained in attr to change alter the appearance of the bar. Because the attr is reused for every bar in the line, the delegate must reset the display attributes after drawing special bars.

Parameters

NameDescription
inGraphViewThe graph view making the call.
inBarIndexThe zero based bar (data point) index that will be drawn.
inLineIndexThe zero based data line index that will be drawn.
attrA dictionary containing the current attributes the bar will be drawn in. This can be modified so individual bars will display differently.

© 2003-2004 Snowmint Creative Solutions LLC (Last Updated 8/29/2004)