SM2DGraphView.h



Discussion

NSView subclass that draws line and bar graphs. The graph view works in a very similar fashion to NSTableView, NSOutlineView, and NSBrowser.

A datasource object provides all of the line data and attributes to display the graphed lines, points, or bars. A delegate object can respond to some methods for more control over the display and behavior of the graph view.

SM2DGraphView Copyright 2002-2003 Snowmint Creative Solutions LLC. http://www.snowmintcs.com/

Constants

NSForegroundColorAttributeName

NSString *NSForegroundColorAttributeName;

This is a key to be used in the -twoDGraphView:attributesForLineIndex: dictionary. The value represents what color the line will be drawn. If this key is not present, a default color will be used based on the zero based line index of the line.

The value should be an NSColor object. For example, [ NSColor redColor ].


SM2DGraphBarStyleAttributeName

NSString *SM2DGraphBarStyleAttributeName;

This is a key to be used in the -twoDGraphView:attributesForLineIndex: dictionary. If this key is present with any value, the line will be drawn as a series of bars instead of as a line.


SM2DGraphDontAntialiasAttributeName

NSString *SM2DGraphDontAntialiasAttributeName;

This is a key to be used in the -twoDGraphView:attributesForLineIndex: dictionary. If this key is present with any value, the line will not be anti-aliased. This does not affect lines with the bar style.

This was added in v1.1 of the framework.


SM2DGraphLineSymbolAttributeName

NSString *SM2DGraphLineSymbolAttributeName;

This is a key to be used in the -twoDGraphView:attributesForLineIndex: dictionary. The value represents the symbol that will be drawn at each data point. If this key is not present, no symbol will be drawn at the data points.

The value should be an NSNumber with an 'int' from the SM2DGraphSymbolTypeEnum enumeration. For example, [ NSNumber numberWithInt:kSM2DGraph_Symbol_Diamond ].


SM2DGraphLineWidthAttributeName

NSString *SM2DGraphLineWidthAttributeName;

This is a key to be used in the -twoDGraphView:attributesForLineIndex: dictionary. The value represents how thick the line will be drawn. If this key is not present, a default value of kSM2DGraph_Width_Default is used.

The value should be an NSNumber with an 'int' from the SM2DGraphLineWidthEnum enumeration. For example, [ NSNumber numberWithInt:kSM2DGraph_Width_Normal ].


Enumerations

SM2DGraphAxisEnum

typedef enum
{
    kSM2DGraph_Axis_Y = 0,
    kSM2DGraph_Axis_X = 1,

    kSM2DGraph_Axis_Y_Right = 2,
    kSM2DGraph_Axis_Y_Left = kSM2DGraph_Axis_Y
} SM2DGraphAxisEnum;

When dealing with various properties of graph axis, these constants should be used.

Constants

NameDescription
kSM2DGraph_Axis_YThe Y axis of the graph.
kSM2DGraph_Axis_XThe X axis of the graph.
kSM2DGraph_Axis_Y_RightY axis on the right side of the graph.
kSM2DGraph_Axis_Y_LeftY axis on left side of graph - equal to kSM2DGraph_Axis_Y.

SM2DGraphLineWidthEnum

typedef enum 
{
    kSM2DGraph_Width_None = 0,
    kSM2DGraph_Width_Fine = 1,
    kSM2DGraph_Width_Normal,
    kSM2DGraph_Width_Wide,
    kSM2DGraph_Width_3D,

    kSM2DGraph_Width_Default = kSM2DGraph_Width_3D
} SM2DGraphLineWidthEnum;

Width of lines in the graph.

Constants

NameDescription
kSM2DGraph_Width_NoneNo line is drawn; symbols may still be drawn.
kSM2DGraph_Width_FineLines are drawn a half pixel wide.
kSM2DGraph_Width_NormalLines are drawn one pixel wide.
kSM2DGraph_Width_WideLines are drawn two pixels wide.
kSM2DGraph_Width_3DLines are drawn with a fake 3D look; lighter line above and darker line below main line.
kSM2DGraph_Width_DefaultDefault width of lines - equal to kSM2DGraph_Width_3D.

SM2DGraphSymbolTypeEnum

typedef enum
{
    kSM2DGraph_Symbol_None = 0,
    kSM2DGraph_Symbol_Triangle,
    kSM2DGraph_Symbol_Diamond,
    kSM2DGraph_Symbol_Circle,
    kSM2DGraph_Symbol_X,
    kSM2DGraph_Symbol_Plus,
    kSM2DGraph_Symbol_FilledCircle,
    kSM2DGraph_Symbol_Square,
    kSM2DGraph_Symbol_Star,
    kSM2DGraph_Symbol_InvertedTriangle,
    kSM2DGraph_Symbol_FilledSquare,
    kSM2DGraph_Symbol_FilledTriangle,
    kSM2DGraph_Symbol_FilledDiamond,
    kSM2DGraph_Symbol_FilledInvertedTriangle,
    kSM2DGraph_Symbol_FilledStar,

    kSM2DGraph_Symbol_Default = kSM2DGraph_Symbol_None
} SM2DGraphSymbolTypeEnum;

Symbols that can be used on line style graphs. Does nothing for bar style lines.

Constants

NameDescription
kSM2DGraph_Symbol_NonePlain lines - no symbol marking points.
kSM2DGraph_Symbol_TriangleOpen triangle marking line points.
kSM2DGraph_Symbol_DiamondOpen diamond marking line points.
kSM2DGraph_Symbol_CircleOpen circle marking line points.
kSM2DGraph_Symbol_XX marking line points.
kSM2DGraph_Symbol_PlusPlus symbol marking line points.
kSM2DGraph_Symbol_FilledCircleFilled circle marking line points.
kSM2DGraph_Symbol_SquareSquare marking line points.
kSM2DGraph_Symbol_StarStar marking line points.
kSM2DGraph_Symbol_InvertedTriangleDown-pointing triangle marking line points.
kSM2DGraph_Symbol_FilledSquareFilled square marking line points.
kSM2DGraph_Symbol_FilledTriangleFilled triangle marking line points.
kSM2DGraph_Symbol_FilledDiamondFilled diamond marking line points.
kSM2DGraph_Symbol_FilledInvertedTriangleFilled down-pointing triangle marking line points.
kSM2DGraph_Symbol_FilledStarFilled star marking line points.
kSM2DGraph_Symbol_DefaultDefault symbol for lines - equal to kSM2DGraph_Symbol_None.

© 2003 Snowmint Creative Solutions LLC (Last Updated 9/4/2003)