The Graph Control displays information sequentially left to right along the horizontal axis and is measured with respect to the vertical axis. For example, showing the sales figures per month would consist of the categorized month variable on the horizontal axis, and their respective sales would be measured against the vertical axis. The developer passes only one data-set, YData. Within the demo, see example 000 on how to implement a simple Graph control .
The Graph and Scientific Graph controls are designed to help your users assimilate their data. The developer can pass large amounts of data into the graph and the user can view the information in smaller/clearer increments via zooming or dialog adjustments. Zooming can be invoked by left-button dragging a zoom box. Once zoomed, the user can horizontally pan left and right via the horizontal scrollbar. Pressing the spacebar, the letter "Q", double-clicking, or right-mouse clicking are ways to invoke the customization dialog. This dialog allows for various forms of data-zooming via subset/point selection, and/or selecting the quantity of subsets/points to view. Depending upon the Scrolling Subsets adjustments, subset information can be viewed incrementally via the vertical scrollbar. See AllowZooming, ScrollingSubsets, and PointsToGraph.
Due to the data being sequentially plotted, the Graph control can display a table with or without an accompanying graph. This table is synchronized with the graph and as the user horizontally scrolls, the table and graph scroll together. See TableWhat. Note that the Scientific Graph uses both XData and YData and thus data can be plotted randomly within the charting region. For this reason, an automatic table can not be displayed with the Scientific Graph. It can however place data values next to data points, see GraphDataLabels.
The Graph, Scientific Graph, Polar/Smith, and the scatter mode of the 3D Scientific Graph control have a data comparison mechanism. This mechanism allows subsets to be plotted in two different styles along with the ability to make selected subsets permanent while scrolling through the remaining non-selected subset information. See ComparisonSubsets and RYAxisComparisonSubsets. For a more detailed discussion on Comparison Subsets, see Chapter 6: Comparison Subsets. Within the demo, see example 002.
Instead of using Comparison Subsets, optionally use PlottingMethods to control plotting method on a per subset basis. This property also designates whether the subset should be plotted with respect to the left, right, top and right, or top and left axes. If using this property, you will never set any of the Comparison Subset type properties. ComparisonSubsets, RYAxisComparisonSubsets, and TXAxisComparisonSubsets should all be zero when using PlottingMethods. Within the demo, see example 022.
ProEssentials Graph and Scientific Graph support multiple y axes with up to 32 y axes in 16 vertically stacked sub-graphs. Each sub-graph (we commonly call them Multi-Axes) can have a left and or right y axis, two plotting styles, and its own annotation layers. The Scientific Graph also supports two x axes, one at top and one at bottom. Any axis can be log or linear in any combination and all plotting styles work with log or linear scaling, including the best fit lines and curves. See MultiAxesSubsets and WorkingAxis. Clipping is enabled by default and can be disabled with DisableClipping.
ProEssentials takes multiple axes one more step and allows for overlapping multiple axes. This features groups axes in overlapping sections. The left and right y axes start growing outward as needed. This allows for sub-graphs (or Multi-Axes) to be superimposed where each axis can utilize the entire charting area or partial-area as needed. See OverlapMultiAxes. If all axes are overlapped into one region, there is support vertical scrolling in combination with overlapped multiple axes. See ScrollingVertZoom.
See Common Question 18 for more information on Multi-Axes. Within the demo, see examples 012, 013, 103 and 104.
The Graph and Scientific Graph support zooming across multiple-axes. Zooming can be restrained to either horizontal or vertical extents, or unrestrained allowing the user to drag a rectangle of any shape/size. If desired, the zoom-box rectangle can be used purely for user-interface. This allows the user to select an area of interest on the chart. You will use the ZoomIn event and ZoomMinX, ZoomMaxY, ZoomMaxX, and ZoomMinY properties to know where the user zoomed. You can also provide a line-drawing tool with this feature. See PEP_bZOOMINTERFACEONLY. Within the demo, see example 107.
ProEssentials has several methods of annotating a chart. These allow for mixing text and symbols in a tabular fashion within the chart or boundary of a chart. Table annotations can contain header columns and rows, hot spots, and real-time updating. The Graph, Scientific Graph, and Polar/Smith controls also support other annotation mechanisms. The PieChart control has only table annotation type properties. Annotations form the third layer of graphics in combination with the two plotting methods. It's simple to place lines, text, symbols, and shapes. Annotations can also be hot-spot locations and the user can toggle the annotations on and off via the customization dialog and popup menu. Horizontal line annotations can now contain one line feed to handle two lines of text. Graph Annotations have a paragraph annotation for annotating several lines of text. See TAType, GraphAnnotationType, HorzLineAnnotationType, VertLineAnnotationType, and XAxisAnnotation. Within the demo, see examples 015, 026, 027, 028, 029 and 030.
The Graph and Scientific Graph provide a data-cursor. This feature provides a horizontal line, cross-hair, or inverted block designating data-point focus. This cursor can be moved by the user by clicking another data-point or with the arrow keys. Up/Down keys revolve through data-series and the Left/Right keys move the focus to adjacent data-points. The developer can programmatically move the data-point focus. If programmatically moved out of view, the graph will automatically scroll left/right so the cursor is in view, much like a word-processor. The most commonly used will be PECM_FLOATINGXY which provides a floating cross-hair cursor which follows the mouse. In this mode, the cursor does not give a data-point the focus. See CursorMode, CursorSubset, and CursorPoint. Within the demo, see examples 028,105.
The Graph, Scientific Graph, and Polar/Smith controls handle Null-Data. The Null-Data value can be defined by the developer and the default Null-Data value is zero. Anytime ProEssentials sees a Null-Data value it is ignored. Since zero is the default Null-Data value, zero data values will be ignored by default. If you need to plot data where zero is a valid data value, then you must change the Null-Data value property. For a line/area graph, the line/area extends to the next non-null data point, forming a bridge across null-data. For bars/points, the bar/point will not be drawn. There is also a mechanism to form gaps rather than bridges for line graphs with Null-Data. See NullDataValue, NullDataGaps and LineGapThreshold. Within the demo, see example 006.
The Graph and Scientific Graph can be continuously fed data and a moving strip-chart can be implemented. This process is very easy to implement since setting AppendYData not only transfers the new data, but first shifts the existing data, appends the new data, and finally updates the image. Generally you will use AppendYData and related properties inside event code attached to a Timer control or WM_TIMER event. Note that the Scientific Graph takes a little more work to implement a real-time strip chart. Refer to the included example code for help with implementing your own data monitoring solutions. Within the demo, see examples 017, 020, 115, 116, 117, 118 and 119.
Date/Time handling is supported by the Graph and Scientific Graph. The Graph control can be configured so that a linear date/time calendar is placed along the x axis. This calendar scaling is dynamic and will change in structure as the user zooms inward. Because this mechanism is dynamic, its tough to also make it flexible, so this feature is purely automatic. This feature works much like the Scientific Graphs Date/Time handling except the time scale does not have to be continuous. The Scientific Graph has a continuous time scale limitation. For example, if you need to handle data from 8am to 4pm, Monday through Friday, this is perfect for use with the Graph control. The Scientific Graph must show a scale which includes all hours of the day and all days of the week. One note though with respect to the Graph control is that the data needs to be quantified in equal increments. If you dont have data for a particular time increment, you will have to supply a Null-Data value as a place holder. The Graphs Date/Time handling is great for financial developers and was added with financial developers in mind. See DateTimeMode, DeltaX, and DeltasPerDay. Within the demo, see examples 016, 030 and 106.
The axes can be formatted with dollar signs and commas marking thousands. For example, $1,400.00 can be automatically produced for a y axis grid number of 1400. See AxisFormatY. Event based axis formatting features allows the developer to programmatically construct grid number labels on a per grid line basis. See CustomGridNumbersY Within the demo, see examples 109 and 132.
Customization Dialog
|
|
|
The Graph control Customization Dialog allows the user to customize the Graph. The dialog is made up of tabs, with possible tabs of General, Plot, Subsets, Points, Axis, Font, Color, and Style. This dialog as well as other customization dialogs are invoked by either 1) the spacebar, 2) double-clicking the graph's desk area, 3) right-mouse clicking to show the popup menu, or 4) pressing the "Q" key to invoke the popup menu. See AllowUserInterface, AllowCustomization and AllowPopup.
We wont discuss every item on these dialogs but concentrate only on those which arent self explanatory. Its a good idea to have the demo running and open up the Graph controls customization dialog while reading the following sections.
Plot Style
The Graph control offers the following plotting methods: Line, Bar, Point/Scatter, Area, Area Stacked, Area Stacked Percent, Bar Stacked, Bar Stacked Percent, Points plus Best-Fit-Line, Points plus Best-Fit-Curve, Points plus Line, Points plus Spline, Spline, Step, Ribbon, Horizontal Bar, Horizontal Stacked Bar, High-Low Line, High-Low Bar, High-Low-Close, Open-High-Low-Close, Box Plot/Candlestick, and Histogram. See PlottingMethod.
The Graph and Scientific Graph support two plotting methods per left/right axis pair. Each axis pair can contain a primary plotting method and a secondary comparison plotting method. Comparison subsets are plotted in the secondary plotting method. See PlottingMethodII and ComparisonSubsets.
Display Graph plus Table
The Graph control can display a graph, a table, and both a graph and table. See GraphPlusTable.
Grid Lines
The user can choose to have both y axis (horizontal) and x axis (vertical) grid lines, or only y axis, x axis, or no grid lines. If Grid in Front of Data is checked, the grid is drawn after the plotting method, otherwise, the grid is drawn before the plotting method. See GridLineControl and GridStyle.
Subsets to Graph
This group consists of a listbox of subsets and scrollbar/slider controlling the Scrolling Subsets quantity. These allow the user to view subset information in a variety of ways.
-
If nothing is selected in the listbox and Scrolling Subsets equals zero, then the Graph will display all subsets.
-
If there are selections in the listbox and Scrolling Subsets equals zero, then the Graph will display only those subsets selected.
-
If nothing is selected in the listbox and Scrolling Subsets is non-zero, then the Graph will scroll through subset information (via the vertical scrollbar) by the amount defined by Scrolling Subsets.
- If there are selections in the listbox and Scrolling Subsets is non-zero, then the Graph will maintain those selected subsets as permanent subsets and revolve through the remaining subsets in increments of Scrolling Subsets.
The following table summarizes the Subsets to Graph variations.
Selected Subsets
|
Scrolling Subsets
|
Result
|
No
|
No
|
Display all subsets.
|
Yes
|
No
|
Display only those selected subsets.
|
No
|
Yes
|
Scroll through all subsets.
|
Yes
|
Yes
|
Permanent selected subsets & scroll remaining subsets.
|
See ScrollingSubsets and RandomSubsetsToGraph.
Points to Graph
This group allows the user to view point information in a variety of ways.
If Sequential is selected, then the Graph control will display the number of points specified. If the number of points specified is less than the total number of points contained in the control, there will be a horizontal scrollbar allowing the user to scroll through the remaining point information. If Selected is chosen, then the user uses the listbox to select only those points to include into the image. See PointsToGraph, RandomPointsToGraph.
Axis
This group allows the user to view axes as linear or log. It also allows the user to adjust how the axis range is determined. Possible selections are Automatic, Manual Min, Manual Max, and Both Manual Min and Manual Max. See YAxisScaleControl and ManualScaleControlY. Note that if using multiple y axes or chart is zoomed, the Axis tab is not visible. Within the demo, see example 112 and 110.
Style
This group allows the user to adjust a subsets color, line style, and point style. Double clicking the color selection box will invoke a custom color selector. See SubsetColors, SubsetLineTypes, and SubsetPointTypes.
|