2024年4月26日发(作者:)

Download source files - 381 Kb

Download demo projects - 200 Kb

Download control binaries - 72 Kb

Introduction

This is a simple OCX control, which allows you to plot two-dimensional data. Despite

the large set of controls that comes with VC++, there is no out-of-the-box control

that provides a simple and straightforward 2D data visualization. The ActiveX

control tutorial by Kapil Chaturvedi inspired me to write my own control, mostly

because I wanted to customize the source code when needed. Over time, the

functionality of the ActiveX control became more elaborate, and finally I made

decision to publish what I have in hand.

What Can It Do?

The control is able to plot a large number of points and updating one or more plots

on the graph with new data, replacing the old plot with the new plot. Multiple plots

with individual properties such as name, line and point style, width, could be

customized at runtime. At runtime, the control is capable of displaying its own

property pages (double click on the control area or by invoking the ShowProperties

method) and showing short help as a result of the user pressing F1 while the control

has the focus. By setting the TrackMode property you should be able to switch

between a different modes such as tracking cursor coordinates while moving (left

mouse button pressed), zooming, XY-, X-, and Y-panning. Finally the control

snapshot could be copied to the clipboard, printed, or saved as a bitmap file.

What doesn't it do?

You cannot plot 3D data, but you can use the NTGraph3D ATL/STL/OpenGL

activeX control to do that :-)!

What's New?

The Log Axes Mode works now, showing the log10 grid, and appropriated

labels, it also converts the graph element's data

The control's snapshot could be now saved as a bitmap file, many thanks to

Robert Harber for providing the code!

Added abilities to dynamically creating annotation labels, that can be on

different colors, orientations, and also could be hidden or visible.

Added "Annotations" property page that provides fully access to the

annotation list in the real/design mode.

Added abilities to dynamically drawing of multiply cursors, with a different

colors, crosshair styles, floating/fixed, or snapped to the currently selected

element!

Added "Cursors" property page that provides fully access to the cursor list in

the real/design mode.

Added axis formatting, that allows a customization of the bottom and left

axis labels.

Added "Format" property page that provides access to the axis format

properties, and a templates for of commonly used data formats such a:

Numbers, Exponential, Symbolic, Date, and Time!

 Added Time format for the graph axes. To use it, you should set the

XTime/YTime

property to

True

.

You also have to convert the date/time data to

double

format. The

Date/Time format is implemented as a as a floating-point value, measuring

days from midnight, 30 December 1899. So, midnight, 31 December 1899 is

represented by 1.0. Similarly, 6 AM, 1 January 1900 is represented by 2.25,

and midnight, 29 December 1899 is 1.0. However, 6 AM, 29 December 1899

is 1.25.

For more info refer to MSDN for the class:

COleDateTime

!

How to test the control

You can use the ActiveX Control Test Container, and load the macro from

the You can write your own routines to test the control

behavior (look at macro)