[Top]

SM2DGraphView Drawing Lines


Being a dataSource

The SM2DGraphView uses a metaphor of lines to draw the supplied data. You can draw as many lines on one graph as you wish. Each line is made of an array of points, and each line can have a set of attributes. The points on the line will be drawn in the order they are present in the array, and each point on that line will be drawn with that line's set of attributes. The attributes can be a color to use, a symbol to draw at the point, a line width, etc.

Each line can also have it's own scale on the graph; for example, on one graph you could draw a line with a y range from 5.2 to 10.0 and a line with a y range from -3.4 to -0.5. This capability is useful to draw graphs with different scales on the left and right vertical axes. The axis tick marks display information from the first line although the delegate object can implement -twoDGraphView:labelForTickMarkIndex:forAxis:defaultLabel: to return any string to display for the tick marks.

You must implement four of the five methods of the SM2DGraphDataSource protocol to be a dataSource for a graph view.

Being a delegate

A SM2DGraphView delegate object has a chance to change the tick mark labels drawn for the graph. It will also be called with the location of a user click on the graph. All of the methods of the SM2DGraphDelegate protocol are optional.



© 2002-2009 Snowmint Creative Solutions LLC (Last Updated 2009-04-13)