Win32 Custom Graphic Tool
The graphing control must be written in C/C++ using standard Win32 API. The graphing control must provide the ability to accurately display all data points through a number of specified data sources. In our case a C++ or C# test application will be used as data source.
The graphing control shall allow users to configure its properties in a manner consistent with the generic needs of custom graphing and plotting controls. That is, the user will specify the scale, limits on drawing region size, graph title, axis labels, and data elements in data sources to be plotted, plot line widths and colors, axis, etc.
Graphics Elements
The graphing control must be able to represent the following elements.
General
High Speed Design for Real Time Display of High Volume Data
Double Buffered Drawing Architecture
Window
This is a windows handle (HWND) passed to the control so that it may draw on it
The Window rectangle is indicated by the entire white area shown above
Size may be resized by the caller
X Extent
Xmin (minimum) to Xmax (maximum)
Y Extent
Ymin to Ymax
Range is specified by observations made of the data
X Axis
1-Pixel Solid Black Line
Always Drawn
X Axis Labels
Optional
Turn On/Off
Black Text Color
Some Common Labels Exist based on Data to be plotted
T
Cycles
Phase
X Axis Tick Marks
Proportional
Rounded Numbers based on X Extent
Turn On/Off (always on if X Axis Labels are On)
Configurable Maximum of ~6 to 8 Tick Marks Drawn
Y Axis
1-Pixel Solid Black Line
Always Drawn
Proportionally drawn in the Window rectangle based on the dimensions of the Window and the necessary text metrics needed to draw the various labels surrounding the remaining elements within the window. The intention is to maximize the Y Axis dimension while still showing as much detail as possible.
Y Axis Labels
Axis labels must be configurable for either rounded numbers or exact values
Turn On/Off
Black Text Color
Y Axis Tick Marks
Proportional
Rounded Numbers based on Y Extent or exact numbers based on user configuration setting
Turn On/Off (always on if Y Axis Labels are On)
Configurable Maximum of ~6 to 8 Tick Marks Drawn
XCross
1-Pixel Solid Black Line
Always Drawn
Data-appropriate “centerline” where the crossover between high and low values exist (Not necessarily a Zero Value!)
Border
1-Pixel Light Gray Line (RGB = 237, 237, 237)
Always Drawn
Encapsulates Right Side and Top Side of Graph
Grid
1-Pixel Light Gray Line (RGB = 237, 237, 237)
Turn On/Off
Axis match X and Y Axis
Plot Line(s)
Plot Lines will be Drawn in their respective colors
All Plots are scaled to match the drawing area scale
All Plot data to be drawn in the drawing area
Plot Data specified by Xmin-to-Xmax and Ymin-to-Ymax
Plot Line Width (aka thickness or weight) User Configurable
Some Default Line Widths Exist for Common Plots
Line Widths to range from 1-6 pixels
Probably a Maximum of 6 Different Plots per Graph Control
Legend
Dynamic sizing to conserve space
Color-coded to Plot Lines to be Drawn (Image shows more than lines drawn, but only those lines to be drawn would appear in the legend)
Probably a Maximum of 6 Different Legend Items per Graph Control
How to test this application (Naveen for now you can emit making this test application, you can have test application itself in win32 api if you want, put time for that)
Generally, the C# application wills instantiate the graphing control so that the application may have more than one instance of the control to display perhaps several different data streams on each control instance. The C# application will create a window and pass the window handle to the graphing control by way of a native call. The graphing control will need to establish its dimensional drawing area from the available space given to it by the high-level application window handle.
The graphing control will need to implement a “paint” method that the C# application may call from its own paint method so that the graphing control knows when the window region needs to be repainted.
The higher level application will need to be able to set the graphing control data source to be used for rendering plots.
The higher level application will need to be able to tell the graphing control to “start” and “stop” such that when an end user moves away from the screen(s) showing graphs that the graphing control may not necessarily be deallocated, but it isn’t consuming processor cycles updating windows that are not currently visible.
The higher level application must be able to tell the graph when to “scroll through” a “window amount” of data through the use of “+” and “-“ (increment and decrement) operations. (Not necessarily implemented using increment and decrement operators!) This feature is used solely in conjunction with static data residing in a Trend Data file.
User Characteristics
There are primarily two classes of users of the graphing control. The first is the high level application, which is responsible for instantiating the control, configuring it with any user settings desired for content display and setting the data source to be used for the data visualization (plotting). The high level application will also tell the control to start and stop rendering as needed.
The second is a low-level driver, who is the data producer. The data producer will create shared memory (buffers) that the graphing control will have to read from when the data producer signals it and when the high level application specifies that the data source is to be “instant” data, which means that it is sourced from live data acquisition.
It is very likely that the graphing control will need to at least have a callback routine that the driver’s interrupt service thread calls on to update the display region rather than using the high-level application’s thread when called from its paint method.
There are only programmer user classes when considering human interactions, other than those who will be seeing the data displayed on screen as users of the high level application. Application users will interact with the graphing control solely through their interactions with the high level application and will not directly access the graphing control
Possible scenarios
Not shown are several system (Win32) calls necessary to configure the memory-mapped fileBasically, if the data source is Instant, then the graphing control will need to map to the memory mapped file name used by the driver for Instant DMA Data. The filename will be specified from the caller in the SetDataSource operation.
The interactions with the trend file are straight-forward. The CreateFile call opens the trend data file specified from the caller in the SetDataSource operation.
The Configure operation is shorthand for the various configuration operations that may be invoked by the high-level application, such as ShowGrid( true ), SetXAxisLabel( “string” ), ShowXAxisLabel( true ), ShowTicks( true ), ShowTickLabels( true ), ShowGrid( true ), etc.