home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
chart101.zip
/
README
< prev
next >
Wrap
Text File
|
1995-07-12
|
233KB
|
6,842 lines
THE DEVELOPER'S BUSINESS GRAPHICS TOOLKIT
for OS/2 Presentation Manager and Windows 3.0
(OS/2 32-bit mini-release)
THIS SOFTWARE IS COPYRIGHTED AND AS SUCH, ONLY THE CROSSLEY GROUP MAY
AUTHORIZE ITS DISTRIBUTION, USE WITHIN OTHER PRODUCTS, OR USE ON SYSTEMS
WHICH ARE DEEMED END USER SYSTEMS AND NOT DEVELOPMENT SYSTEMS.
Copyright The Crossley Group, Inc. 1990, 1991, 1992, 1993, 1994, 1995
THE DEVELOPER'S BUSINESS GRAPHICS TOOLKIT
for OS/2 Presentation Manager and Windows 3.0
(OS/2 32-bit mini-release)
Description Page
════════════════════════════════════════════════════════ ═════
Product Overview 1
Sample Programming for OS/2 PM 12
API Technical Descriptions & Synopsis 18
ChartAnnotate .......................................... 18
ChartAnnotatePaint ..................................... 20
ChartAnnotateRelease ................................... 21
ChartAnnotateDestroy ................................... 22
ChartClipboard ......................................... 23
ChartCreate ............................................ 24
ChartData .............................................. 28
ChartDataAppend ........................................ 30
ChartDataUpdatePoint ................................... 31
ChartDataHighlight ..................................... 33
ChartDestroy ........................................... 34
ChartGetData ........................................... 35
ChartGetDisplacement ................................... 36
ChartGetLastError ...................................... 37
ChartGetValue .......................................... 38
ChartLegend ............................................ 39
ChartOptions ........................................... 40
ChartOutputMetaFile .................................... 40
ChartPaint ............................................. 41
ChartPrint ............................................. 42
ChartQueryDimensions ................................... 44
ChartQueryExtendedError ................................ 44
ChartQueryGroupColor ................................... 45
ChartQueryLocation ..................................... 46
ChartQueryOptions ...................................... 49
ChartQueryPointer ...................................... 50
ChartQueryTextFontSize ................................. 53
ChartQueryTextFontSizes ................................ 53
ChartQueryType ......................................... 53
ChartQueryVersion ...................................... 53
ChartSendMsg ........................................... 54
ChartSendMsgVP ......................................... 64
i
ChartSendMsgPV ......................................... 65
ChartSendMsgPP ......................................... 66
ChartSetColor .......................................... 67
ChartSetColorTable ..................................... 70
ChartSetCountryCode .................................... 71
ChartSetDimensions ..................................... 73
ChartSetFont ........................................... 74
ChartSetFrame .......................................... 74
ChartSetGroupColor ..................................... 75
ChartSetGroupCount ..................................... 77
ChartSetGroupLineType .................................. 78
ChartSetGroupMarker .................................... 80
ChartSetGroupPattern ................................... 82
ChartSetGroupRGB ....................................... 82
ChartSetGroupStyle ..................................... 83
ChartSetLineType ....................................... 85
ChartSetLineWidth ...................................... 87
ChartSetMarker ......................................... 88
ChartSetMaxXValue ...................................... 88
ChartSetMaxYValue ...................................... 88
ChartSetMaxZValue ...................................... 88
ChartSetMinYValue ...................................... 89
ChartSetMinZValue ...................................... 89
ChartSetNormalDataScope ................................ 89
ChartSetOptions ........................................ 90
ChartSetPattern ........................................ 90
ChartSetPointCount ..................................... 91
ChartSetRect ........................................... 92
ChartSetRegions ........................................ 94
ChartSetRGB ............................................ 94
ChartSetSymbolGroup .................................... 94
ChartSetTableFormat .................................... 94
ChartSetTextFontSize ................................... 95
ChartSetTicks .......................................... 95
ChartSetTimeRange ...................................... 95
ChartSetTimeReference .................................. 96
ChartSetType ........................................... 97
ChartSetWindow ......................................... 99
ChartSetXTicks ......................................... 100
ChartSetXTicksFloat .................................... 102
ChartSetXTicksString ................................... 103
ChartSetXTicksStringBasic .............................. 105
ChartSetYTicksString ................................... 107
ChartSetZAxisGroup ..................................... 108
ChartText .............................................. 109
ChartTexts ............................................. 111
ChartVisible ........................................... 113
Installation ............................................... 115
Compiling and Linking you program ......................... 115
The Sample Program ......................................... 115
ii
THE DEVELOPER'S BUSINESS GRAPHICS TOOLKIT
for OS/2 Presentation Manager and Windows 3.0
The Developer's Business Graphics Toolkit is a toolkit to help
application developers integrate two- and three-dimensional business
graphics into their application programs. This toolkit is provided FREE
to you to use and distribute on an as is basis. As this is being
provided FREE, there is NO product support provided. Further, the number
or data groups/series, the number of data points for each group/series
that can be displayed and the number of different chart types are the
only functional limitations placed on the mini-release of this software.
The maximum number of data groups/series is limited to three and the
maximum number of points for any group/series is four. As a final point
not all of the APIs are documented in this electronic documentation
package. A fully functional and documented toolkits are sold by The
Crossley Group, Inc. (USA). The company can be reached by telephone at
1-404-751-3704 or FAX 1-404-751-3704. While this package you received
contains only support for 32-bit OS/2 development, other products are
available for 16-bit OS/2, 16-bit Windows and 32-bit NT and Windows 95
support. The Crossley Group will answer questions you might have via
CompuServe 72103,2013 or Internet crossley@atlanta.com user id.
THIS SOFTWARE IS COPYRIGHTED AND AS SUCH, ONLY THE CROSSLEY GROUP MAY
AUTHORIZE ITS DISTRIBUTION, USE WITHIN OTHER PRODUCTS, OR USE ON SYSTEMS
WHICH ARE DEEMED END USER SYSTEMS AND NOT DEVELOPMENT SYSTEMS.
The heart of the toolkit is an intelligent graphics engine provided
as a Dynamic Link Library (DLL). High level Application Programming
Interfaces (APIs) are issued to bridge to this DLL. Business
graphics can be incorporated into new or existing applications with
minimal code supplied by the developer. The high-level APIs
eliminate the need to learn GPI function calls. This product was
designed to ensure end user appeal and ease of developer
implementation.
The Developer's Business Graphics Toolkit allows the developer to
select from many chart type presentations. Many of the chart types
can be displayed in either two or three dimensions on the display.
Also, many of the chart types support a time-based or real time
implementation that will be describe later in more detail.
The toolkit supports many languages and tools currently in use, as
well as IBM's National Language Support. Languages currently
supported include English, French, German, Italian, Spanish, and
Swedish, Japanese, Fenish and Glasnost cyrillic. Other languages
will be implemented based on customer requirements.
1
Charts types are specified through the use of symbolic notation. The
following lists the chart type symbolic values and brief descriptions
for each chart type.
┌───────────────────────────┬──────────────────────────────────────────┐
│ │ │
│ Symbolic Value │ Chart Description │
│ │ │
├───────────────────────────┼──────────────────────────────────────────┤
│ │ │
│ CH_BAR │ Vertical bars │
│ CH_STACKED_BAR │ Vertical stacked bars │
│ CH_COLUMN │ Vertical stacked bar summation │
│ CH_LINE │ Line (supports line types) │
│ CH_SMOOTH_LINE │ Smooth line (solid lines only) │
│ CH_SCATTER │ Marker symbols │
│ CH_AREA │ Line charts with filled downward │
│ CH_PIE │ Summarized groups │
│ CH_PER_BAR │ Vertical bars in perspective view │
│ CH_BAR_LINE │ Vertical bars, last group is a line │
* │ CH_NUMERIC_TABLE │ Spread sheet view of your data │
* │ CH_SYMBOL_TABLE │ Marker symbols in a spread sheet │
│ CH_SPIKE │ Marker symbols with a line downward │
│ CH_SQUARE_WAVE │ Engineering square wave │
│ CH_HISTOGRAM │ Vertical bars groups together │
* │ CH_RANGE │ Stock charts (3-types) │
│ CH_HORIZONTAL_BAR │ Horizontal bars │
│ CH_HORIZONTAL_STACKED_BAR │ Horizontal stacked bars │
* │ CH_PLOT │ Drawing using plotter techniques │
* │ CH_OVERLAP_BAR │ Vertical bars which overlap │
* │ CH_CONNECTED_SCATTER │ Marker symbols with vertical connection │
│ CH_BAR_GOAL │ Vertical bars, last group square wave │
* │ CH_X_PLOT │ Marker symbols with x-axis offsets │
* │ CH_MIXED │ Combinations - lines, hi/low, markers │
* │ CH_FLOAT_BAR │ Vertical floating bars │
* │ CH_FLOAT_STACKED_BAR │ Vertical bars for a financial portfolio │
* │ CH_MATRIX │ Marker symbols with x-axis scales │
│ CH_STACKED_AREA │ Area chart with groups/series stacked │
│ │ │
└───────────────────────────┴──────────────────────────────────────────┘
* AVAILABLE ONLY IN THE FULL PRODUCT
2
While there are over 25 different type of charts which can be
displayed, not all charts are displayed or processing in the same
manner. Some charts can be displayed only in 2 dimensions, while
other charts are displayed in only 3 dimensions and finally a third
class of chart can be displayed in either 2 or 3 dimensions.
As is true with the number of visual dimensions in which a chart
may be viewed, not all of the charts support real time or time based
implementations.
The following table describes the current implementation level of
each of the different type of charts supported.
┌───────────────────────────┬────────────┬────────────┬────────────────┐
│ │ │ │ │
│ Symbolic Value │ Dimensions │ Time Based │ Real Time │
│ │ │ │ │
├───────────────────────────┼────────────┼────────────┼────────────────┤
│ │ │ │ │
│ CH_BAR │ 2-3 │ YES │ YES │
│ CH_STACKED_BAR │ 2-3 │ │ │
│ CH_COLUMN │ 2-3 │ │ │
│ CH_LINE │ 2-3 │ YES │ YES │
│ CH_SMOOTH_LINE │ 2 │ YES │ YES │
│ CH_SCATTER │ 2 │ YES │ YES │
│ CH_AREA │ 2-3 │ YES │ │
│ CH_PIE │ 2-3 │ │ │
│ CH_PER_BAR │ 3 │ │ YES │
│ CH_BAR_LINE │ 2-3 │ │ YES │
│ CH_NUMERIC_TABLE │ 2 │ │ YES │
│ CH_SYMBOL_TABLE │ 2 │ │ YES │
│ CH_SPIKE │ 2 │ │ YES │
│ CH_SQUARE_WAVE │ 2 │ │ YES │
│ CH_HISTOGRAM │ 2-3 │ │ │
│ CH_RANGE │ 2 │ YES │ │
│ CH_HORIZONTAL_BAR │ 2-3 │ │ │
│ CH_HORIZONTAL_STACKED_BAR │ 2-3 │ │ │
│ CH_PLOT │ 2 │ │ YES │
│ CH_OVERLAP_BAR │ 2-3 │ │ │
│ CH_CONNECTED_SCATTER │ 2 │ ONLY │ │
│ CH_BAR_GOAL │ 2-3 │ │ YES │
│ CH_X_PLOT │ 2 │ │ YES │
│ CH_MIXED │ 2 │ YES │ │
│ CH_FLOAT_BAR │ 2-3 │ │ │
│ CH_FLOAT_STACKED_BAR │ 2-3 │ │ │
│ CH_MATRIX │ 2 │ │ │
│ CH_STACKED_AREA │ 2-3 │ │ │
│ │ │ │ │
└───────────────────────────┴────────────┴────────────┴────────────────┘
3
For the application to display a chart the developer must provide a
window or portion of a window in which the chart will be shown.
The Developer's Business Graphics Toolkit DOES NOT create a window.
It is the responsibility of the developer to create the appropriately
sized window for the chart and any application data space. The
window handle returned to the developer is a parameter for the
Developer's Business Graphics Toolkit. While the size and placement
of the chart within the window will be discussed later, the business
chart does not necessarily occupy an entire window.
The toolkit DOES NOT respond to any messages associated with a
window. It is the responsibility of the developer to respond
appropriately to these window messages. For example, in processing a
WM_CREATE message and a WM_PAINT message, the developer can create
and paint the business chart with The Developer's Business Graphics
Toolkit.
Charts can be shown in a complete window with other application data,
in scrollable windows, or in dialog boxes. Creating a chart instance
is similar to creating a system window using the "ChartCreate" API.
The developer provides this API with a handle for the window and the
coordinates within the window to display the chart. Defaults are
provided for the percentage of space allocated to headings, footings,
margins, and the central graphic area. Developers, using their own
percentages, can dynamically change the amount of space assigned to
these areas to meet their specific goals. The DLL automatically
handles all scaling of the text and graphic images.
Using data arrays, the developer then provides data to the chart.
The chart supports a maximum of (in the full product)12 data arrays
(representing groups) and an unlimited number of data points per
array. Data arrays supported include SHORT, USHORT, LONG, ULONG,
float and double data types. Each data group requires a separate
request through the "ChartData" API. The graphics engine retains the
specified data in system dynamic storage until the data is changed or
the chart is destroyed. Besides specifying a pointer to the data
array, the developer can provide an ASCIIZ string that represents the
text legend for each data group.
The "ChartSetXTicks" API provides automatic x-axis text values. For
example, if the data to be presented reflects the last three months
of 1994, the developer can specify that the x-axis be displayed in
months, starting with the tenth month. The chart shows the months of
October, November, and December. If the developer provides more than
three data points, the chart continues with January as the fourth
month and follows through the next year as long as data is provided.
If the chart does not have enough width to accommodate the entire
spelling of the months, the DLL shifts into an abbreviation mode,
such as "Dec" or "D" for the month of December. The x-axis text is
also provided for English, French, German, Italian, Spanish, and
Swedish languages. When the DLL does not provide the type of text
required, the developer can provide a text array that can serve as an
extension to the graphics engine.
4
The developer can provide the chart heading, footing, left margin,
and right margin text to the chart using one request to the
"ChartSetTexts" API. These also can be specified individually
through a "ChartSetText" request. The developer issues a
ChartVisible API call to make the chart visible to the user.
There is a "ChartSetRect" function call to support the user's ability
to resize a window. This call informs the graphic chart that the
amount of real estate for the chart has changed. The chart is then
redisplayed through the "ChartVisible" or "ChartSetType" function
request. The "ChartSetType" API enables the developer to change the
current type of chart to another chart type. The data, headings, and
other information have been retained by the DLL, no additional steps
are required.
Axis scaling
═════════════
The Y-axis and Z-axis (an axis opposite the y-axis) support manual or
automatic scaling for positive and negative data, including floating
point. Automatic X-axis application-specific element support
includes: general numbering (0 to n); calendar (days, weeks, months,
years); time (seconds, minutes, hours); military/international hours;
and accounting cycles (30, 60, 90, etc.). Programmer defined ASCIIZ
string values and floating point values for the X-axis is also
supported. Data is summarized automatically and percentages
displayed for pie and column charts. The developer can specify chart
text, such as titles, footnotes, margins, and data legends. Fonts
re-size automatically in the client chart areas. Besides using the
standard sixteen colors, developers can specify any RGB color, of
which their display is capable, to enhance the graphic chart.
Coloring the chart
══════════════════
Each data group has a specific pair of colors assigned to it by
default. For example, data group one is assigned red and dark red
(for the shadowing effects of 3-D charts). The developer can change
these defaults to any of the standard sixteen colors or specify RGB
values to be associated with a data group. Colors can also be
specified for all other portions of the chart. This includes, but is
not limited to, the text, tick marks, chart background, and the
graphic background.
5
Calculations
════════════
Besides extensive automatic scaling facilities, the DLL will provide
automatic summations of data to display percentages for the column
and pie charts. The developer does not have to perform these
summations or calculations. For example, to change a bar chart to a
pie chart, the developer simply calls the "ChartSetType" function
call. The data provided to the bar chart is recalculated,
summarized, and then displayed as a pie chart. In support of the
stacked bar and column charts, the graphics engine will sort the data
by ascending magnitude if requested by the developer. This sort,
performed in memory, requires no disk files or disk activity.
Text and legend(s) placement
════════════════════════════
The graphics engine centers and aligns all text within the chart
area. It does this through internal font size balancing algorithms.
It is dependent upon the amount of graphic space available. For
example, a chart consisting of four data groups or legends may show
the four legends placed side by side, or in two groups of two. The
placement is based on such considerations as available chart width,
height, and the characters in the legend text. The DLL will
sacrifice certain text when the window is too small for the smallest
system font. The DLL's goal is to provide as much data as possible
in the space available.
Messages and When to Paint
══════════════════════════
The graphics engine, or DLL, does not post or send any messages to
the developer's application. The developer must specify when to
repaint the graphic chart through the "ChartVisible", "ChartPaint" or
"ChartSetType" APIs. The graphics engine does not create any windows
to accomplish its tasks. It uses only GPI function calls to achieve
its goals. The "ChartDestroy" API removes the chart instance. The
application window belongs to the developer and the graphics engine
is merely a high-level support service.
Real Time Applications
══════════════════════
This section describes the concept of data display in real time
applications. The "ChartDataAppend" API allows the developer to add
continuing data points to an existing chart. The application
developer can add these data points to a data group without
repainting the graphic chart. The chart is repainted when the Y-axis
maximum or minimum is exceeded. The chart types supported by the
ChartDataAppend function are: BAR, PERSPECTIVE BAR, SCATTER, LINE,
SMOOTH LINE and a few others.
6
The "ChartDataAppend" function can overlay previously displayed data
bars. The developer must be aware of the painting characteristics of
the bar chart and the perspective bar chart to prevent an overlay
error.
The bar chart is painted from the left to the right on the X-axis.
The ChartDataAppend function parameters must be: data group 1/ point
1; followed by data group 2/ point 1; followed by data group 3/point
1; etc.; followed by data group 1/ point 2; followed by data group 2/
point 2; followed by data group 3/ point 2; etc.
The perspective bar chart is painted from the back (highest group
number) to the front (data group 1) of the chart. The data group
points are painted from the left to the right. The ChartDataAppend
function parameters must be: data group 8/ point 1; followed by data
group 7/ point 1; followed by data group 6/ point 1; etc,; followed
by data group 8/ point 2; followed by data group 7/ point 2; followed
by data group 6/ point 2; etc.
Two group data points must be received for the line to be painted on
a line chart and smooth line chart.
Tactile Feedback / Hot Spot
═══════════════════════════
This section describes the tactile feedback function of the API
"ChartQueryPointer". This API allows the developer to pass certain x
and y coordinates to the graphics DLL for "hot spot" resolution. The
application program can respond with a course of action when a
coordinate receives a mouse click.
The developer supplies the CH_TOUCH parameter flag to either the
"ChartCreate" or "ChartSetOptions" function calls. The chart will
record the "hot spot" coordinates in dynamic memory until the chart
is either repainted, destroyed, or the flag option is removed.
Range Charts
════════════
The graphics engine also supports a category of "range charts". Three
range sub-type charts, high/low, candlestick and point & figure
charts are supported. The high/low and candlestick charts can be
represented in time based form.
Range charts are normally used for daily tracking of stocks,
commodities, bonds and other financial instruments. However, it
should be noted that these charts have applicability to industries
such as medical, for blood pressures, or manufacturing for average
process or production ranges.
7
High/low charts can be drawn with or without open and close.
Candlestick charts require that the developer supply four data
entries (low,high, open and close) for each data display symbol.
Point & figure charts require only one data entry for each data
display symbol.
Display and algorithmic details for the range family of charts are
outside the scope of this toolkit. The developer is advised to
consult available technical sources to further understand these chart
sub-types.
Time Based Charts
═════════════════
Time based charts provide true calendar base information to the user
across the x-axis of a chart. Data points occurring during a
specified time span are displayed in the appropriate time locations
of the chart. Data points in relation to tick marks are not equally
spaced as with other charts.
After issuing the "ChartData" API, the time values corresponding to
these data points must be provided by the developer. The time based
entries need not be in time sequence. The charting engine will
determine the correct orientation for each data point individually.
Passing the point/data timing information to the charting engine is
accomplished using the "ChartSetTimeReference" API.
The x-axis text normally generates two line of text. Time based
charts need additional free space in the right and frequently in the
footing area. With the implementation of CH_TIME_BASED flag, the
charting engine defaults to the region settings used for a
perspective bar chart, even if the application program never displays
such a chart. Take note that, if the x-axis text does not appear
during the display of the graphic, the developer should insure that
an adequate graphic area is available. This is done by making the
total charting area larger than normally used for other charts.
The time span is determined by either the charting engine or the
developer. The developer can control the earliest and latest times
expressed on the x-axis using the "ChartSetTimeRange" API. This API
instructs the charting engine to display only those data points which
fall within the specified time range. If this API is not used, the
system will use the earliest and latest time values provided in the
"ChartSetTimeReference" API to determine the extent of the x-axis
information.
Time based graphic charts support time ranges from 90 seconds to
7,000 years.
8
Clipboard, MetaFile and Printing
════════════════════════════════
Business graphics charts can be sent to the system clipboard with the
"ChartClipboard" API. Charts can also be saved to disk with the
"ChartOutputMetaFile" API. At a subsequent point in time, the
metafile can be replayed, printed, or included into a document
through metafile support. The "ChartPrint" API supports printing.
This API defaults to the system default printer.
Chart Fonts
═══════════
For the text displayed on a chart, the Helvetica font is used. The
font size is dependent on the total chart percentage for a specified
area. The scaling is automatic and requires no input from the
developer. These are fixed default settings.
Special mention should be made regarding the footing area for text
ticks and data legends. The presentation in this area depends on
such factors as: the percentage of chart specified for the footing,
the number of data group legends and the text string length.
As an example, assume a chart is created reflecting data generated
for five week days (Monday through Friday). Changing any one of the
factors mentioned above could result in the following displays for
the x-axis text ticks.
M T W T F
or
Mon Tue Wed Thu Fri
or
Monday Tuesday Wednesday Thursday Friday
The following example assumes a chart is created reflecting five data
groups with data and a legend assigned to each. Changing any one of
the factors mentioned above could result in the following displays
for the data legend.
Legend 1 Legend 2 Legend 3 Legend 4 Legend 5
or
Legend 1 Legend 2 Legend 3
Legend 4 Legend 5
9
Video displayed text uses the system provided Helvetica raster fonts.
Printed text or text placed into a metafile use vectored Helvetica
fonts. The "ChartSetFont" API provides the programmer with the
ability to change either the raster or vector fonts.
ChartRegions Defaults and Philosophy
════════════════════════════════════
This section describes the default settings used during the
"ChartCreate" function call and the calculation philosophy to change
those regions using the "ChartSetRegions" function call. The five
sub-areas of a client area chart are as follows:
┌────────────┬───────────────────────┬────────────┐
│ │ │ │
│ │ HEADING AREA │ │
│ │ │ │
├────────────┼───────────────────────┼────────────┤
│ │ │ │
│ │ │ │
│ LEFT │ │ RIGHT │
│ MARGIN │ GRAPHIC AREA │ MARGIN │
│ │ │ │
│ │ │ │
│ │ │ │
├────────────┼───────────────────────┼────────────┤
│ │ │ │
│ │ FOOTING AREA │ │
│ │ │ │
└────────────┴───────────────────────┴────────────┘
The heading, graphic and footing areas will be the initial focus of
this section. The left and right margins will be addressed later.
The parameters of a chart are percentages of the total chart, not
pixels or inches. With the "ChartCreate" function call, these
parameters will generally default of heading=13%, graphic=67%, and
footing=20%. For aesthetic balance and presentation style, the
sub-area parameters can be changes with the "ChartSetRegions"
function call.
The percentages passed to the "ChartSetRegions" function are
validated for general reasonableness. Sometimes, "ChartSetRegions"
may initiate a default setting. It is not necessary, though
advisable to specify the parameters for all three sub-areas. The
calculations for the unspecified sub-areas will be made by the
charting engine. The "ChartSetRegions" function provides artificial
intelligence for minor miscalculations if the three specified
parameters total more or less than 100%.
10
The following chart shows the effect speechified parameters will have
on the chart results. X, Y, and Z represent the specified parameters:
┌──────────────────────────────────────┐ ┌─────────────────────────────┐
│ AREA INPUT % │ │ AREA RESULT % │
├────────┬─────────┬─────────┬─────────┤ ├─────────┬─────────┬─────────┤
│ if │ GRAPHIC │ HEADING │ FOOTING │ │ GRAPHIC │ HEADING │ FOOTING │
├────────┼─────────┼─────────┼─────────┤ ├─────────┼─────────┼─────────┤
│ │ X │ NULL │ NULL │ │ 90 │ 5 │ 5 │
│ │ NULL │ X │ NULL │ │ 100-X-5 │ X │ 5 │
│ │ NULL │ X>70 │ NULL │ │ 25 │ 70 │ 5 │
│ │ NULL │ NULL │ X │ │ 100-X-5 │ 5 │ X │
│ │ NULL │ NULL │ X>70 │ │ 25 │ 5 │ 70 │
│ │ X │ NULL │ Y │ │ X-5 │ 5 │ Y │
│ │ X │ Y │ NULL │ │ X-5 │ Y │ 5 │
│ │ X │ Y │ Z │ │ X │ Y │ Z │
│(X+Y)<70│ NULL │ X │ Y │ │ 100-X-Y │ X │ Y │
│(X+Y)>70│ NULL │ X │ Y │ │ 67 │ 13 │ 20 │
└────────┴─────────┴─────────┴─────────┘ └─────────┴─────────┴─────────┘
While the above may appear to be complex, the actual implementation
is as easy as 1, 2, 3.
Left and Right Margins
══════════════════════
The amount of space allocated to the left and right margin depends on
the type of chart specified during the "ChartCreate" function call.
In a pie chart display, both the left and right margins default to 8
percent of the total chart width. The perspective bar and the
bar/line charts default to 20 percent for both the left and right
margins. Area chart margins default to 20 percent for the left
margin and 10 percent for the right. The defaults for all other
chart types are left, 20 percent, and right, 5 percent. The width of
the graphic area changes in relationship to the amount of space
allocated, by the developer, to the left and right margins.
Information Messages
════════════════════
Developer information messages, specifying invalid parameters passed
to APIs, is provided in the full product. A system modal dialog box
is presented by the graphics DLL when an API encounters an error.
The dialog box identifies the API name and indicates the parameter in
error. THIS FEATURE IS ONLY AVAILABLE WITH THE FULL FUNCTION
PRODUCT. ─────────────────────────────────────────────────────
───────
11
Assumptions about the developer
═══════════════════════════════
This toolkit assumes the developer has minimal C programming
experience and understands programming concepts. The programmer
should have experienced creating a window and processing its
associated messages. An experienced programmer can make the API
bridges to utilize this toolkit with languages other than C.
OS/2 and Presentation Manager are registered trademarks of
International Business Machines Corporation. They are cited here
solely for the purpose of identification.
Windows 3.0 is a registered trademark of Microsoft Corporation. It
is cited here solely for the purpose of identification.
Language Support
════════════════
The toolkit supports many popular programming languages such as C,
C++, PASCAL, COBOL and many others.
Application Programming Interface
═════════════════════════════════
The Developer's Business Graphics Toolkit consists of approximately
80 API function calls. The application programmer typically will use
only six or seven to produce a graphic chart presentation. The
remaining function calls are used to perform more exotic tasks. The
APIs use C programming notation. No messages are sent for the
application programmer to process. The six API function calls used
as a foundation for a business chart are as follows:
ChartCreate Establishes a chart "object"
ChartData Provides the chart with data
ChartSetXTicks Sets the chart time span
ChartTexts Provides textual headings and margins
ChartPaint Shows the chart to the user
ChartSetRect Supports user window reseizing
The following code segments illustrates how to create and display a
basic 3 dimension bar chart.
12
APPLICATION INITIALIZATION FOR PRESENTATION MANAGER
═══════════════════════════════════════════════════
Creating your main program window should follow normal Presentation
Manager conventions, such as identifying any window procedures.
#define CHART_OS2_32
#include <CHART.H> /* Business graphics identifiers */
MRESULT EXPENTRY MyWindowProc(HWND ,ULONG ,MPARAM ,MPARAM );
Start your main program procedure, identify any required static program
area, and perform the normal Presentation Manager housekeeping chores.
static HAB hab; // PM anchor block handle
static HWND hwndFrame; // Frame window handle
static HWND hwndClient; // Client area window handle
int main(void)
{
HMQ hmq; // Message queue handle
QMSG qmsg; // Message from message queue
ULONG flCreate; // Window creation control flags
HWND hwndGraphClient; // Client area window handle
hab = WinInitialize(0L); // Initialize PM
hmq = WinCreateMsgQueue(hab, 0); // Create a message queue
WinRegisterClass( // Register window class
hab, // Anchor block handle
"PrWindow", // Window class name
(PFNWP)MyWindowProc, // Address of window procedure
CS_SIZEREDRAW, // Class Style
0 // No extra window words
);
flCreate = FCF_TITLEBAR|FCF_MENU|FCF_SIZEBORDER|FCF_MINMAX|FCF_SYSMENU|
FCF_TASKLIST|FCF_ICON|FCF_SHELLPOSITION|FCF_ACCELTABLE;
hwndFrame = WinCreateStdWindow(HWND_DESKTOP, // Desktop window is parent
WS_VISIBLE, // No frame styles
(PULONG)&flCreate, // Frame control flag
"PrWindow", // Client window class name
"", // No window text
0L, // No special class style
0L, // Resource is in .EXE file
ID_WINDOW, // Frame window identifier
(PHWND)&hwndClient // Client window handle
);
13
APPLICATION TERMINATION FOR PRESENTATION MANAGER
════════════════════════════════════════════════
The developer should perform the normal Presentation Manager message
queue processing and termination activities.
while (WinGetMsg(hab, (PQMSG)&qmsg, (HWND)NULL, 0, 0))
WinDispatchMsg(hab, (PQMSG)&qmsg);
WinDestroyWindow(hwndFrame); // Tidy up...
WinDestroyMsgQueue(hmq); // and
WinTerminate(hab); // terminate the application
}
14
APPLICATION CHART CREATION
══════════════════════════
The next section of the application program processes the Presentation
Manager messages from the message queue. The beginning of the window
procedure identifies any procedure variables and starts the initial message
processing. The first window command to be addressed is the WM_CREATE
message. Five steps are required for the processing of a create message:
obtaining the size of the client area, creating the business graphic chart
type (i.e. standard bar chart), specifying the x-axis data point text
identifiers, priming the bar chart with data, and providing a chart
heading/title text string and left/right margin text string. Any of these
functions could be accomplished at other points in time in a typical
application.
MRESULT EXPENTRY MyWindowProc(HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2)
{
HPS hps; // Presentation Space handle
USHORT command; // WM_COMMAND value for switch(?)
RECTL ClientRctl; // Size of client window
static HWND hChart; // Chart window handle
static USHORT errors // Business graphics errors
static USHORT data1[] = {250, 900, 600};// Data group 1 points
static USHORT data2[] = {500, 700, 458};// Data group 2 points
switch (msg) {
case WM_CREATE :
// Get the size of the client window (PM will return 0's
WinQueryWindowRect(hwnd, &ClientRctl);
// Create the bar chart instance
hchart = ChartCreate(hwnd,CH_BAR,CH_GRAPHIC_FRAME | CH_Y_GRID,
&ClientRctl,&errors,CH_DATA_USHORT,2,3,3);
// Set x-axis time text information
ChartSetXticks(hChart,CH_WIDTH,CH_MONTHS, 6); //June start month
// Load the chart with some data
ChartData(hChart,1,&data1,3,NULL,CH_DATA_USHORT,"Small parts");
ChartData(hChart,2,&data2,3,NULL,CH_DATA_USHORT,"Large parts");
// Provide chart title and left margin text
ChartTexts(hChart,"Widget Sales Department",NULL,"Quantity",NULL);
break;
15
APPLICATION CHART PAINTING
══════════════════════════
The next section of the application program is responsible for painting the
chart on the user's display. The four steps involved in this process follow.
The processing of the WM_PAINT message includes validation of the client
window via WinBeginPaint and WinEndPaint. Second, the current client window
location is queried, in the event of user resizing and initialization. Then
the new chart display coordinates, inside the client window, are passed to
the chart instance. Lastly, the chart is made visible to the enduser. While
the parameters of each Chart... function calls are not discussed at this
time, the purpose of this application sample is to show detailed business
chart programming concepts and requirements. Individual business chart
function calls are provided in the next section of this documentation.
case WM_PAINT :
// Revalidate and paint any portion of the developer's
application data
hps = WinBeginPaint(hwnd, NULL, NULL);
// Obtain current client window coordinates
WinQueryWindowRect(hwnd, &ClientRctl);
// Notify chart instance of new chart display location
ChartSetRect(hChart, &ClientRctl);
// Make the chart visible to the user
ChartPaint(hChart,hps);
WinEndPaint(hps);
break; // End of WM_PAINT processing
16
APPLICATION CHART TERMINATION
═════════════════════════════
The WM_COMMAND and WM_CLOSE are the last two commands required for this
sample program. The application program termination is assumed to be a
result of the user pressing the F3 function key to terminate the application.
As a result of this action, the application will post an internal message to
dispose of the business chart instance and to terminate the application.
Releasing the chart instance is not necessary, but good programming practice.
case WM_COMMAND : // Process operator keys
command = SHORT1FROM(mp1);
switch (command) {
case IDM_EXIT : // F3 key processing
WinPostMsg(hwnd, WM_CLOSE, 0L, 0L);
break;
default;
return WinDefWindowProc(hwnd, msg, mp1, mp2);
} // End switch (mp1)
break; // End of WM_COMMAND processing
case WM_CLOSE :
// Dispose of the chart instance
ChartDestroy(hChart);
WinPostMsg(hwnd, WM_QUIT, 0L, 0L);
break;
default :
return WinDefWindowProd(hwnd, msg, mp1, mp2);
}
return FALSE;
} // End of MyWindowProc
17
API TECHNICAL SYNOPSIS
ChartAnnotate - Display application text string
═══════════════════════════════════════════════
This interface enables the programmer to place text any where on top of the
chart after the chart has been displayed. The program can determine where
the data is to be displayed through the use of the "ChartQueryLocation" API
(i.e.. locate a horizontal bar on a chart). Next, determine what size font
will fit in the rectangle based on the text provided through the use of the
"ChartQueryTextFontSizes" API.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ hann = ChartAnnotate(hchart, // Chart handle │
│ font, // Font size 1 thru 5 │
│ rect, // Pointer to output rectangle │
│ color, // CLR_??? value │
│ options, // Centering options │
│ string); // Pointer to a text string │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartAnnotate" function parameters are as follows:
hann This API will return a handle to the annotation upon successful
(HWND) completion as the annotation is maintained in an internal pool
for the chart. The programmer may specify as many annotations
as required by their application. Individual annotations can be
eliminated from the pool through the use of the
"ChartAnnotateRelease" API discussed later.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
font Specifies the size of the font to use in displaying the text
(USHORT) string on the chart. The font size must range between 1 and 5.
A value of 1 represents the smallest font size.
rect Specifies a pointer to rectangle structure which contains the
(PRECT) rectangular location of where to place the text string on
the chart.
color Specifies a CLR_??? color value to be used in displaying
(LONG) the text string. (See the "ChartSetColor" API for a full list
of the CLR_ values.)
18
options Specifies how the text is to be placed within the rectangle
(ULONG) provided by the programmer. Use one of the following valid
options.
CH_RIGHT_JUSTIFY
CH_LEFT_JUSTIFY
CH_CENTER_JUSTIFY
For vertical text you must specify CH_VERTICAL_ANNOTATE. To
direct text to start at the bottom on the rectangle and proceed
upward, specify also the CH_BOTTOM_JUSTIFY parameter which must
be or-ed with CH_VERTICAL_ANNOTATE.
string Specifies a pointer to the text string to be displayed.
(PCH)
NOTE: As the window is resized by the user or application and the chart is
redrawn, it is the programmers responsibility to release all previously
defined annotations and recalculate the new output area size and call the
"ChartAnnotate" function again. All annotations can be release through the
"ChartAnnotateDestroy" API discussed later.
NOTE: Any annotations which are encountered during the "ChartDestroy"
function call will automatically be released by the charting toolkit.
NOTE: The "ChartPrint" function will automatically recalculate the annotation
locations prior to the chart being printed.
19
ChartAnnotatePaint - Display all annotations on the chart
═════════════════════════════════════════════════════════
This function will paint all annotations currently held by the chart on
the display or the printer.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartAnnotatePaint(hchart, // Chart handle │
│ hps); // Handle to presentation space │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartAnnotatePaint" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
hps Specifies the handle of presentation space for the output
(HPS) device being used.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes NONE │
│ │
└───────────────────────────────────────────────────────────────────────────┘
20
ChartAnnotateRelease - Release a specific annotation
════════════════════════════════════════════════════
This function releases individual annotations for a chart based on the
annotation handle provided.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartAnnotateRelease(hchart, // Chart handle │
│ hann); // Annotation to release │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartAnnotateRelease" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
hann Specifies the handle of an annotation element as created by the
(HWND) "ChartAnnotate" function call.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_no_memory 3 │
│ Chart_invalid_parameter 5 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
21
ChartAnnotateDestroy - Release all annotations
══════════════════════════════════════════════
This function releases all current annotations for a chart. In the event no
annotations are currently defined, this interface will also return a TRUE
indication.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartAnnotateDestroy(hchart); // Chart handle │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartAnnotateDestroy" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_no_memory 3 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
22
ChartClipboard - Paste the current chart on clipboard
═════════════════════════════════════════════════════
This function provides a means to paste the current chart as shown on the
display to the system clipboard. This function will replace anything
currently being held by the clipboard.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartClipboard(hchart); // Chart handle │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartClipboard" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_no_memory 3 │
│ Chart_clipboard_not_open 38 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The following is an example of the call to this function.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ static HWND hChart; // Bar chart handle │
│ │
│ if (!ChartClipboard(hChart)) { │
│ // │
│ // Error condition │
│ // │
│ } else { │
│ // │
│ // Success │
│ // │
│ } │
│ │
│ │
└───────────────────────────────────────────────────────────────────────────┘
23
ChartCreate - Create a graphic chart
════════════════════════════════════
"ChartCreate" will establish/create a "chart object". To be displayed, the
chart requires a window or part of a window. The handle of a window (i.e.
client or dialog box control) must be passed to the "ChartCreate" function.
Other parameters describe the general characteristics of the chart. The
ChartCreate function will return a handle for the chart created. This
handle will be passed to all chart functions that follow.
NOTE: The creation process does not display the chart to the user. The
chart has no data associated at this point. Once data is provided by the
"ChartData" function, the chart can be made visible with either a
"ChartVisible" or "ChartPaint" function request.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ hchart = ChartCreate(hwnd, // Client window handle │
│ chart_type, // Type of chart requested │
│ chart_flags, // Chart control flags │
│ &rectl, // Rectangle position in client │
│ &errors, // Error recording location │
│ data_type, // Type of data │
│ groups, // Number of data group sets │
│ points, // Number of data points │
│ dimensions); // Number of dimensions (2 or 3) │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartCreate" function parameters are as follows:
hchart Contains the handle returned by "ChartCreate". If an error
(HWND) occurs during the creation process, "hchart" is set to a zero
value. ERRORS will be set to a reason code.
hwnd Contains the handle of the client window in which the chart will
(HWND) be displayed.
chart_type Describes the type of chart to be created. The values
(CHTYPE) are described on page two of this document. For
example CH_BAR. These values were described earlier in the
documentation on page 2.
chart_flags Describes additional controls placed on the chart being
(ULONG) created. The following values can be or-ed together to
provide combinations for the chart.
CH_CONNECTED Connects the points on a scatter chart
with straight lines. This parameter is not
applicable to any other chart type.
24
CH_FLOAT_SCALE Sets the y-axis and z-axis at the lowest data
point value overriding the default value 0.
The lowest data point value will be rounded
down to insure readability.
CH_FRAME Places a visual frame around the entire chart
area as described by "rectl" parameter.
CH_GRAPHIC_FRAME Places a visual frame around the graphic
picture created.
CH_MARKER Places marker symbols on line and bar/line
charts. This parameter is not applicable to
any other chart type. The marker symbol
defaults to the solid diamond shape,
MARKSYM_SOLIDDIAMOND.
CH_MINOR_GRID Places a vertical grid line in the graphic
chart area for minor x-ticks. Applicable to
time-based charts only.
CH_NO_ZEROES Specifies that a data value of zero will not
be displayed.
CH_SORT Sort column or stacked bar charts based on
magnitude.
CH_TIME_BASED Displays a chart in a time-based manner.
Each data point must be accompanied by a
time value.
CH_TOUCH Record data point location to implement
tactile feedback. See "ChartQueryLocation"
and "ChartQueryPointer" function requests.
CH_X_GRID Places vertical grid lines in the graphic
chart area. This parameter is not applicable
to pie charts.
CH_Y_GRID Places horizontal grid lines in the graphic
chart area. This parameter is not applicable
to pie charts.
CH_Z_GRID Places horizontal grid lines in the graphic
chart area. This parameter is not applicable
to pie charts.
rectl Provides the pointer to a structure containing the bottom left
(PRECTL) and upper right coordinates within "hwnd". This is the chart
location when it is visible.
errors Provides the pointer to a location in memory for any error
(PUSHORT) condition codes resulting from "Chart..." function calls.
THIS MEMORY LOCATION MUST BE SET ASIDE IN STATIC DATA STORAGE.
25
data_type Describes the format of the values displayed along the y-axis.
(USHORT)
Range of data supported
───────────────────────
CH_DATA_USHORT 0 to 65,536
CH_DATA_SHORT -32,768 to 32,768
CH_DATA_ULONG 0 to 4,294,967,296
CH_DATA_LONG -2,147,483,648 to 2,147,483,648
CH_DATA_FLOAT 10-36 to 10+36
CH_DATA_DOUBLE 10-308 TO 10+308
groups Specifies the number of data groups to be displayed. This
(USHORT) must range between 1 and 12. EXCEPTIONS: Numeric and Symbol
tables.
points Specifies the maximum number of graphic symbols associated with
(USHORT) any one data group. A graphic symbol may consist of one data
point (i.e. bar in a bar chart) or multiple data points (i.e.
high/low/open/close in a range chart).
dimensions Indicates the viewing dimensions of the graphic chart. The
(USHORT) must be either 2 or 3. A NULL or zero value will default to 3
(representing a 3D chart). Smooth line and scatter charts will
default to 2 dimensions.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_invalid_client 1 │
│ Chart_no_memory 3 │
│ Chart_invalid_data_type 7 │
│ Chart_invalid_group 8 │
│ Chart_no_data 9 │
│ Chart_invalid_dimensions 10 │
│ Chart_invalid_chart_type 15 │
│ Chart_invalid_DLL 18 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
26
The following illustrates creating a standard 3-D bar chart with horizontal
grid lines and a frame surrounding the entire chart area. This sample
assumes a small window is provided for placing a standard window frame around
the chart.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ static HWND hWnd; // Client window handle │
│ │
│ static HWND hChart; // Bar chart handle │
│ static RECTL Clientrctl; // Area bar chart will occupy │
│ │
│ static USHORT usErrors; // Error recording area │
│ │
│ hChart = ChartCreate(hWnd, // Client window handle │
│ CH_BAR, // Create a bar chart │
│ CH_FRAME| // Frame the entire chart │
│ CH_Y_GRID, // Horizontal grid lines │
│ &Clientrctl, // Client rectangle area │
│ &usErrors, // Error recording location │
│ CH_DATA_SHORT, // Unsigned short chart data │
│ 1, // Number of data groups │
│ 5, // Number of data points │
│ 3); // 3-D chart presentation │
│ │
└───────────────────────────────────────────────────────────────────────────┘
27
ChartData - Provide a group with data and text legend
═════════════════════════════════════════════════════
This function provides a chart group with data and a legend.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartData(hchart, // Chart handle │
│ group, // Data group number │
│ &data, // Location of data array │
│ points, // Number of data items to chart │
│ delay_start, // Delay data starting point │
│ data_type, // Type of data to chart │
│ &legend); // Legend for the group │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartData" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
group Specifies the number of the data group that will be displayed.
(USHORT) This number must range between 1 and 12.
data Pointer to an array of data points associated with the group.
(PUSHORT) This parameter should be "cast" to bypass compile warnings.
points Specifies the number of data points (or array elements)
(USHORT) associated with the data group being loaded. All previously
loaded data for the group will be nullified. The value of zero
will release any previously stored data points.
delay_start Delays the starting point for a data group. For example, data
(USHORT) groups 1 and 3 have five data points each (Mon-Fri). Data
group 2 has three data points (Wed-Fri). The value of 3
specifies the starting point (Wed) for data group 3.
28
data_type Describes the type of data associated with this data group
(USHORT) (i.e. long, float). The type of data being provided in the
application data array is specified by one of the following
parameters.
Range of data supported
───────────────────────
CH_DATA_USHORT 0 to 65,536
CH_DATA_SHORT -32,768 to 32,768
CH_DATA_ULONG 0 to 4,294,967,296
CH_DATA_LONG -2,147,483,648 to 2,147,483,648
CH_DATA_FLOAT 10-36 to 10+36
CH_DATA_DOUBLE 10-308 TO 10+308
legend Specifies a pointer to a text string that represents the text
(PCH) legend for the group. The previous text legend will be
replaced. If a NULL value is provided, the prior legend is
released.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_invalid_data_type 7 │
│ Chart_invalid_group 8 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The following illustrates providing data group 3 with 4 data points and a
legend.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Bar chart handle │
│ │
│ static LONG Data[] = {350,-425,155,500}; │
│ │
│ fAns = ChartData(hChart, // Chart handle │
│ 3, // Data group number │
│ (PSHORT) &Data, // Location of data points │
│ 4, // Data point count │
│ 0, // Start at first location │
│ CH_DATA_LONG, // Type of numerical data │
│ "Group No. 3"); // Text legend │
│ │
└───────────────────────────────────────────────────────────────────────────┘
29
ChartDataAppend - Append a data point to a group
═════════════════════════════════════════════════
ChartDataAppend(hchart,group,type,&datapoint,visible);
This function adds a data point to a group and updates the currently
displayed chart. This function is the foundation for real-time chart
updates.
This function is operational and is described only in the full function
product.
30
ChartDataUpdatePoint - Replace a single bar on the chart
════════════════════════════════════════════════════════
This function is used to replace the value of a data point for a specific
data group. This interface can also immediately show the change on the chart
if the chart is a 2 dimension bar chart.
This API requires that the CH_TOUCH option be specified during the
"ChartCreate" API request. Further, the API will not redraw any grid lines
associated with any scale.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartDataUpdatePoint(hchart, // Chart handle │
│ group, // Data group number │
│ point, // Data point number │
│ data_type, // Type of data to chart │
│ &data, // Pointer to data │
│ visible); // Display indicator │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartDataUpdatePoint" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
group Specifies the number of the data group that will be displayed.
(USHORT) This number must range between 1 and 12.
point Specifies the data point number to update.
(USHORT)
31
data_type Describes the type of data associated with this data group
(USHORT) (i.e. long, float). The type of data being provided in the
application data array is specified by one of the following
parameters.
Range of data supported
───────────────────────
CH_DATA_USHORT 0 to 65,536
CH_DATA_SHORT -32,768 to 32,768
CH_DATA_ULONG 0 to 4,294,967,296
CH_DATA_LONG -2,147,483,648 to 2,147,483,648
CH_DATA_FLOAT 10-36 to 10+36
CH_DATA_DOUBLE 10-308 TO 10+308
data Pointer to an array of data points associated with the group.
(PUSHORT) This parameter should be "cast" to bypass compile warnings.
visible This parameter is used to also update the display. In order
(BOOL) to update the display the chart type must be CH_BAR and the
number of dimensions must be two. TRUE will display the new bar.
A FALSE specification will only update the data point retained
by the charting engine.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_no_memory 3 │
│ Chart_datapoints_excess 6 │
│ Chart_invalid_data_type 7 │
│ Chart_invalid_group 8 │
│ Chart_no_data 9 │
│ Chart_invalid_dimensions 10 │
│ Chart_invalid_chart_type 15 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
32
ChartDataHighlight - Highlight data point(s) for emphasis
═════════════════════════════════════════════════════════
ChartDataHighlight(hchart,group,count,&highlight);
This function sets the display characteristics for one or more data points
within a data group. This function is to provided distinction for
specified data points.
This function is operational and is described only in the full function
product.
33
ChartDestroy - Discard current chart
════════════════════════════════════
This function discards all resources held by the chart. If the chart is
currently visible, it will not be erased or removed from the Presentation
Manager window. To reuse the space occupied by the chart, invalidate the
rectangle and repaint any area as required.
NOTE: Following this request, the chart is no longer accessible by any chart
function.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartDestroy(hchart); // Chart handle │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartData" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_memory_release 12 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The following illustrates destroying a chart.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Bar chart handle │
│ │
│ fAns = ChartDestroy(hChart); // Chart handle │
│ │
└───────────────────────────────────────────────────────────────────────────┘
34
ChartGetData - Retrieve data points
═══════════════════════════════════
count = ChartGetData(hchart,group,&asciiz,&float_array);
This function retrieves all data points which were previously provided to
a data group.
This function is operational and is described only in the full function
product.
35
ChartGetDisplacement - Query where data would be drawn
══════════════════════════════════════════════════════
This function provides the developer with a means to determine where a data
value would be located if it was drawn by the charting DLL. The pixel
location returned is based on the axis and group number provided by the
developer.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartGetDisplacement(hwnd, // Chart handle │
│ group, // Data group number │
│ axis, // Inference axis │
│ value, // Value to locate │
│ &pixelout); // Pointer to result │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartGetDisplacement" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
group Specifies the number of the data group that will be displayed.
(USHORT) This number must range between 1 and 12.
axis Specifies which axis to use as a reference point. This
(LONG) parameter must be one of the following values.
CH_X_TICK
CH_Y_TICK
CH_Z_TICK
value The data point value to be used when calculating the returned
(DOUBLE) pixel location.
pixel_out Pointer to a location to receive either the x, y or z
(LPLONG) pixel location. The result is returned in a LONG data format.
NOTE: This API should only be called after a chart has been displayed.
36
ChartGetLastError - Retrieve the last error code value
══════════════════════════════════════════════════════
error = ChartGetLastError(hchart);
This function retrieves the last error code value provided by the
charting APIs.
This function is operational and is described only in the full function
product.
37
ChartGetValue - Return value based on x or y coordinate
═══════════════════════════════════════════════════════
This function provides the developer with a means to support rubber-banding
of data points currently on the display. Given a vertical pixel location
within the client area, this API will return an approximate data value as it
relates to either the y-axis or z-axis. A x-axis value is only available for
the CH_MATRIX chart.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartGetValue(hchart, // Chart handle │
│ group, // Data group number │
│ axis, // Inference axis │
│ location, // Pixel location │
│ &valueout); // Pointer to result │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartGetValue" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
group Specifies the number of the data group that will be displayed.
(USHORT) This number must range between 1 and 12.
axis Specifies which axis to use as a reference point. This
(LONG) parameter must be one of the following values.
CH_X_TICK
CH_Y_TICK
CH_Z_TICK
location Specifies the pixel location to use when calculating the value
(LONG) to data value to return to the application.
valueout Specifies a pointer to a storage location to receive the data
(double *) value which is calculated by the charting engine.
NOTE: This API should only be called after a chart has been displayed.
NOTE: If the location specified is either above or below the graphic area,
then either the maximum or minimum scale value will be returned.
38
ChartLegend - Associate a data group with a text string (legend)
════════════════════════════════════════════════════════════════
This function associates a text string with a data group. The function
also changes or releases a currently specified legend.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartLegend(hchart, // Chart handle │
│ group, // Data group Number │
│ &legend); // Legend for group │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartLegend" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
group Specifies the number of the data group that will be displayed.
(USHORT) This number must range between 1 and 12.
legend Specifies the pointer to a text string that represents the text
(PCH) legend for the group. The previous text legend will be
replaced. If a NULL value is provided, the prior legend is
released.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_no_memory 3 │
│ Chart_invalid_parameter 5 │
│ Chart_invalid_group 8 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The following illustrates providing data group 3 with a legend.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Bar chart handle │
│ │
│ fAns = ChartDestroy(hChart, // Chart handle │
│ 3, // Data group number 3 │
│ "X-Small"); // Text legend for the group │
│ │
└───────────────────────────────────────────────────────────────────────────┘
39
ChartOptions - Assign required control flags to "range" charts
══════════════════════════════════════════════════════════════
ChartOptions(hchart,charttype,count,¶meters);
This function assigns unique control flags to specific chart types. This
function is applicable to the High/Low chart, Candlestick chart, and Point
& Figure chart only. These charts are members of the "range chart" family.
One to four items are required for each data point to describe the data
point objects.
NOTE: The following order should be observed when providing data values to
the charts: low value, high value, open value (optional), close value
(optional).
NOTE: See "ChartSetOptions: for global chart flags.
This function is operational and is described only in the full function
product.
ChartOutputMetaFile - Place a chart on disk in MetaFile format
══════════════════════════════════════════════════════════════
ChartOutputMetaFile(hchart,&file_name);
This function places a chart on the disk in metafile format for printing
or replay.
This function is operational and is described only in the full function
product.
40
ChartPaint - Display chart without total redraw
═══════════════════════════════════════════════
The "ChartPaint" API can be used instead of the "ChartVisible" interface to
reduce the drawing time of a chart. This interface must be called only
during the applications processing of the WM_PAINT message. Specifically,
the API must be called between the WinBeginPaint and WinEndPaint messages.
This function will display the chart specified by the "ChartCreate" function
containing data defined in the "ChartData" function.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartPaint(hchart, // Chart handle │
│ hpaint); // Handle from BeginPaint │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartPaint" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
hpaint Specifies the handle returned by the "WinBeginPaint"
(HWND) system message.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_invalid_client 1 │
│ Chart_not_defined 2 │
│ Chart_no_memory 3 │
│ Chart_no_data 9 │
│ Chart_memory_release 12 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
41
ChartPrint - Print a graphic chart
══════════════════════════════════
This function sends a graphic chart to the default system printer. This
function requires the use of the system print manager.
NOTE: Charts with a large number of data groups and/or data points may not
print properly. The graphics engine will not print a chart on multiple
pages. If a chart is so large that the graphics engine can not print text or
data using the smallest font, that information will be sacrificed and will
not be printed.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartPrint(hchart, // Chart handle │
│ job_name, // Text string for job name │
│ &print_flags); // Pointer to print │
│ // control structure │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartPrint" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
Job_name Pointer to an ASCIIZ text string which contains the name of
(PCH) job or report.
42
print_flags This parameter should contain the address of a CHARTPRINT data
PCHARTPRINT structure. The structure is as follows.
LONG cb; // Length of structure
ULONG flags; // Flags to be or-ed on
PSZ pAbortProc; // Pointer to abort procedure "Windows"
CHAR szDeviceName[32]; // Reserved
For OS/2, two flags have been defined to circumvent problems
arising when printing charts in landscape mode. OS/2 currently
has a BUG when we request the width and height when a printer is
placed into landscape mode. These flags should provide some
relief to the developer and end user. The "CH_OPTIONS_DIALOG"
key word tells the ChartPrint API to pop-up the job properties
dialog box of the system for the end user. At that point, the
user should select the landscape radio button. This will direct
the print manager to place this job into landscape mode. The
"CH_LANDSCAPE" key word tells the ChartPrint API to use the
systems page height as the actual page width and the systems
page width as the actual page height. We are hoping that OS/2
resolves their BUG in the near future.
The third field in the structure is used only for windows and if
required, contains the address of an application program printer
abort procedure as defined by the Windows system.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_invalid_parameter 5 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The following illustrates printing a chart.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Bar chart handle │
│ │
│ fAns = ChartPrint(hChart, // Chart handle │
│ "My Report", // Job Name │
│ 0L); // No additional controls │
│ │
└───────────────────────────────────────────────────────────────────────────┘
43
ChartQueryDimensions - Obtain visual dimensions of a chart
══════════════════════════════════════════════════════════
ChartQueryDimensions(hchart,&dimensions);
This function provides a number representing the current dimensional
display associated with a chart.
This function is operational and is described only in the full function
product.
ChartQueryExtendedError - Query the time value error for time based charts
══════════════════════════════════════════════════════════════════════════
error_number = ChartQueryExtendedError(hchart);
This function determines the time value in error after a "ChartTimeReference"
call is made.
This function is operational and is described only in the full function
product.
44
ChartQueryGroupColor - Obtain color assigned to a data group
════════════════════════════════════════════════════════════
This function enables the application program to obtain the color assigned to
a specific data group. The value returned will be a CLR_??? value. The API
would generally be used when applications need to drill down into more detail
about a specific data group. For example, when the user touches their mouse
on a bar, the programmer can request the "ChartQueryPointer" API and the
charting DLL will return the group number touched by the user. With this
group number, the application program can call the "ChartQueryGroupColor" API
to obtain the current color assigned for the data group. Next, the
application can set data group number one to the color just obtained, assign
more detail data to data group one, change the number for groups being
displayed to one and show the chart. This technique will maintain the visual
color consistency for the end user. To return all data groups back to their
original colors reference the "ChartSendMsg" API with the
CH_RESET_GROUP_COLORS parameter.
NOTE: See "ChartSetGroupColor"
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartQueryGroupColor(hchart, // Chart handle │
│ group, // Group number │
│ &color); // Location to receive CLR_??? │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartQueryGroupColor" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
group Specifies the data group number to be queried. The value must
(USHORT) range from 1 to 12.
color Specifies a pointer to a memory location which will receive the
(LPLONG) "LONG" color value.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_invalid_parameter 5 │
│ Chart_invalid_group 8 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
45
ChartQueryLocation - Obtain specific coordinates in a chart
═══════════════════════════════════════════════════════════
This function determines the location of a specific item displayed in a
chart. The application can then provide a note or information to the
user in the proximity.
This function requires the use of a data structure called "CHARTPOINTER". The
"CHARTPOINTER" data structure consists of xLeft, xRight, yTop, and yBottom
elements providing the object coordinates.
To activate this function, the parameter CH_TOUCH must be specified in either
the "ChartCreate" or "ChartSetOptions" function calls. The coordinates are
held in dynamic memory until the chart is redisplayed, destroyed, or the
CH_TOUCH option is removed.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartQueryLocation(hchart, // Chart handle │
│ &pointer); // Pointer to a data structure │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartQueryLocation" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
pointer Specifies the address of a data structure. The data
(PCHARTPOINTER) structure is returned with the control information being
requested.
CHARTPOINTER is in the CHART.H include file. The following
describes the values returned:
typedef struct _CHARTPOINTER {
BOOL success; // Success indicator
USHORT type; // Type of object
USHORT group; // Group number
USHORT point; // Point number within group
float value; // Value if data point
LONG xLeft; // Location of the object
LONG yBottom; // Location of the object
LONG xRight; // Location of the object
LONG yTop; // Location of the object
} CHARTPOINTER;
46
success A BOOL value is TRUE if the query is successful or
FALSE if unsuccessful.
type A USHORT value reflects the location of the chart
being queried. The following are values which can
be provided by the programmer to this function:
Symbolic Location being queried
─────────────── ──────────────────────
CH_LOC_LEGEND Legend
CH_LOC_POINT Data point
CH_LOC_TITLE Title
CH_LOC_LEFT_MARGIN Left margin
CH_LOC_RIGHT_MARGIN Right margin
CH_LOC_TOP_LEFT Top Left corner
CH_LOC_TOP_RIGHT Top Right corner
CH_LOC_BOTTOM_LEFT Bottom Left corner
CH_LOC_BOTTOM_RIGHT Bottom Right corner
CH_LOC_X_TICK X tick string
CH_LOC_Y_TICK Y tick area
CH_LOC_Z_TICK Z tick area
CH_LOC_GRAPHIC Graphic drawing area
group A USHORT value specifies the data group, legend, or
point queried. The number specified is 1 to 12.
point A USHORT value specifies the data point of a group
queried.
value Receives the value if a data group and point area
queried.
xLeft Receive the coordinates of the object being queried.
yBottom
xRight
yTop
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_invalid_parameter 5 │
│ Chart_invalid_group 8 │
│ Chart_no_data_available 22 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
47
The following illustrates locating the rectangular display coordinates of the
4th data point for data group 2 on the chart that is currently visible.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Bar chart handle │
│ CHARTPOINTER location; // Query structure │
│ │
│ │
│ location.type = CH_LOC_POINT; // Find location of group & point│
│ location.group = 2; // Data group 2 │
│ location.point = 4; // Data point 4 │
│ │
│ fAns = ChartQueryLocation(hChart, // Chart handle │
│ &location); // Pointer to a data structure │
│ │
│ │
│ │
│ if (fAns && location.success) { │
│ │
│ // Success │
│ │
│ } else { │
│ │
│ // Item not found │
│ │
│ } │
│ │
└───────────────────────────────────────────────────────────────────────────┘
48
ChartQueryOptions - Obtain current chart flags
══════════════════════════════════════════════
ChartQueryOptions(hchart,&chart_flags);
This function enables acquisition of the current setting for the chart
control flags.
This function is operational and is described only in the full function
product.
49
ChartQueryPointer - Tactile feedback
════════════════════════════════════
ChartQueryPointer(hchart,x,y,&pointer);
This function enables the user to click on various chart locations and
allow the developer's application program to respond to the pointing motion.
The programmer can then pass various x and y coordinates to the graphics DLL
for "hot spot" resolution.
To activate this function, the parameter CH_TOUCH must be specified in either
the "ChartCreate" or "ChartSetOptions" function calls. The coordinates are
held in dynamic memory until the chart is redisplayed, destroyed, or the
CH_TOUCH option is removed.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartQueryPointer(hchart, // Chart handle │
│ x, // X coordinate queried │
│ y, // Y coordinate queried │
│ &pointer); // Pointer to a data structure │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartQueryPointer" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
x Specifies the x coordinate queried.
(LONG)
y Specifies the y coordinate queried.
(LONG)
50
pointer Specifies the address of a data structure. The data
(PCHARTPOINTER) structure is returned with the control information being
requested.
CHARTPOINTER is in the CHART.H include file. The following
describes the values returned:
typedef struct _CHARTPOINTER {
BOOL success; // Success indicator
USHORT type; // Type of object
USHORT group; // Group number
USHORT point; // Point number within group
float value; // Value if data point
LONG xLeft; // Location of the object
LONG yBottom; // Location of the object
LONG xRight; // Location of the object
LONG yTop; // Location of the object
} CHARTPOINTER;
success A BOOL value is TRUE if the query is successful or
FALSE if unsuccessful.
type A USHORT value reflects the location of the chart
item represented by the x and y locations provided
by the programmer to this function:
Symbolic Location represented
─────────────── ──────────────────────
CH_LOC_LEGEND Legend
CH_LOC_POINT Data point
CH_LOC_TITLE Title
CH_LOC_LEFT_MARGIN Left margin
CH_LOC_RIGHT_MARGIN Right margin
CH_LOC_TOP_LEFT Top Left corner
CH_LOC_TOP_RIGHT Top Right corner
CH_LOC_BOTTOM_LEFT Bottom Left corner
CH_LOC_BOTTOM_RIGHT Bottom Right corner
CH_LOC_X_TICK X tick string
CH_LOC_Y_TICK Y tick area
CH_LOC_Z_TICK Z tick area
CH_LOC_GRAPHIC Graphic drawing area
group A USHORT value specifies the data group, legend, or
point queried. The number specified is 1 to 12.
point A USHORT value specifies the data point of a group
queried.
value Receives the value if a data group and point area
queried.
51
xLeft Receive the coordinates of the object being queried.
yBottom
xRight
yTop
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_invalid_parameter 5 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The following illustrates acquiring the graphic characteristics of an
application specific coordinate.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Bar chart handle │
│ CHARTPOINTER location; // Query structure │
│ │
│ │
│ fAns = ChartQueryPointer(hChart, // Chart handle │
│ 100L, // X location │
│ 200L, // Y location │
│ &location); // Pointer to a data structure │
│ │
└───────────────────────────────────────────────────────────────────────────┘
52
ChartQueryTextFontSize - Query the automatic font size for a text string
════════════════════════════════════════════════════════════════════════
ChartQueryTextFontSize(hchart,flags,text);
This function returns the font size used to display a single chart text
element. The last "ChartSetRect" call determines the size of the text area.
This function is operational and is described only in the full function
product.
ChartQueryTextFontSizes - Query the automatic font size for text strings
════════════════════════════════════════════════════════════════════════
ChartQueryTextFontSizes(hchart,device,count,direction,rect,strings,fonts);
This function returns the font sizes used to display multiple text strings.
The device (i.e. display), the number of strings to process, the display
directions, the logical rectangles and the associated text strings for each
of the text areas are required.
This function is operational and is described only in the full function
product.
ChartQueryType - Determine type of chart
════════════════════════════════════════
ChartQueryType(hchart,&chart_type);
This function provides the current chart type representing a chart handle
(i.e. bar chart, pie chart).
This function is operational and is described only in the full function
product.
ChartQueryVersion - Obtain installed version number of charting DLL
═══════════════════════════════════════════════════════════════════
ChartQueryVersion(&ver);
This function obtains the version and modification level of the installed
charting DLL.
This function is operational and is described only in the full function
product.
53
ChartSendMsg - Send operational flags to charts
═══════════════════════════════════════════════
This function directs messages to a specific chart or to all charts for
operational characteristics.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartSendMsg(hchart, // Chart handle │
│ msg_id, // Message identification │
│ param1, // Parameter 1 │
│ param2); // Parameter 2 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartSendMsg" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
msg_id Specifies the function to be performed or the chart to direct
(USHORT) the message.
param1 Specifies the first parameter of the message.
(ULONG)
param2 Specifies the second parameter of the message.
(ULONG)
The following describes the message identifiers and parameters which can be
send as part of the message.
Note any time in the following examples that TRUE is specified, a FALSE being
specified will reverse the desired request.
Display marker symbols in the chart legend
──────────────────────────────────────────
Directs system marker symbols to be used in the legend area overriding
the default. If the last parameter is FALSE, the marker symbols will
return to the default state.
ChartSendMsg(hChart,CH_MARKER_LEGENDS,0,TRUE);
54
Bypass erasing the client area on displaying a chart
────────────────────────────────────────────────────
Directs that the client area of the chart not be painted. If the last
parameter is FALSE, the client area will be painted (default) with
"ChartVisible" function call.
ChartSendMsg(hChart,CH_BYPASS_CLIENT_ERASE,0,TRUE);
Specify the width of grid lines
────────────────────────────────
Specifies the width of the grid lines. The third parameter, "grid: must
specify CH_X_GRID, CH_Y_GRID, CH_Z_GRID, or CH_MINOR_GRID. The last
parameter "width", specifies the pixel width for the line. The solid
line width can be from 1 to a maximum of 20. One is is maximum line
width for all other line types.
ChartSendMsg(hChart,CH_GRID_WIDTH,grid,width);
Evenly distribute x-tick strings
────────────────────────────────
Specifies that one or more x tick text strings are to be evenly
distributed across the x-axis. This message reduces the need to have a
string for every data point. This request is supported by only 2
dimension line, scatter and area charts. The last parameter must be
stated as FALSE to disable the message.
ChartSendMsg(hChart,CH_X-TICK_BALANCE,0,TRUE);
Horizontally stagger the x-axis text
────────────────────────────────────
Directs that the x-axis text information is horizontally staggered. This
techniques allows space for more or longer x tick strings. The last
parameter must be stated FALSE to disable the message.
ChartSendMsg(hChart,CH_X-TICK_BALANCE,0,TRUE);
───────┬─────────┬─────────┬─────────┬─────────┬─────────┬──────
ABC DEF GHI JKL MNO PQR
Default
───────┬─────────┬─────────┬─────────┬─────────┬─────────┬──────
ABC │ GHI │ MNO │
DEF JKL PQR
Multiline
55
Use the full chart width for legend display
───────────────────────────────────────────
Directs that the legend text information use the entire chart width for
output area. The last parameter must be stated as FALSE to disable the
message and return the legend display immediately below the graphic area.
ChartSendMsg(hChart,CH_FULL_WIDTH_LEGENDS,0,TRUE);
Set display frequency for Point & Figure charts
───────────────────────────────────────────────
Specifies the frequency that symbols will be displayed on the Point &
Figure chart. The default frequency of 1.0 is used if this message is
not sent.
ChartSendMsg(hChart,CH_POINT_FIGURE_VALUE,0,(float)4.0);
Set direction change value on Point & Figure charts
───────────────────────────────────────────────────
Specifies the value indicating a major upward direction change. This
float value is usually specified as three times the value provided in the
CH_POINT_FIGURE_VALUE message immediately above.
ChartSendMsg(hChart,CH_POINT_FIGURE_UP,0,(float)12.0);
Bypass switch to bar/line chart with z-axis
───────────────────────────────────────────
Normally the charting DLL will switch to the region settings of the
CH_BAR_LINE chart if the current chart contains a z-axis. This send
message request will suspend the switching operation. To disable this
request and resume the use of normal scales, specify FALSE as the last
parameter for this API request.
ChartSendMsg(hChart,CH_BYPASS_Z_EXCHANGE,0,TRUE);
Tighten up y and z-axis scales
──────────────────────────────
This function causes both the y and z axis scales to reduce any excess
tick marks that may be generated during automatic axis scale generation.
This should generally only be used on 2 dimension charts. To enable this
function follow the example below. To disable this request and resume
the use of normal scales, specify FALSE as the last parameter for this
API request.
ChartSendMsg(hChart,CH_TIGHT_SCALES,0,TRUE);
56
Tie z-axis scale to highest data value on the y-axis
────────────────────────────────────────────────────
This function caused the top of the z axis scale to be aligned with the
highest data value of all items on the y axis scale. This function would
best be used when the programmer specifies a programmer specified z axis
and an automatic y axis scale generation. To enable this function follow
the example below. To disable this request and resume the use of normal
scales, specify FALSE as the last parameter for this API request.
ChartSendMsg(hChart,CH_ZAXIS_YDATA,0,TRUE);
Draw straight line on Bar Goal chart
────────────────────────────────────
This function causes the bar goal chart to draw a straight line instead
of a square wave line for a data group which is represented by some type
of line. To enable this function follow the example below. To disable
this request and resume the use of a square wave line, specify FALSE as
the last parameter for this API request.
ChartSendMsg(hChart,CH_BAR_GOAL,CH_LINE,TRUE);
Bypass drawing in graphic area
──────────────────────────────
This function will cause the painting process for charts to bypass the
drawing of items within the chart graphic area. This function is
currently only implemented for standard bar, line, horizontal bar, and
perspective bar charts The charts can be either 2 or 3 dimensions.
ChartSendMsg(hChart,CH_BYPASS_GRAPHIC_DRAW,0,TRUE);
Bypass legend display
─────────────────────
This will stop the group legends from being displayed. However, if a
footnote was provided by way of the ChartTexts or ChartText APIs, the
footnote will be displayed if possible.
ChartSendMsg(hChart,CH_BYPASS_LEGENDS,0,TRUE);
Bypass x-axis text
──────────────────
This will stop the text from being displayed on the x-axis for all charts
which are not time based.
ChartSendMsg(hChart,CH_BYPASS_X_AXIS_TEXT,0,TRUE);
57
Display currency symbols on y or z-axis
───────────────────────────────────────
Based on the current system currency symbol, these messages can
independently force the currency symbol to appear before each numerical
value on either the y or z axis.
ChartSendMsg(hChart,CH_Y_AXIS_CURRENCY,0,TRUE);
or
ChartSendMsg(hChart,CH_Z_AXIS_CURRENCY,0,TRUE);
Display percent symbols on y or z-axis
───────────────────────────────────────
These messages can independently request that a percent symbol be placed
after each number on either the y-axis or the z-axis.
ChartSendMsg(hChart,CH_Y_AXIS_PERCENT_SIGN,0,TRUE);
or
ChartSendMsg(hChart,CH_Z_AXIS_PERCENT_SIGN,0,TRUE);
Bypass display of dates, days or hours
──────────────────────────────────────
On time based charts the developer can bypass any or all of the dates,
days or hour information which is normally displayed.
ChartSendMsg(hChart,CH_BYPASS_HOURS,0,TRUE);
or
ChartSendMsg(hChart,CH_BYPASS_DAYS,0,TRUE);
or
ChartSendMsg(hChart,CH_BYPASS_DATES,0,TRUE);
58
Query y or z-axis for tick control information
──────────────────────────────────────────────
Either before or after a chart with a y-axis and possibly a z-axis has
been displayed, the developer can request information about either of the
axis values and detailed characteristics. As a result of this call, a
CHARTTICKS data structure will be returned indicating such items as the
low value, high value, number of tick marks and the increment value for
the scale in question.
CHARTTICKS charttick; // Local data structure
ChartSendMsg(hChart,CH_QUERY_AXIS,CH_X_TICK,&charttick);
or
ChartSendMsg(hChart,CH_QUERY_AXIS,CH_Z_TICK,&charttick);
or
ChartSendMsg(hChart,CH_QUERY_AXIS,CH_Z_TICK,&charttick);
Note: This API only supports the x-axis for the CH_MATRIX chart.
Further, charts such as pie or numeric tables which do not have either a
y-axis or z-axis will not provide any data to the programmer.
Set interval for x-axis text display
────────────────────────────────────
Under some circumstances it may be desirable to skip displaying text
under every x-axis tick mark. The following example skips every other
x-axis ticks before displaying another stream of text. The third
parameter specifies the number of tick marks to skip.
ChartSendMsg(hChart,CH_X_AXIS_TEXT_SKIP,2,TRUE)
59
Use programmers presentation space or device context
────────────────────────────────────────────────────
Under some circumstances the application programmer may have created
their own drawing area (OS/2 presentation space or Windows device
context). This frequently happens when the programmer may require a
special title on a sheet of paper for a printer or requires multiple
charts on a single printer page. To accomplish this task the application
must acquire the handle to the space form the system and then notify the
chart toolkit of their intention. Under normal circumstance the toolkit
creates its own presentation space prior to drawing a chart. The third
parameter is used to specify the handle of the programmers presentation
space. The fourth parameter is used only for OS/2 programmers and if
TRUE requests that vector fonts be used instead of raster fonts. To
disable the function the programmer should supply a value of zero in the
third parameter and recall the ChartSendMsg API once again.
ChartSendMsg(hChart,CH_HPS,hps,FALSE);
Force CH_TOUCH on output
────────────────────────
When a chart is printed the charting toolkit does not disturb the
internal tables which indicate where items have been drawn on the
terminal display. However, if it is necessary to maintain annotation
texts or other items where location, this call will force the charting
toolkit to record its drawing locations for the graphic items. After the
locations have been changed, it is the responsibility of the programmer
to refresh the locations for the display if the end user is to maintain
tactile feedback capabilities.
ChartSendMsg(hChart,CH_FORCE_TOUCH,0,TRUE);
Display line symbols in legend area
───────────────────────────────────
Used generally with black and white printers, this message directs the
charting toolkit to use the type of line associated with a group line
type in the legend area of the display. These short little lines are
used instead of the colored squares normally associated with a legend for
a line chart.
ChartSendMsg(hChart,CH_LINE_LEGENDS,0,TRUE);
60
Use full chart width for line and scatter charts
────────────────────────────────────────────────
For regular 2 dimension line, smooth line and scatter charts, the entire
graphic area is not normally used. If this space is required for use by
the application program send the following message.
ChartSendMsg(hChart,CH_LINE_FULL_WIDTH,0,TRUE);
Display x-axis text between line points
───────────────────────────────────────
Used only for 2 dimension line charts, this message request will place
x-axis text information between the line points. Under normal
circumstances, the text is placed at the end points of a line segment.
This request must be made in in conjunction with the CH_LINE_FULL_WIDTH
send message command (reference the prior documentation).
ChartSendMsg(hChart,CH_X_AXIS_TEXT_CENTER,0,TRUE);
Display fractions on the y-axis
───────────────────────────────
This function enables the application to display fractional values on the
y-axis. A example of this would be to increment the y-axis by 32nds of a
whole number. To accomplish this task use the following message.
ChartSendMsg(hChart,CH_Y_TICK,CH_FRACTION_32,TRUE);
The third parameter can contain any of the following parameters.
CH_FRACTION_4
CH_FRACTION_8
CH_FRACTION_16
CH_FRACTION_32
These will display fourths, eights, sixteenths or thirty-second's of a
whole number.
This function will be added to the z-axis in the future.
61
Bypass automatic use of decimals on y and z axis
────────────────────────────────────────────────
As the charting toolkit sometimes encounters very small values in the
data to be show, the toolkit sometimes increments numbers by .25 or .10
for example. To insure that round numbers are instead, send the
following message.
ChartSendMsg(hChart,CH_YZ_BYPASS_DECIMAL,0,TRUE);
Reset all data groups to the default color settings
───────────────────────────────────────────────────
This function enables the application program to return to the charting
color defaults for all groups after the ChartSetGroupColor API was
issued.
ChartSendMsg(hChart,CH_RESET_GROUP_COLORS,0,0);
Set new minimum or maximum value for CH_X_PLOT chart
────────────────────────────────────────────────────
The third and fourth parameter are used to set respectively a new low and
or a new high values for the scaling area of the x-axis.
The default value of 9.0 for the x-axis of the CH_X_PLOT chart type can
be increased or decreased by sending the following message.
static double new_x = (double) 30.0;
ChartSendMsg(hChart,CH_X_PLOT,0,&new_x);
In the above example the the value of 30.0 will replace the default value
of 9.0.
62
Query font size used to display an item
───────────────────────────────────────
This message request will return the size font used to display a chart
item. If a value of 0 is returned, the item being queried was not
displayed. Otherwise, this value should be 1 thru 6.
static int FONT_SIZE; // Location to receive answer
ChartSendMsg(hChart,CH_QUERY_FONT_USED,CH_X_TICK_TEXT,&FONT_SIZE);
The third parameter specifies the chart item being queried and must be
one of the following.
CH_X_TICK_TEXT
CH_TITLE
CH_LEGEND
63
ChartSendMsgVP - Send operational flags to charts
═════════════════════════════════════════════════
This function provides another entry mechanism into the "ChartSendMsg" API.
This is made available to minimize casting problems associated with some C++
compilers. The prototype for the API is as follows.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartSendMsgVP(hchart, // Chart handle │
│ msg_id, // Message identifier │
│ param1, // Parameter 1 │
│ param2); // Parameter 2 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartSendMsgVP" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
msg_id Specifies the function to be performed or the chart to direct
(USHORT) the message.
param1 Specifies the first parameter of the message.
(ULONG)
param2 Specifies the second parameter of the message as a pointer.
(PCH)
64
ChartSendMsgPV - Send operational flags to charts
═════════════════════════════════════════════════
This function provides another entry mechanism into the "ChartSendMsg" API.
This is made available to minimize casting problems associated with some C++
compilers. The prototype for the API is as follows.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartSendMsgPV(hchart, // Chart handle │
│ msg_id, // Message identifier │
│ param1, // Parameter 1 │
│ param2); // Parameter 2 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartSendMsgPV" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
msg_id Specifies the function to be performed or the chart to direct
(USHORT) the message.
param1 Specifies the first parameter of the message as a pointer.
(PCH)
param2 Specifies the second parameter of the message.
(LONG)
65
ChartSendMsgPP - Send operational flags to charts
═════════════════════════════════════════════════
This function provides another entry mechanism into the "ChartSendMsg" API.
This is made available to minimize casting problems associated with some C++
compilers. The prototype for the API is as follows.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartSendMsgPP(hchart, // Chart handle │
│ msg_id, // Message identifier │
│ param1, // Parameter 1 │
│ param2); // Parameter 2 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartSendMsgPP" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
msg_id Specifies the function to be performed or the chart to direct
(USHORT) the message.
param1 Specifies the first parameter of the message as a pointer.
(PCH)
param2 Specifies the second parameter of the message as a pointer.
(PCH)
66
ChartSetColor - Set the basic color for a chart item
════════════════════════════════════════════════════
ChartSetColor(hchart,chart_item,color);
This function sets chart characteristics (i.e. title text, chart border,
graphic background) to one of eighteen color values. The default color for
all text and lines is the system default (contrast to background).
NOTE: See "ChartSetGroupColor", "ChartSetRGB", and "ChartSetGroupRGB"
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartSetColor(hchart, // Chart handle │
│ chart_item, // Chart characteristic │
│ color); // Color │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartSetColor" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
chart_item Specifies the major component to be affected. These parameters
(ULONG) may be or-ed together.
CH_FRAME Specifies the frame area for the entire chart
rectangle.
CH_GRAPHIC_FRAME Specifies the frame for the graphic display of
the data.
CH_GRAPHIC_WALL Specifies the shadow box wall frame for 3D
charts.
CH_CLIENT Specifies the area inside CH_FRAME. The
CH_CLIENT area is painted before the
CH_GRAPHIC area.
CH_GRAPHIC Specifies the background area of the graphic
data display.
CH_TITLE Specifies the title or heading text.
CH_FOOTING Specifies the footing text.
67
CH_LEFT_MARGIN Specifies the left margin text.
CH_RIGHT_MARGIN Specifies the right margin text.
CH_LEGEND Specifies the legend text.
CH_X_TICK Specifies the vertical ticks on the bottom
of the CH_GRAPHIC area for charts.
CH_Y_TICK Specifies the horizontal ticks on the left
side of the CH_GRAPHIC area for charts.
CH_Z_TICK Specifies the horizontal ticks on the right
side of the CH_GRAPHIC area for charts.
CH_X_TICK_TEXT Specifies x-axis scaling text.
CH_Y_TICK_TEXT Specifies y-axis scaling text.
CH_Z_TICK_TEXT Specifies z-axis scaling text.
CH_X_GRID Specifies the vertical grid lines for the
x-axis.
CH_Y_GRID Specifies the horizontal grid lines for the
y-axis.
CH_Z_GRID Specifies the horizontal grid lines for the
z-axis.
CH_SCOPE Specifies the area represented by the
"ChartSetNormalDataScope" API.
CH_MINOR_GRID Specifies the minor grid lines for time-
based charts.
68
color Specifies one of the eighteen color values.
(LONG)
CLR_WHITE
CLR_BLACK
CLR_BACKGROUND
CLR_NEUTRAL
CLR_BLUE CLR_DARKBLUE
CLR_RED CLR_DARKRED
CLR_PINK CLR_DARKPINK
CLR_GREEN CLR_DARKGREEN
CLR_CYAN CLR_DARKCYAN
CLR_YELLOW CLR_BROWN
CLR_PALEGRAY CLR_DARKGRAY
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_not_defined 2 │
│ Chart_invalid_color 4 │
│ Chart_invalid_parameter 5 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The following illustrates setting the title and graphic area to the darkgray
color.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Bar chart handle │
│ │
│ │
│ fAns = ChartSetColor(hChart, // Chart handle │
│ CH_GRAPHIC | // Total graphic area │
│ CH_TITLE, // Chart title text │
│ CLR_DARKGRAY); // Basic color │
│ │
└───────────────────────────────────────────────────────────────────────────┘
69
ChartSetColorTable - Set the colors for the numeric and symbol tables
═════════════════════════════════════════════════════════════════════
This function sets the color representation for the numeric and symbol
tables. A data point is compared against a range_data array to determine the
color of the data. The comparison proceeds until a match is found (= or <)
or the end of the array is encountered. If no match is found, the default
color will be used. The values in the range_data can also determine the
characteristics or symbols to be displayed in a symbol chart.
This function is operational and is described only in the full function
product.
70
ChartSetCountryCode - Set language translation
══════════════════════════════════════════════
This function enables the automatically generated text to be translated into
a language supported by the graphics DLL. This function request will also
provide for currency symbols and other selected items.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartSetCountryCode(hChart, // Chart handle │
│ country); // Country numeric value │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartSetCountryCode" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
country Specifies the numeric value of the country for the language
(USHORT) translation. (Consult the operating system documentation for
country numeric values.)
1 English (Default)
33 French
34 Spanish
39 Italian
46 Swedish
49 German
81 Japanese Kanji
358 Finish
7000 Russia
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes NONE │
│ │
│ Retains current setting when unsupported value is given. │
│ │
└───────────────────────────────────────────────────────────────────────────┘
71
The following illustrates setting the German automatically generating text
translation and NLS.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Bar chart handle │
│ │
│ │
│ fAns = ChartSetColor(hChart, // Chart handle │
│ 49); // German language value │
│ │
└───────────────────────────────────────────────────────────────────────────┘
72
ChartSetDimensions - Set visual dimensions of a chart
═════════════════════════════════════════════════════
ChartSetDimensions(hchart,dimensions);
This function changes the visual appearance of the graphic to be
displayed. The result will be a two dimension (2D) or three dimension (3D)
chart.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartSetDimensions(hChart, // Chart handle │
│ dimensions); // Chart dimensions │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartSetDimensions" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
dimension Specifies a value of 2 or 3 to indicate either a 2D or 3D chart
(USHORT) to be displayed.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_invalid_dimensions 10 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The following illustrates setting a chart for 2 dimensions.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Bar chart handle │
│ │
│ │
│ fAns = ChartSetDimensions(hChart, // Chart handle │
│ 2); // 2 dimensions │
│ │
└───────────────────────────────────────────────────────────────────────────┘
73
ChartSetFont - Change the font name and point size
══════════════════════════════════════════════════
This function changes the name of the font used in the chart to be displayed,
printed, directed to a metafile or sent to the clipboard. The API is a
pointer to a data structure containing the control information for font
typefaces and point sizes. The system supported typefaces are used with a
maximum of six point sizes. The six point sizes must be specified with the
smallest point size first and proceeding in ascending order.
This function is operational and is described only in the full function
product.
ChartSetFrame - Place a frame around entire chart area
══════════════════════════════════════════════════════
ChartSetFrame(hchart,visible);
This function paints or removes a border surrounding the entire chart. The
ability to paint a frame or border is provided to isolate the chart from
other application data elements present in a window.
This function is operational and is described only in the full function
product.
74
ChartSetGroupColor - Set the basic color for a data group
═════════════════════════════════════════════════════════
This function sets a data group to one of eight basic colors and eight
shades. Both light and dark colors are used for foreground elements,
with darker colors used for dimension shading. 2D charts, except line,
smooth line and scatter charts, will be displayed in light colors. The
line, smooth line and scatter charts will be displayed in darker shades.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartSetGroupColor(hchart, // Chart handle │
│ group, // Group number │
│ color); // Group color │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartSetGroupColor" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
group Specifies the number of the data group that will be displayed.
(USHORT) This number must range between 1 and 12.
color Specifies one of the eight basic color values.
(SHORT)
CLR_RED
CLR_GREEN
CLR_BLUE
CLR_YELLOW
CLR_DARKGRAY
CLR_CYAN
CLR_PINK
CLR_PALEGRAY
75
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_invalid_color 4 │
│ Chart_invalid_group 8 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The following illustrates setting data group 2 to the cyan color.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Bar chart handle │
│ │
│ │
│ fAns = ChartSetColor(hChart, // Chart handle │
│ 2, // Group number │
│ (SHORT)CLR_CYAN); // Basic color │
│ │
└───────────────────────────────────────────────────────────────────────────┘
76
ChartSetGroupCount - Set number of data groups to display
═════════════════════════════════════════════════════════
This function sets the number of data groups displayed in a chart. This
function should be used after "ChartCreate" to change the number of data
groups specified.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartSetGroupCount(hchart, // Chart handle │
│ groups); // Data groups for chart │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartSetGroupCount" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
groups Specifies the number of the data group that will be displayed.
(USHORT) This number must range between 1 and 12.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_invalid_group 8 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The following illustrates changing an existing data group specification to 4
groups
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Bar chart handle │
│ │
│ │
│ fAns = ChartSetGroupCount(hChart, // Chart handle │
│ 4); // 4 data groups │
│ │
└───────────────────────────────────────────────────────────────────────────┘
77
ChartSetGroupLineType - Set a data group lines to a pattern
═══════════════════════════════════════════════════════════
ChartSetGroupLineType(hchart,group,pattern);
This function sets the line pattern for a specific data group.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartSetGroupLineType(hchart, // Chart handle │
│ group, // Data group number │
│ pattern); // Line pattern │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartSetGroupLineType" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
groups Specifies the number of the data group that will be displayed.
(USHORT) This number must range between 1 and 12.
pattern Specifies the line type attribute.
(LONG)
LINETYPE_DEFAULT ────────────
LINETYPE_DOT ............
LINETYPE_SHORTDASH ------------
LINETYPE_DASHDOT -.-.-.-.-.-.
LINETYPE_DOUBLEDOT .. .. .. ..
LINETYPE_LONGDASH ── ── ── ──
LINETYPE_DASHDOUBLEDOT -..-..-..-..
LINETYPE_SOLID ────────────
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_invalid_group 8 │
│ Chart_invalid_line_type 17 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
78
The following illustrates setting data group 2 to a line type of long dashes.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Line chart handle │
│ │
│ │
│ fAns = ChartSetGroupLineType(hChart, // Chart handle │
│ 2, // Group 2 │
│ LINETYPE_LONGDASH); // ── ── Long dash lines│
│ │
└───────────────────────────────────────────────────────────────────────────┘
79
ChartSetGroupMarker - Set scatter and line chart marker for group
═════════════════════════════════════════════════════════════════
This function sets a marker symbol for a specific data group. The
default marker symbol for all data groups is a solid diamond.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartSetGroupMarker(hchart, // Chart handle │
│ group, // Data group number │
│ marker); // Marker type │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartSetGroupMarker" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
group Specifies the number of the data group that will be displayed.
(USHORT) This number must range between 1 and 12.
marker Specifies the marker symbol attribute.
(LONG)
MARKSYM_DEFAULT
MARKSYM_CROSS
MARKSYM_PLUS
MARKSYM_DIAMOND
MARKSYM_SQUARE
MARKSYM_SIXPOINTSTAR
MARKSYM_EIGHTPOINTSTAR
MARKSYM_SOLIDDIAMOND
MARKSYM_SOLIDSQUARE
MARKSYM_DOT
MARKSYM_SMALLCIRCLE
MARKSYM_TRIANGLEUP
MARKSYM_TRIANGLEDOWN
MARKSYM_SOLIDTRIANGLEUP
MARKSYM_SOLIDTRIANGLEDOWN
MARKSYM_LARGECIRCLE
MARKSYM_DOCUMENT
MARKSYM_NULL
80
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_invalid_group 8 │
│ Chart_invalid_marker 16 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The following illustrates setting data group two with a solid square marker
type.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Scatter chart handle │
│ │
│ │
│ fAns = ChartSetGroupMarker(hChart, // Chart handle │
│ 2, // Group 2 │
│ MARKSYM_SOLIDSQUARE); // Solid square │
│ │
└───────────────────────────────────────────────────────────────────────────┘
81
ChartSetGroupPattern - Assign a pattern for a group
═══════════════════════════════════════════════════
ChartSetGroupPattern(hchart,group,pattern,overlay,color);
This function specifies a data group to be displayed using a pattern
This function is operational and is described only in the full function
product.
ChartSetGroupRGB - Set the RGB colors for a data group
══════════════════════════════════════════════════════
ChartSetGroupRGB(hchart,group,rgb1,rgb2);
This function sets a data group's RGB color values.
This function is operational and is described only in the full function
product.
82
ChartSetGroupStyle - Assign data group to chart style
═════════════════════════════════════════════════════
This function is used in conjunction with either the CH_X_PLOT or CH_MIXED
chart types. Its function is to assign a specific data group to a specific
graphic style.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartSetGroupStyle(hchart, // Chart handle │
│ group, // Data group number │
│ style, // Group style │
│ options); // Style options │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartSetGroupStyle" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
group Specifies the number of the data group that will be displayed.
(USHORT) This number must range between 1 and 12.
style Specifies the type of graphic style for the group being
(USHORT) assigned. Valid assignments are as follows.
CH_SCATTER
CH_LINE
CH_SPIKE
CH_SQUARE_WAVE
CH_AREA
CH_RANGE
options Specifies options for the style parameter. For the CH_SCATTER
(ULONG) style specification, this parameter specifies the type of marker
symbol to be used. For the CH_LINE style specification, this
parameter specifies the type of line to be used (i.e. dots).
NOTE: This API can also be used with the CH_BAR_GOAL chart type. The only
style parameter which can be provided is CH_LINE. This will enable the chart
to have multiple lines. To control the type of line displayed as either a
stright line or a square wave (default) the ChartSendMsg API may be required.
83
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_invalid_chart_type 15 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
84
ChartSetLineType - Set chart lines for all groups to a pattern
══════════════════════════════════════════════════════════════
This function sets the pattern for all data groups. The default line type is
a solid line for all data groups.
NOTE: See "ChartSetGroupLineType".
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartSetLineType(hchart, // Chart handle │
│ pattern); // Line pattern │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartSetLineType" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
pattern Specifies the line type attribute.
(LONG)
LINETYPE_DEFAULT ────────────
LINETYPE_DOT ............
LINETYPE_SHORTDASH ------------
LINETYPE_DASHDOT -.-.-.-.-.-.
LINETYPE_DOUBLEDOT .. .. .. ..
LINETYPE_LONGDASH ── ── ── ──
LINETYPE_DASHDOUBLEDOT -..-..-..-..
LINETYPE_SOLID ────────────
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_invalid_line_type 17 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
85
The following illustrates setting the line type to short dashes for all data
groups.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Line chart handle │
│ │
│ │
│ fAns = ChartSetLineType(hChart, // Chart handle │
│ LINETYPE_SHORTDASH); // - - - Short dash lines │
│ │
└───────────────────────────────────────────────────────────────────────────┘
86
ChartSetLineWidth - Set line chart width
════════════════════════════════════════
This function sets the data group pixel line width for straight line and
smooth line charts. The default line width is 2 pixels. (applicable to 2D
lines only);
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartSetLineWidth(hchart, // Chart handle │
│ width); // Pixel line width │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartSetLineWidth" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
width Specifies the line width in pixels. All values above 15 will
(LONG) default to 15.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes NONE │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The following illustrates setting the line width to 3 pixels.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Line chart handle │
│ │
│ │
│ fAns = ChartSetLineWidth(hChart, // Chart handle │
│ 3L); // 3 pixels wide │
│ │
└───────────────────────────────────────────────────────────────────────────┘
87
ChartSetMarker - Set scatter and line chart markers
═══════════════════════════════════════════════════
ChartSetMarker(hchart,marker);
This function sets a marker symbol for all of the data groups.
NOTE: This will reset all previous group markers specified in the
"ChartSetGroupMarker" function. MARKSYM_SOLIDDIAMOND is the default for all
data groups.
NOTE: See "ChartSetGroupMarker" API.
This function is operational and is described only in the full function
product.
ChartSetMaxXValue - Set maximum X-axis scale
════════════════════════════════════════════
These APIs are provided to support the CH_MATRIX chart and are are similar in
function to the ChartSetMaxYValue documented the programmers guide. Please
refer to the programmers guide for additional information.
This function is operational and is described only in the full function
product.
ChartSetMaxYValue - Set maximum Y-axis scale
════════════════════════════════════════════
ChartSetMaxYValue(hchart,value);
This function forces a maximum value for the Y-axis, overriding the
automatic scaling default in the ChartVisible function request. This
function is not applicable to pie charts.
This function is operational and is described only in the full function
product.
ChartSetMaxZValue - Set maximum Z-axis scale
════════════════════════════════════════════
ChartSetMaxZValue(hchart,value);
This function forces a maximum value for the Z-axis, overriding the
automatic scaling default in the ChartVisible function request. This
function is not applicable to pie charts.
This function is operational and is described only in the full function
product.
88
ChartSetMinYValue - Set minimum Y-axis scale
════════════════════════════════════════════
ChartSetMaxYValue(hchart,value);
This function forces a minimum value for the Y-axis, overriding the
automatic scaling default in the ChartVisible function request. This
function is not applicable to pie charts.
NOTE: The CH_FLOAT_SCALE parameter from either "ChartCreate" or
"ChartSetOptions" API is required.
This function is operational and is described only in the full function
product.
ChartSetMinZValue - Set minimum z-axis scale
════════════════════════════════════════════
ChartSetMaxZValue(hchart,value);
This function forces a minimum value for the Z-axis, overriding the
automatic scaling default in the ChartVisible function request. This
function is not applicable to pie charts.
NOTE: The CH_FLOAT_SCALE parameter from either "ChartCreate" or
"ChartSetOptions" API is required.
This function is operational and is described only in the full function
product.
ChartSetNormalDataScope
═══════════════════════
ChartSetNormalDataScope(hchart,low,high);
This function places a horizontal band in the graphic area prior to drawing
data points. The normal or historical scope for the data is displayed within
this visual band, thereby, causing data outside the scope to e distinct. The
height and placement of this band depends on the y-axis values and the
parameter values supplied to this function. The "ChartSetColor" API assigns
the horizontal band color. (Not applicable to perspective bar chart,
horizontal charts, or pie chart)
Note: When the low and high parameters are zero, the normal data scope
function is turned off.
This function is operational and is described only in the full function
product.
89
ChartSetOptions - Set chart flags on or off
═══════════════════════════════════════════
ChartSetOptions(hchart,chart_flags);
This function resets the chart_flags assigned in the ChartCreate
function.
NOTE: Use the "ChartQueryOptions" function to obtain the current chart_flags
status.
This function is operational and is described only in the full function
product.
ChartSetPattern - Assign a pattern for a chart item
═══════════════════════════════════════════════════
ChartSetPattern(hchart,item,pattern,overlay,color);
This function specifies a chart item to be displayed using a pattern.
This function is operational and is described only in the full function
product.
90
ChartSetPointCount - Set maximum number of data points per group
════════════════════════════════════════════════════════════════
This function resets the number of data points per group to be displayed.
The value can be less than the actual number of data points provided to the
ChartData function.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartSetPointCount(hchart, // Chart handle │
│ points); // Maximum points per group to │
│ // display. │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartSetPointCount" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
points Specifies the number of data points associated with any group.
(USHORT)
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_no_data 9 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The following illustrates setting the maximum number of displayed points to
three.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Bar chart handle │
│ │
│ │
│ fAns = ChartSetPointCount(hChart, // Chart handle │
│ 3); // 3 points for all groups │
│ │
└───────────────────────────────────────────────────────────────────────────┘
91
ChartSetRect - Change the location of a chart
═════════════════════════════════════════════
This function enables movement of a chart within a window area defined by
the chart handle in the "ChartCreate" function.
NOTE: This function should be followed by either a "ChartPaint" or
"ChartVisible" API request to show the chart on the display.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartSetRect(hChart, // Chart handle │
│ &rectl); // Rectangle pointer │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartSetRect" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
rectl Provides a pointer to a structure containing the bottom left
(PRECTL) and upper right coordinates. This is the chart location when it
is made visible.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes NONE │
│ │
└───────────────────────────────────────────────────────────────────────────┘
92
The following illustrates changing a chart location.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Bar chart handle │
│ RECTL Rectl; // Rectangle coordinates │
│ │
│ Rectl.xLeft = 50; │
│ Rectl.yBottom = 50; │
│ Rectl.xRight = 250; │
│ Rectl.yTop = 300; │
│ │
│ fAns = ChartSetRect(hChart, // Chart handle │
│ &Rectl); // New chart location │
│ │
└───────────────────────────────────────────────────────────────────────────┘
93
ChartSetRegions - Reallocate the chart sub-areas
════════════════════════════════════════════════
ChartSetRegions(hchart,graphic,heading,footing,left_margin,right_margin);
This function changes a region default size. The ChartCreate function
subdivides the rectangular space allocated into five regions. The
default size of these regions can be changed for the purpose of aesthetic
balancing and presentation style.
This function is operational and is described only in the full function
product.
ChartSetRGB - Set the RGB color for a chart item
════════════════════════════════════════════════
ChartSetRGB(hchart,chart_item,rgb);
This function sets chart characteristics (i.e. title text, chart border,
graphic background) to any available RGB color value. The default color
for all text and lines is the system default (contrast to background).
This function is operational and is described only in the full function
product.
ChartSetSymbolGroup - Specify number of data points per column
══════════════════════════════════════════════════════════════
ChartSetSymbolGroup(hchart,collect);
This function specifies the number of data point symbols to be grouped
together within each column of the symbol table chart.
This function is operational and is described only in the full function
product.
ChartSetTableFormat - Set characteristics of numeric and symbol tables
══════════════════════════════════════════════════════════════════════
ChartSetTableFormat(hchart,title,legend_title,format,width,justify);
This function provides the general characteristics of either the numeric
table or symbol table charts.
This function is operational and is described only in the full function
product.
94
ChartSetTextFontSize - Set font size for a chart text element
═════════════════════════════════════════════════════════════
ChartSetTextFontSize(hchart,flags,size);
This function specifies a font size for the display of a chart text element.
NOTE: This function overrides automatic font sizing.
This function is operational and is described only in the full function
product.
ChartSetTicks - Specify controls for the y-axis and z-axis
══════════════════════════════════════════════════════════
ChartSetTicks(hchart,item,&ticks);
This function disables the axis automatic scaling and specifies the controls
for the y-axis and z-axis tick elements.
This function is operational and is described only in the full function
product.
ChartSetTimeRange - Set time range for time-based charts
════════════════════════════════════════════════════════
ChartSetTimeRange(hchart,&start,&end);
This function specifies a starting and ending time range for the data. Data
points prior to and following the preset time range will not be displayed.
This function is operational and is described only in the full function
product.
95
ChartTimeReference - Set the data point time elements for time-based charts
═══════════════════════════════════════════════════════════════════════════
ChartTimeReference(hchart,group,count,&array);
This function provides the date and time element of each data point for the
chart. To enable time based scatter, line, smooth line, spike, square wave,
high/low range, area and candlestick charts, set the CH_TIME_BASED flag in
either "ChartCreate" or "ChartSetOptions" APIs.
NOTE: This flag requires all data points provided to "ChartData" be
accompanied by an associated time value. The "ChartData" API must be issued
prior to the "ChartTimeReference" API.
This function is operational and is described only in the full function
product.
96
ChartSetType - Change the chart from one type to another
════════════════════════════════════════════════════════
ChartSetType(hchart,chart_type,visible);
This function changes the current chart type from one form to another. A
bar chart can be changed to a line chart without redefining current data,
legends or other properties. At the time the function call is made, the
application may request the new chart to be made visible.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartSetType(hchart, // Chart handle │
│ chart_type, // New chart type │
│ visible); // Reshow indicator │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartSetType" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
chart_type Describes the current or new chart type. The values that may
(PCHTYPE) be provided are as follows:
CH_BAR CH_RANGE
CH_STACKED_BAR CH_HORIZONTAL_BAR
CH_COLUMN CH_HORIZONTAL_STACKED_BAR
CH_LINE CH_PLOT
CH_SMOOTH_LINE CH_OVERLAP_BAR
CH_SCATTER CH_CONNECTED_SCATTER
CH_AREA CH_BAR_GOAL
CH_PIE CH_X_PLOT
CH_PER_BAR CH_MIXED
CH_BAR_LINE CH_FLOAT_BAR
CH_NUMERIC_TABLE CH_FLOAT_STACKED_BAR
CH_SYMBOL_TABLE CH_MATRIX
CH_SPIKE CH_STACKED_AREA
CH_SQUARE_WAVE
CH_HISTOGRAM
97
visible True indicates the chart will be painted or re-shown after the
(BOOL) type change has been made (implied "ChartVisible" function).
FALSE specifies the chart type is changing but will not be
redisplayed.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_invalid_client 1 │
│ Chart_not_defined 2 │
│ Chart_no_memory 3 │
│ Chart_no_data 9 │
│ Chart_memory_release 12 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The following illustrates changing bar chart to a 3D line chart and
displaying the change.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Bar chart handle │
│ │
│ │
│ fAns = ChartSetDimensions(hChart,3); // Set chart to 3D │
│ │
│ ChartSetType(hChart, // Chart handle │
│ CH_LINE, // Set chart to line chart │
│ TRUE); // Display the line chart │
│ │
└───────────────────────────────────────────────────────────────────────────┘
98
ChartSetWindow - Change the window handle
═════════════════════════════════════════
ans = ChartSetWindow(hchart,new_hwnd);
This function enables the developer to change the window handle for a
chart after the chart creation. This allows the data to be re-shown in
different windows.
This function is operational and is described only in the full function
product.
99
ChartSetXTicks - Set x-axis tick text type
══════════════════════════════════════════
This function sets the text type and display direction under the x-axis
tick marks in all charts except pie charts.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartSetXTicks(hchart, // Chart handle │
│ direction, // Text direction │
│ text_type, // Type of tick text │
│ index); // Start text index │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartSetXTicks" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
direction Specifies the direction of display for the text tick marks.
(USHORT) CH_WIDTH is the only possible value for this parameter.
text_type Specifies a flag indicating the type of text to be placed under
(USHORT) the tick mark. A list of the text types follows:
CH_BASIC Basic numbering 1 - 60
CH_MONTHS Months of the year
CH_WEEK_DAYS 5 day week (Mon. - Fri.)
CH_DAYS 7 day week (Mon. - Sun.)
CH_HOURS 24 hours (12AM - 11PM)
CH_HOURS_24 Military time (0000 - 2300)
CH_MINUTES 1 - 60 minutes
CH_SECONDS 1 - 60 seconds
CH_LEDGER 0 - 360 (i.e. 0, 30, 60, 90)
100
index Specifies the "starting point in time" for the text set selected
(USHORT) in the text-type parameter.
NOTE: If CH_MONTHS is selected for the text and the start
paramenter value is 5, the first month displayed will be "May."
If CH_MONTHS is selected for the text and the start parameter is
14, the month displayed will be "February." (If the start value
is greater than the number of string elements implied by the
text parameter, a calculation performs and makes the proper
adjustments.)
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_invalid_parameter 5 │
│ Chart_invalid_tick_text 11 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The following illustrates setting the "months of the year" for a bar chart
beginning in February.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Bar chart handle │
│ │
│ │
│ fAns = ChartSetXTicks(hChart, // Set chart to 3D │
│ CH_WIDTH, // Text direction │
│ CH_MONTHS, // Type of tick text │
│ 2); // Start with February │
│ │
└───────────────────────────────────────────────────────────────────────────┘
101
ChartSetXTicksFloat - Set x-axis tick floating point value
══════════════════════════════════════════════════════════
ans = ChartSetXTicksFloat(hchart,direction,start,increment,format);
This function allows the programmer to set floating point values to the
x-axis tick marks.
This function is operational and is described only in the full function
product.
102
ChartSetXTicksString - Set x-axis tick string values
════════════════════════════════════════════════════
This function sets application generated ASCIIZ string values for the x-axis
tick marks. X-axis string values repeat if the number of data points provided
to the chart exceed the number of string values provided.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartSetXTicksString(hchart, // Chart handle │
│ direction, // Text direction │
│ array_count, // Number of array items │
│ &array_ptr); // Pointer to asciiz text │
│ // string array │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartSetXTicksString" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
direction Specifies the direction of display for the text tick marks.
(USHORT) CH_WIDTH is the only possible value for this parameter.
array_count Specifies the count of asciiz string elements. A value of 0
(USHORT) releases previous strings.
array_ptr Specifies the pointer to the asciiz string array. The maximum
(PCH) length of any one string element can not exceed 50 characters.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_invalid_parameter 5 │
│ Chart_no_memory 3 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
103
The following illustrates placing "North", "South" and "East" under the
x-axis tick marks.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Bar chart handle │
│ │
│ static PCH aszAreas[3] = {"North","South","East"}; │
│ │
│ fAns = ChartSetXTicksString(hChart, // Chart handle │
│ CH_WIDTH, // Text direction │
│ 3, // Number of string elements │
│ aszAreas); // Pointer to string array │
│ │
└───────────────────────────────────────────────────────────────────────────┘
104
ChartSetXTicksStringBasic - BASIC Language interface
════════════════════════════════════════════════════
This API is provided for those programming languages which can not provide an
array of asciiz strings due to their programming tools restrictions. This
API enables the programmer to send one long character string to the charting
DLL and the DLL will parse the strings and perform the basic function of the
"ChartSetXTicksString" API. The separation between the strings is performed
by the caret ^ symbol from the keyboard.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartSetXTicksStringBasic(hchart, // Chart handle │
│ direction, // Text direction │
│ string); // Pointer to asciiz │
│ // string │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartSetXTicksStringBasic" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
direction Specifies the direction of display for the text tick marks.
(USHORT) CH_WIDTH is the only possible value for this parameter.
string Specifies a pointer to an ASCIIZ string
(PCH)
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_invalid_parameter 5 │
│ Chart_no_memory 3 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
105
The following illustrates placing "North", "South" and "East" under the
x-axis tick marks.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Bar chart handle │
│ │
│ │
│ fAns = ChartSetXTicksString(hChart, // Chart handle │
│ CH_WIDTH, // Text direction │
│ "North^South^East"); // String to be parsed │
│ │
└───────────────────────────────────────────────────────────────────────────┘
106
ChartSetYTicksString - Set y-axis tick string values
════════════════════════════════════════════════════
This function sets string values for the y-axis (i.e. power off, warm up,
off-line, and on-line). This function is generally used only with square
wave chart.
NOTE: a data point with a zero value will represent the first string and a
value of one will represent the second string. No check is made to insure
the data does not exceed the number of strings specified.
This function is operational and is described only in the full function
product.
107
ChartSetZAxisGroup - Assign a data group to the z-axis
══════════════════════════════════════════════════════
This function assigns a data group to the z-axis scale. The charting engine
assumes that at least one data group is assigned to the y-axis at all times.
NOTE: The z-axis ticks and tick text should be set to the same color as the
data group to insure the connection for interpretation.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartSetZAxisGroup(hchart, // Chart handle │
│ group, // Data group number │
│ assign); // Assignment indicator │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartSetZAxisGroup" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
group Specifies the number to be assigned to the z-axis. This number
(USHORT) must range between 1 and 12.
assign TRUE indicates the group will be assigned to the z-axis. FALSE
(BOOL) indicates the group will be assigned to the y-axis (system
default).
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_invalid_group 8 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
108
ChartText - Specify chart text (i.e. heading, footing)
══════════════════════════════════════════════════════════════════════
This function defines the text strings to be placed in the five chart
areas. The chart heading, footing, left margin, right margin, graphic
text areas can be defined or removed.
NOTE: if enough space is provided in the title and footing areas, inserting ~
in the text string will initiate a new line. A maximum of four (4) lines
area allowed.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartText(hchart, // Chart handle │
│ placement, // Type of text to place │
│ &string); // Pointer to text string │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartText" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
placement Indicates the type of text.
(ULONG))
CH_TITLE Horizontal centering of title
CH_FOOTING Horizontal centering of footing
CH_LEFT_MARGIN Vertical centering of left margin
CH_RIGHT_MARGIN Vertical centering of right margin
string Points to an ASCIIZ string of data containing the chart text
(PCH) defined to a specific area. If a NULL is provided, any previous
string is removed.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_no_memory 3 │
│ Chart_invalid_parameter 5 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
109
The following illustrates two methods of specifying a chart heading.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Bar chart handle │
│ │
│ static CHAR aszTitle[14] = "Monthly Sales"; │
│ │
│ fAns = ChartText(hChart, // Chart handle │
│ CH_TITLE, // Text placement area │
│ &aszTitle); // Pointer to text string │
│ │
│ // or │
│ │
│ fAns = ChartText(hChart, // Chart handle │
│ CH_TITLE, // Text placement area │
│ "Monthly Sales"); // Actual text string │
│ │
└───────────────────────────────────────────────────────────────────────────┘
110
ChartTexts - Set all chart texts (i.e. heading, margins)
════════════════════════════════════════════════════════
This function defines all of the text strings to be placed in the four
chart areas using a single call interface. The chart heading, footing,
left margin, and right margin areas can be defined or removed in any
combination.
NOTE: if enough space is provided in the title and footing areas, inserting ~
in the text string will initiate a new line. A maximum of four (4) lines
area allowed.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartTexts(hchart, // Chart handle │
│ &heading, // Heading string │
│ &footing, // Footing string │
│ &left_margin, // Left margin string │
│ &right_margin); // Right margin string │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartTexts" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
heading Points to an ASCIIZ string of data containing the chart text for
(PCH) the heading area. If a NULL is provided, any previous string
will be removed.
footing Points to an ASCIIZ string of data containing the chart text for
(PCH) the footing area. If a NULL is provided, any previous string
will be removed.
left_margin Points to an ASCIIZ string of data containing the chart text for
(PCH) the left margin area. If a NULL is provided, any previous
string will be removed.
right_margin Points to an ASCIIZ string of data containing the chart text for
(PCH) the right margin area. If a NULL is provided, any previous
string will be removed.
111
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_no_memory 3 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The following illustrates defining a heading and left margin.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Bar chart handle │
│ │
│ fAns = ChartText(hChart, // Chart handle │
│ "Monthly Sales", // Title │
│ NULL, // No footing │
│ "Actual", // Left margin │
│ NULL); // No right margin │
│ │
└───────────────────────────────────────────────────────────────────────────┘
112
ChartVisible - Draw the chart
═════════════════════════════
ChartVisible(hchart);
The "ChartVisible" function paints the chart specified by the "ChartCreate"
function containing data defined in the "ChartData" function.
See also: "ChartPaint"
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ ans = ChartVisible(hchart); // Chart handle │
│ │
└───────────────────────────────────────────────────────────────────────────┘
The "ChartVisible" function parameters are as follows:
ans Provides TRUE for a successful request or FALSE for an
(BOOL) unsuccessful request. If a FALSE indicator is returned, check
the "error" code location specified in the "ChartCreate"
function.
hchart Specifies the handle returned by the "ChartCreate" function.
(HWND)
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ Error codes Chart_invalid_client 1 │
│ Chart_not_defined 2 │
│ Chart_no_memory 3 │
│ Chart_no_data 9 │
│ Chart_memory_release 12 │
│ │
└───────────────────────────────────────────────────────────────────────────┘
113
The following illustrates making a chart visible.
┌───────────────────────────────────────────────────────────────────────────┐
│ │
│ BOOL fAns; // Successful call indicator │
│ static HWND hChart; // Bar chart handle │
│ │
│ fAns = ChartVisible(hChart); // Chart handle │
│ │
└───────────────────────────────────────────────────────────────────────────┘
114
Installation
════════════
To use this mini-release on you system, you must copy the following files
to directories which are customary on your development system.
CHART32.DLL
CHART32.LIB
CHART.H
Compiling and Linking you program
═════════════════════════════════
The following statements are generally used with the IBM C/C++ tool set
to compile and link an application program called "DEMO".
icc /Kbcr /W1 /Gs /Gm /C DEMO.C
LINK386 /NOI DEMO,DEMO,NUL,CHART32.LIB,DEMO.DEF;
RC DEMO.RC
The Sample Program
══════════════════
Before the programmer begins programming, please review the sample
program "DEMO.C" for and example of how to create a 3-D bar chart.
115