Note that the AxisChange() method call must be made any time you add or change the data. This tells ZedGraph to go
ahead and recalculate all the axis ranges. (Note: This is all AxisChange() does - you can call it anytime you like, and it
will update the axis ranges based on the current set of data points. You can also avoid calling AxisChange() if you do not
want the axes rescaled.)
The above code will generate the following output:
Enhancing the graph
ZedGraph allows you to modify the graph attributes in a wide variety of ways. Each of the parts of the graph is encapsulated in a
class structure, which has modifiable properties to control the output. The following are some of the classes provided in ZedGraph
(Note that these classes are XML documented. See the ZedGraph documentation for details about each class.):
Class Description
MasterP
ane
A class to manage multiple GraphPane objects, derived from PaneBase. Use of the MasterPane class is optional,
as the GraphPane class can be used directly for a single pane. Also provides methods for layout, arrangement, and
management of the individual GraphPane objects.
GraphPa
ne
The primary class for the graph, derived from PaneBase. Includes all other classes as properties. Also controls the pane
title, the pane frame and axis frame, backgrounds, etc.
XAxis,
YAxis,
Y2Axis
Children of the Axis class. These classes include many aspects of the axis display, including tics, grids, colors, pens,
fonts, labels, and styles.
Scale
A class instance maintained by the Axis class. Contains the scale range, step sizes, formats, and display options for the
scale. Comes in variants for Linear, Log, Text, Date, Ordinal, Exponent, LinearAsOrdinal, and
DateAsOrdinal scales.
Legend The class that describes the location, font, colors, etc., used to draw the legend.
CurveIt
em
An abstract base class that contains data for a single curve. LineItem, BarItem, HiLowBarItem,
ErrorBarItem, PieItem, StickItem, OHLCBarItem, and JapaneseCandleStickItem are all derived
from this class.
CurveLi
st
A collection class to maintain a list of CurveItem objects. The order of the curves in the list controls the Z-Order for
drawing. The last curve in the list will appear behind all other curves.
GraphObAn abstract base class that includes position information for a variety of supplemental graphic objects on a plot.