- (void)addDataPoint:(NSPoint)inPoint toLineIndex:(unsigned int)inLineIndex;
Adds a point to the end of a specific line's data. The data must have either been nil previously,
returned as a NSMutableArray by the dataSources -twoDGraphView:dataForLineIndex: method, or returned as
a NSMutableData by the dataSources -twoDGraphView:dataObjectForLineIndex: method. The graph is
scheduled for redrawing if the liveRefresh flag is set for the view. This can be used for
incremental graphing, such as when each point requires significant calculation.
See also, the -liveRefresh and -setLiveRefresh: methods for additional information.
Name Description inPoint A point to add to the end of the line's data. inLineIndex The zero based index of the line to add to.
- (float)axisInsetForAxis:(SM2DGraphAxisEnum)inAxis;
Returns the pixel inset from the edge of the graph paper area to start the axis range. The default is zero.
Result: The number of pixels to inset the line range.
Name Description inAxis The axis to return.
- (NSColor *)backgroundColor;
Returns the color used to draw the background of the receiver. The default background color is white.
Result: The color used to draw the background.+ (float)barWidth;
Returns the pixel width of a bar for bar graphs. Useful for calculating graph insets if multiple line bar graphs are going to be displayed.
Result: The width (in pixels) of a bar for bar graphs.- (NSColor *)borderColor;
Returns the color used to draw the border of the graph area. The default color is black.
Result: The color used to draw the border of the graph area.- (NSPoint)convertPoint:(NSPoint)inPoint fromView:(NSView *)inView toLineIndex:(unsigned int)inLineIndex;
Converts a point from a given window/view coordinate system to a point in the coordinate system
of a given line on the graph. For example, if the x range values for a line are from -10.0 to +10.0
the returned point will be in this range.
This is very useful when calling it from the -twoDGraphView:didClickPoint: delegate method.
Result: The point after conversion to the appropriate line's scale.
Name Description inPoint The point to be converted. inView The inPoint parameter is in this view's coordinate system. A value of nil means the window's coordinate system. inLineIndex Zero based index of a line displayed on the graph.
- (id)dataSource;
Returns the object that line data is pulled from.
Result: The data source object of the graph view.- (id)delegate;
Returns the delegate object for the graph view.
Result: The delegate object.- (BOOL)drawsGrid;
Returns YES if the receiver draws grid lines on the graph, NO if it doesn't. The default is NO.
Result: YES if the receiver draws grid lines, NO if it doesn't.- (BOOL)drawsLineAtZeroForAxis:(SM2DGraphAxisEnum)inAxis;
Can draw a straight line at zero for the first line. This is useful if your range goes both above and below zero, and zero does not land on a standard grid line. The default is NO.
Result: YES if drawing a straight line at zero for the first line.
Name Description inAxis The axis to return.
- (NSColor *)gridColor;
Returns the color used to draw grid lines. The default color is blue.
Result: The color used to draw grid lines.- (NSImage *)imageOfView;
Returns an autoreleased image of the entire graph view. This image is filled with a white background first, so it should not have any transparent parts.
Result: An NSImage object of the entire graph view.- (NSString *)labelForAxis:(SM2DGraphAxisEnum)inAxis;
Returns the axis label for an axis. The default is no label (nil).
Result: An autoreleased string or nil.
Name Description inAxis The axis to return.
- (BOOL)liveRefresh;
Returns the state of the liveRefresh flag. This flag is only used in the -addDataPoint:toLineIndex: method to determine if the graph should be automatically redrawn or not. The default value is NO.
Result: The state of the liveRefresh flag.- (int)numberOfMinorTickMarksForAxis:(SM2DGraphAxisEnum)inAxis;
Returns the number of minor tick marks between each major tick mark for an axis. The default is no minor tick marks.
Result: The number of minor tick marks for an axis.
Name Description inAxis The axis to count.
- (int)numberOfTickMarksForAxis:(SM2DGraphAxisEnum)inAxis;
Returns the number of major tick marks for an axis. The default is no tick marks.
Result: The number of major tick marks for an axis.
Name Description inAxis The axis to count.
- (IBAction)refreshDisplay:(id)sender;
Simple cover method that calls -reloadData, then -reloadAttributes.
Name Description sender Any object or nil; unused.
- (void)reloadAttributes;
Reloads all line attributes from the datasource and schedules the graph for redrawing. The line data points are not reloaded.
- (void)reloadAttributesForLineIndex:(unsigned int)inLineIndex;
Reloads a specific line's attributes from the datasource and schedules the graph for redrawing. The line data points are not reloaded.
Name Description inLineIndex The zero based index of the line to reload.
- (void)reloadData;
Reloads all line data from the datasource and schedules the graph for redrawing.
- (void)reloadDataForLineIndex:(unsigned int)inLineIndex;
Reloads a specific line's data from the datasource and schedules the graph for redrawing.
Name Description inLineIndex The zero based index of the line to reload.
- (void)setAxisInset:(float)inInset forAxis:(SM2DGraphAxisEnum)inAxis;
Sets the pixel inset from the edge of the graph paper area to start the axis range. The default is zero.
Name Description inInset The number of pixels to inset the line range. inAxis The axis to change.
- (void)setBackgroundColor:(NSColor *)inColor;
Sets the receiver's background color to aColor. The default is white. If set to nil, no
background is drawn.
See Also: -setDrawsGrid:, -drawsGrid, -setGridColor:, -gridColor, and -backgroundColor.
Name Description inColor The new background color.
- (void)setBorderColor:(NSColor *)inColor;
Sets the color used to draw the border of the graph area. The default color is black.
See Also: -setDrawsGrid:, -drawsGrid, -gridColor, -setBackgroundColor:, and -backgroundColor.
Name Description inColor The color to draw grid lines.
- (void)setDataSource:(id)inDataSource;
Set the object that line data is pulled from. This works in exactly the same way that
NSTableView and NSOutlineView have data source objects.
The data source is checked to see if responds to methods in the SM2DGraphDataSource category.
Name Description inDataSource The new data source.
- (void)setDelegate:(id)inDelegate;
Set the delegate object for the graph view.
The delegate is checked to see if responds to any of the methods in the SM2DGraphDelegate category.
Name Description inDelegate The new delegate object.
- (void)setDrawsGrid:(BOOL)inFlag;
Controls whether the receiver draws grid lines on the graph. The default is NO.
See Also: -drawsGrid, -setGridColor:, -gridColor, -setBackgroundColor: and -backgroundColor.
Name Description inFlag If YES the receiver draws grid lines; if NO it doesn't.
- (void)setDrawsLineAtZero:(BOOL)inNewValue forAxis:(SM2DGraphAxisEnum)inAxis;
Can draw a straight line at zero for the first line. This is useful if your range goes both above and below zero, and zero does not land on a standard grid line. The default is NO.
Name Description inNewValue Set to YES if you want to draw a straight line at zero for the first line. inAxis The axis to change.
- (void)setGridColor:(NSColor *)inColor;
Sets the color used to draw grid lines. The default color is blue.
See Also: -setDrawsGrid:, -drawsGrid, -gridColor, -setBackgroundColor:, and -backgroundColor.
Name Description inColor The color to draw grid lines.
- (void)setLabel:(NSString *)inNewLabel forAxis:(SM2DGraphAxisEnum)inAxis;
Sets the axis label for an axis. The default is no label (nil).
Name Description inNewLabel The new label. If nil, any existing label is removed. inAxis The axis to label.
- (void)setLiveRefresh:(BOOL)inFlag;
Sets the state of the liveRefresh flag. This flag is only used in the -addDataPoint:toLineIndex: method to determine if the graph should be automatically redrawn or not. The default value is NO.
Name Description inFlag The desired state of the liveRefresh flag.
- (void)setNumberOfMinorTickMarks:(int)count forAxis:(SM2DGraphAxisEnum)inAxis;
Sets the number of minor tick marks between each major tick mark for an axis. The default is no minor tick marks.
Name Description count The number of minor tick marks between major tick marks. inAxis The axis to change.
- (void)setNumberOfTickMarks:(int)count forAxis:(SM2DGraphAxisEnum)inAxis;
Sets the number of major tick marks for an axis. The default is no tick marks.
Name Description count The number of major tick marks. Should not be one. inAxis The axis to change.
- (void)setTag:(int)inTag;
Sets the tag of the receiver to inTag. This is an integer you can use for whatever you'd like.
Name Description inTag The new tag of the receiver.
- (void)setTickMarkPosition:(NSTickMarkPosition)position forAxis:(SM2DGraphAxisEnum)inAxis;
Sets the position to draw tick marks for an axis. The default is NSTickMarkBelow and NSTickMarkRight. Note: Currently, this setting is remembered but does nothing.
Name Description position The position to draw tick marks. inAxis The axis to change.
- (int)tag;
Returns the tag of the receiver. This is an integer you can use for whatever you'd like.
Result: The tag of the receiver.- (NSTickMarkPosition)tickMarkPositionForAxis:(SM2DGraphAxisEnum)inAxis;
Returns the position to draw tick marks for an axis. The default is NSTickMarkBelow and NSTickMarkRight. Note: Currently, this setting is remembered but does nothing.
Result: The position to draw tick marks for an axis.
Name Description inAxis The axis to return.
© 2003 Snowmint Creative Solutions LLC (Last Updated 9/4/2003)