Chart2D Olchocx
Chart2D Olchocx
Chart2D Olchocx
2D / 3D OCX
User’s Guide and Programmer’s Manual
Version 6.0.2
APEX and the APEX logo are registered trademarks of APEX Software Corporation.
KL Group, Olectra, and Olectra Chart are trademarks or registered trademarks of KL Group Inc.
Microsoft, MS-DOS, Visual Basic, and Windows are registered trademarks, and Windows NT is a trademark
of Microsoft Corporation.
All other products, names, and services are trademarks or registered trademarks of their respective companies
or organizations.
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
iii
3 Programming Considerations . . . . . . . . . . . . . . . . . . . . . . . .45
3.1 Object Hierarchy . . . . . . . . . . . . . . . . . . . . . 46
3.2 Programming With Objects . . . . . . . . . . . . . . . . . 46
3.3 Setting the Error Offset . . . . . . . . . . . . . . . . . . . 48
3.4 Programming In C++ . . . . . . . . . . . . . . . . . . . 49
3.5 Programming in Delphi . . . . . . . . . . . . . . . . . . 51
3.6 Using Array Data in Delphi . . . . . . . . . . . . . . . . . 52
3.7 Compatibility Issues . . . . . . . . . . . . . . . . . . . . 54
3.8 Upgrading Visual Basic 4.0 Projects from Olectra Chart 1.1 . . . . 54
iv Contents
6.3 Charting Data Directly From Your Program . . . . . . . . . . 96
6.4 Charting Data Using Data Binding . . . . . . . . . . . . . . 97
6.5 Hiding and Excluding Data Series . . . . . . . . . . . . . . 98
6.6 Fast Update Methods . . . . . . . . . . . . . . . . . . . 99
6.7 Copying Data . . . . . . . . . . . . . . . . . . . . . . 100
6.8 Batching Chart Updates . . . . . . . . . . . . . . . . . . 103
6.9 Double Buffering . . . . . . . . . . . . . . . . . . . . . 103
Contents v
Part II: Using 3D Chart
10 Chart Basics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
10.1 Chart Terminology . . . . . . . . . . . . . . . . . . . . 152
10.2 Using the Property Editor . . . . . . . . . . . . . . . . . . 152
10.3 Interacting with the Chart . . . . . . . . . . . . . . . . . . 153
10.4 Choosing the Chart Type . . . . . . . . . . . . . . . . . . 154
10.5 3D Bar and 3D Surface Charts . . . . . . . . . . . . . . . . 155
10.6 Understanding Data Layout . . . . . . . . . . . . . . . . . 163
10.7 Loading and Saving Charts and Data . . . . . . . . . . . . . 167
vi Contents
14.3 Point Data . . . . . . . . . . . . . . . . . . . . . . . . 201
14.4 Loading Data From a File . . . . . . . . . . . . . . . . . . 202
14.5 Charting Data Directly From Your Program . . . . . . . . . . 204
14.6 Copying Data . . . . . . . . . . . . . . . . . . . . . . 205
14.7 Double Buffering . . . . . . . . . . . . . . . . . . . . . 206
Contents vii
Contents
viii
Olectra Chart OCX
Preface
Introduction n Assumptions
Typographical Conventions Used in This Manual n Related Documents
Introduction
Windows contains many different pre-defined OLE controls such as buttons, scrollbars,
and list boxes. Conceptually, the 2D and 3D Charts add new OLE controls to Windows
that display data graphically in a window and can interact with a user.
The chart is made up of a logical hierarchy of objects, and each object has its own
properties and methods that determine how the chart looks and functions. Writing
programs using Olectra Chart is similar to writing any other kind of Windows program;
you now have one more control to work with.
2D Chart Control
9
3D Chart Control
Assumptions
This manual assumes that the reader is familiar with the Visual Basic programming
language. An understanding of basic Windows and OLE programming, including event-
driven programming, using standard Windows controls, and OLE automation is helpful to
use this manual. See page 11 for information on Windows programming references.
Olectra Chart OCX
10 Preface
Typographical Conventions Used in This Manual
Bold n Chart object, property, and method names.
n Language-specific keywords, constants, variables, and
function names.
n Commands that you enter at a command prompt.
UPPERCASE n File and directory names, key names, and key sequences.
Related Documents
The following documents are useful references for OLE application development:
n Microsoft Visual Basic Programmer’s Guide, Microsoft Corporation.
n Windows 3.1 SDK and Windows 3.1 API online documentation, Microsoft
Corporation.
n Inside OLE by Kraig Brockschmidt, Microsoft Press.
n Win32 SDK and Win32 API online documentation, Microsoft Corporation.
Preface 11
Preface
12
Olectra Chart OCX
Olectra Chart OCX
1
Chart Basics
Chart Terminology n Using the Property Editor
Interacting with the Chart n Choosing the Chart Type
Understanding Data Layout n Loading and Saving Charts and Data
Successful charting requires that you are familiar with basic chart processes and
vocabulary, specifically as they relate to the 2D Chart control. The following topics cover
basic information that anyone who uses 2D Chart should be familiar with.
15
1.1 Chart Terminology
The following shows the terms used to describe chart elements.
Header
Title
ChartArea
PlotArea
Y-Axis
Y2-Axis
X-Axis
Legend
Footer
Title
Pie charts contain the same elements except for the axes.
As you edit properties, the changes are immediately applied to the chart and displayed.
This enables you to quickly see how a change affects the chart so that you can make
further changes without leaving the Property Editor. However, once you have changed a
property the only way to “undo” it is to change the property back to its previous value.
Tabs contain one or more inner tabs that group related properties together. Some tabs
also contain a list that selects a specific object to edit.
2. If the tab contains a list on the left side, select the specific object to edit from that list.
3. Select the inner tab that corresponds to the kind of property you want to edit.
4. Click on a control and change the value of that property.
The change is immediately applied to the chart and displayed unless the IsBatched
property (located on the Control tab’s General inner tab) is set. When IsBatched is set,
click the Apply button to display property changes.
5. Make further changes to the same property or change other properties on this tab or
other tabs.
Olectra Chart provides users with 2 different mechanisms for zooming the chart: Graphics
zoom and Axis zoom. Performing a Graphics zoom enlarges the selected area of a chart,
Special Notes
n The keyboard/mouse combinations that perform the different interactions can be
changed or removed by a programmer. The interactions described here may not be
enabled for your chart.
n Scaling, moving, or graphics zooming the chart sets the PlotArea margin properties,
so the chart will not automatically control margins anymore when other chart
properties change.
Data point
(SymbolStyle)
Connecting line
(LineStyle)
Use the ChartGroup object’s IsStacked property to create a stacking Plot chart. Stacking
charts represent the data by stacking the values for each series on top of the values from
the previous series.
For more information on stacking charts, see Stacking Bar Charts on page 21.
Use the ChartGroup object’s IsStacked property to create a stacking Area chart. Stacking
charts represent the data by stacking the values for each series on top of the values from
the previous series.
Olectra Chart OCX
For more information on stacking charts, see Creating Stacking Charts on page 83.
Data Layout:
Array only
Bar fill
(FillStyle)
Point-labels
X-axis annotation
Data Layout:
Array only
Point-labels
X-axis annotation
Data Layout:
Array only
Pie fill
(FillStyle)
Point-labels X-axis
annotation only
Using ChartStyles, you can customize the fill and line properties of each series.
Olectra Chart OCX
Data Layout:
Array only
Bar fill
(FillStyle)
The four different series used to draw a candle chart creates a "logical" data set. When
programming chart labels, point and set labels and markers, make sure you refer to this
logical data set, and not the individual series themselves. For example, if there are 8 series
forming 2 different candles, series 0 refers to the first logical data set, and series 1 refers to
the second logical data set.
Using ChartStyles, you can customize the fill and line properties of each series.
Data Layout:
Array only
Line width
(LineStyle)
Programming Considerations
Using ChartStyles, you can customize the fill and line properties of each series.
Data Layout:
Array only
Line width
(LineStyle)
Programming Considerations
The 4 different series used to draw a HiLoOpenClose chart creates a "logical" data set.
When programming chart labels, point and set labels and markers, make sure you refer to
this logical data set, and not the individual series themselves. For example, if there are 8
series forming 2 different HiLoOpenClose bars, series 0 refers to the first logical data set,
and series 1 refers to the second logical data set.
Olectra Chart OCX
Using ChartStyles, you can customize the line and symbol properties of each series.
Data Layout:
Array or General
Symbol style
(SymbolStyle)
Point-labels
X-axis annotation
Use the ChartGroup object’s IsStacked property to create a stacking Polar chart. Stacking
charts represent the data by stacking the values for each series on top of the values from
the previous series.
Using ChartStyles, you can customize the line and symbol properties of each series.
Data Layout:
Array only
Point-labels
X-axis annotation
Symbol style
(SymbolStyle)
Use the ChartGroup object’s IsStacked property to create a stacking Radar chart. Stacking
charts represent the data by stacking the values for each series on top of the values from
the previous series.
Olectra Chart OCX
For more information on stacking charts, see Creating Stacking Charts on page 83.
Using ChartStyles, you can customize the fill and line properties of each series.
Data Layout:
Array only
Point-labels
X-axis annotation
Fill color
(FillStyle)
Use the ChartGroup object’s IsStacked property to create a stacking Radar chart. Stacking
charts represent the data by stacking the values for each series on top of the values from
the previous series.
Data Layout:
Array or General
Symbol Style
Encoding Method:
Area or Diameter
Programming Considerations
The 2 different series used to draw a Bubble chart create a "logical" data set. When
programming chart labels, point and set labels and markers, make sure you refer to this
logical data set, and not the individual series themselves. For example, if there are 4 series
forming 2 different Bubble chart plots, series 0 refers to the first logical data set, and series
1 refers to the second logical data set.
Olectra Chart OCX
Array Layout
Use Array layout with bar, stacking bar, HiLo, HiLoOpenClose, bubble, candle, radar,
filled radar and pie charts. Plots, polar and area charts can also use Array data when the Y-
values in their series share common X-values.
Array Data
2 Series of 3 Points
Note
General Layout
Use General layout with plots, polar area charts. Candle, bar, stacking bar, HiLo,
HiLoOpenClose, radar, filled radar and pie charts cannot display General data.
To Edit Data:
n Use the Layout, Hole, NumSeries, and NumPoints properties to set the format, size, and
hole value for the data. Use the ThisSeries and ThisPoint properties to select a specific
data point, and edit the values of the XValue and YValue properties. These properties
are also located on the ChartGroups tab’s Data inner tab on the Property Editor.
n Use the Edit Chart Series dialog to add, remove, hide or show a data series. Access
this dialog by clicking the Series button on the ChartGroups tab’s Data inner tab on the
Property Editor.
Olectra Chart OCX
n Use the Edit Chart Data dialog to edit X and Y values. Access this dialog by clicking
the Data button on the ChartGroups tab’s Data inner tab on the Property Editor.
Olectra Chart includes sample chart descriptions and data files that you can use as
templates to build a more highly-customized chart.
Certain ChartTypes have special properties or features that should be taken into
consideration when using them in your chart. For a detailed description of each
ChartType, see Choosing the Chart Type on page 19.
33
2.1 Special Bubble Chart Properties
A bubble chart combines 2 series to draw a plot chart with varying point sizes. The
encoding method for the size of the bubbles, as well as their minimum and maximum size
can be specified.
Encoding Method
Use the EncodingMethod property to set whether to size the bubbles according to
diameter or area. When specifying the size of the bubble, both the diameter and area are
measured as a percentage of the total diameter or area of the plot area. Inverting these
values (making the Minimum value larger than the Maximum) draws large bubbles for
small values, and small bubbles for large values.
The EncodingMethod property is located on the ChartGroups tab’s Bubble inner tab on
the Property Editor.
The maximum and minimum allowable size for bubbles can be set using the
MaximumSize and MinimumSize properties respectively. These properties are located
on the ChartGroups tab’s Bubble inner tab on the Property Editor.
Cluster Overlap
Use the bar ClusterOverlap property to set the amount that bars overlap each other in a
cluster. The value represents the percentage of bar overlap, with valid values between -100
and 100.
Olectra Chart OCX
Use the bar ClusterWidth property to set the space used by each bar cluster. The value
represents the percentage available space, with valid values between 0 and 100.
All Bar properties are located on the ChartGroups tab’s Bar inner tab on the Property
Editor.
Each series in a stacking bar chart can be either hidden (where the series is charted as a
blank set) or excluded (where the series is not considered part of the chart data). Use the
In the following examples, the third series is shown, hidden, and then excluded.
Use the IsYAxis100Percent and IsY2Axis100Percent properties of the Axis object to scale
the Y axis of stacking bar charts to a common 100 percent value. When
IsYAxis100Percent or IsY2Axis100Percent is False, the actual series data is used. When
Negative values
For stacking bar charts, series with negative values are displayed below the X-axis, as is
shown in the example below:
A candle chart draws 4 series together to form a logical data set. For example, the first and
second series show the high and low value of a stock, and the third and fourth series
represent the stock’s opening and closing price. You can specify how the candle is drawn
by setting the IsComplex property.
Use the candle IsComplex property to specify the type of candle chart drawn. Simple
candle charts (IsComplex is False) are drawn with a filled candle to indicate a falling
All candle properties are located on the ChartGroups tab’s Candle inner tab on the
Property Editor.
display the open tick marks (Series 3) and enable IsShowingClose to display the close tick
marks (Series 4). Enable IsOpenCloseFullWidth to draw the open and close tick marks
on both sides of the vertical range.
Pie charts are often more effective if unimportant values are grouped into an “Other”
category. Use the pie ThresholdMethod property to select the grouping method to use.
“SliceCutoff” is useful when you know the data value that should be grouped into the
“Other” slice. “Percentile” is useful when you want a certain percentage of the pie to be
devoted to the “Other” slice.
Use the ThresholdValue property to specify the value used for the ThresholdMethod.
These properties are located on the ChartGroups tab's Pie inner tab on the Property
Editor.
Percentile method
ThresholdValue = 30.0
Olectra Chart OCX
Use the MinSlices property to finetune the number of slices displayed before the “Other”
slice. For example, when set to 5, the chart tries to display 5 slices before grouping data
into the “Other” slice.
Note:
n You can use a value of "0" to represent the "other" slice in code that would normally
expect a set value. For example, the series value returned by CoordToDataIndex will
be 0 when the other slice is picked.
Use the FillStyle Pattern and Color properties to define the appearance of the “Other”
slice. These properties are located on the ChartStyles tab’s FillStyle inner tab on the
Property Editor.
Use the Text label property to change the label of the “Other” slice. Text is located on the
ChartGroups tab’s Labels inner tab on the Property Editor.
Pie Ordering
Starting Angle
Use the StartAngle property to specify the angle at which the slices for the first series
start. The default angle is 135 degrees. StartAngle is located on the ChartGroups tab’s
Pie inner tab on the Property Editor.
Exploding Pies
A slice of a pie chart can be emphasized by exploding it, which extrudes the slice from the
rest of the pie. Use the Offset property to set the exploded slice’s offset from the center of
To set the properties for an exploding slice for a single point, access the Slice object
through the PointStyles collection. The first number in the PointStyle’s Item method
specifies the Series, and the second number specifies the point.
‘ Sets the offset for the third point of the second
‘ series to 15% of the pie’s radius
Chart2D1.ChartGroups(1).PointStyles.Item(2,3).Slice.Offset = 15
‘ Resets the exploded slice.
Chart2D1.ChartGroups(1).PointStyles.Item(2,3).Slice.UseDefault = True
Missing Slices
A slice of the pie chart can be excluded, so that an empty gap in the pie appears where the
slice would otherwise be.
Missing slices must be set programmatically, and can be set by individual slices via the
PointDisplay property of the ChartGroup object. Unlike exploding pies, missing slices
cannot be specified by series. The PointDisplay property takes Display Constant values.
Olectra Chart OCX
Note:
The IsHalfRange property is located on the ChartGroups tab’s Polar inner tab on the
Property Editor.
Use the OriginBase property to set the number of degrees along the Y-axis to place the X-
axis. OriginBase can be from 0 to 359 degrees.
The OriginBase property is located on the Axes tab's Polar/Radar inner tab.
Use the AnnotationAngle property to specify where on the Y-axis to place the annotation.
The AnnotationAngle property is located on the Axes tab’s Polar/Radar inner tab.
Use the AxisAllowNegative property to specify whether or not to permit negative values
for r. When AxisAllowNegative is enabled, the chart shifts the axis to accommodate
negative values. When AxisAllowNegative is disabled, a negative radius is interpreted as
a positive radius rotated 180 degrees.
Olectra Chart OCX
The AxisAllowNegative property is located on the Axes tab’s Polar/Radar inner tab
Controlling the chart in an application program is generally quite straightforward once you
are familiar with the programming basics and the object hierarchy. For most chart objects,
the examples and overviews in the Object Reference provide all the information needed to
program them.
45
3.1 Object Hierarchy
The following are the high-level objects defined as children of the 2D Chart control:
Header
Title Object
ChartGroups
Data
ChartArea
Axes
PlotArea
Legend
Footer
Title Object
When you create a 2D Chart control, a Chart2D object is created. This object, like other
Visual Basic objects, has properties defined for it. You can change the behavior of your
chart by changing these properties.
The Object Reference describes the Chart2D object, the sub-objects automatically created
when the Chart2D object is created, and the properties defined for each object. Properties
which are read-only are indicated as such in their object description.
A Simple Example
The following statement turns off the chart’s double-buffering feature by setting the
IsDoubleBuffered property of the Chart2D object to False:
Chart2D1.IsDoubleBuffered = False
By default, the first Chart2D object created in an application is named Chart2D1, the
second is named Chart2D2, and so on. This is standard Visual Basic behavior.
As with other Visual Basic objects, you can access a specific object by navigating its
object hierarchy. For example, the following code retrieves the background color of the
main body of the chart:
Dim BackColor As Long
BackColor = Chart2D1.ChartArea.Interior.BackgroundColor
Default Properties
Both of the above statements change the value of the Type property to
oc2dBorderShadow.
Using Collections
Many 2D Chart objects are organized into collections. For example, the chart axes are
organized into the Axes collection.
All collections are indexed by number, with 1 referring to the first element of the
collection, 2 the second, and so on. If the objects in a collection have a Name property, the
collection can also be indexed by object name. For example:
Chart2D1.ChartArea.Axes("X").Max = 25.1
This statement accesses the axis named “X” (the X-axis), and sets the maximum value of
this axis to 25.1. Note that Visual Basic recognizes the default Item property of the
collection, whereas other environments may require an explicit reference to the Item
property:
Chart2D1.ChartArea.Axes.Item("X").Max = 25.1
For more details on the behavior of Visual Basic collections, refer to the Visual Basic
documentation.
Visual Basic enables you to access each of the elements of a collection in turn using the
For Each statement. For example, the following code positions all of the chart labels over
their attachment locations:
For Each Label in Chart2D1.ChartLabels
Label.Anchor = oc2dAnchorCenter
Next
Calling Methods
To call a 2D Chart method, access the object with which it is associated. For example, the
following statement uses the DataCoordToCoord method, defined by the ChartGroups
collection, to convert the chart coordinates (5.1, 10.2) to their equivalent pixel
coordinates:
Chart2D1.ChartGroups(1).DataCoordToCoord 5.1, 10.2, PixelX, PixelY
Each method is described in the help page for its associated object. For example,
DataCoordToCoord is described in the ChartGroups collection help page.
If the chart’s error numbers overlap the error numbers generated by another Visual Basic
custom control, you can change this ErrorOffset property. Note that you will need to
change the ErrorOffset property of every instance of a Chart2D object that you create.
Olectra Chart OCX
In the Visual C++ environment, a 2D Chart control behaves like any other OLE control,
which means that it can be incorporated into a container such as a dialog or an application
window.
To add the 2D Chart control to an OLE container project, use Component Gallery as
follows:
1. From the Insert menu, select Component. The Component Gallery dialog box ap-
pears.
2. Select the OLE Controls tab.
3. Select the 2D Chart control icon in the Component Gallery window.
4. Click the Insert button. This displays a Confirm Classes dialog box, which lists the
2D Chart control classes.
5. Click the OK button to accept the class generated by Component Gallery.
6. Click the Close button to close Component Gallery.
At this point, the 2D Chart wrapper class, CChart2D, is added to your project. This means
that the 2D chart control can now be added to your application’s main dialog box, as
shown below.
To add the 2D Chart control to your dialog template, perform the following steps:
1. Load the container project into Developer Studio.
2. In the Project Workspace window, click the ResourceView button.
Once the 2D Chart control has been added to the project and placed in the dialog box
container, you can access this control from other parts of your project. The easiest way to
do this is to create a member variable of the dialog class, CContainerDlg, of type
CChart2D (the 2D Chart wrapper class). To create a member variable, perform the
following steps:
The member variable you have just added can now be used to access the embedded 2D
Chart control.
At this point, you are ready to actually program the control. To do this, note the following:
n A wrapper class header file is defined for each 2D Chart object. Examples: the
wrapper class header file for the Chart2D object is named chart2d.cpp, and the
wrapper class header file for the Border object is named border.cpp.
n The wrapper class header file for an object defines two routines for each of its
properties: a routine that gets the current value of the property, and a routine that sets
the value of the property. For example, the chart2d.cpp file defines two routines for
the IsDoubleBuffered property of the Chart2D object: GetIsDoubleBuffered(),
which gets the current value of the IsDoubleBuffered property, and
SetIsDoubleBuffered(), which sets the value of the IsDoubleBuffered property.
n Methods defined for an object are included in the wrapper class header file for the
object.
Olectra Chart OCX
The following statement sets the background color of the chart area. The variable m_chart
contains an instance of a Chart2D object (the main 2D Chart object).
m_chart.GetChartArea().GetInterior().SetBackgroundColor
(RGB(247,206,151));
This statement navigates the 2D Chart object hierarchy by retrieving the values of
successive properties. First, the value of the ChartArea property is retrieved, which is a
ChartArea object. Then, this ChartArea object’s Interior property is retrieved, which is
an Interior object. Finally, the Interior object’s BackgroundColor property is set.
Using Collections
Many 2D Chart objects are organized into collections. For example, the chart axes are
organized into the Axes collection.
Calling Methods
To call a 2D Chart method, access the object with which it is associated. For example, the
following statement uses the DataCoordToCoord method, defined by the ChartGroups
collection, to convert the chart coordinates (5.1, 10.2) to their equivalent pixel
coordinates:
long pixelx, pixely;
m_chart.GetChartGroups().GetItem(COleVariant(short(1)))
.DataCoordToCoord(5.1, 10.2, &pixelx, &pixely);
Each method is described in the help page for its associated object. For example,
DataCoordToCoord is described in the ChartGroups collection help page.
Demo Programs
Sample C++ programs, created using Visual C++, are included as part of the Olectra Chart
distribution. These sample programs are contained in the \CHART\2D\DEMOS\VC
directory.
// Set up the Chart with the correct number of series and points.
Chart2D1.ChartGroups.Item(1).Data.NumSeries := 16;
Chart2D1.ChartGroups.Item(1).Data.NumPoints(1) := 10000;
Due to the changes made when Borland introduced Delphi 3 and Delphi 4, there are a
number of coding changes that are required to use Olectra Chart. Below is the current list
of known changes that may be required:
1. The name of the file inserted into the code by the IDE on the uses line has changed
from OLCH2X32 to OlectraChart2D_TLB.
2. In order to use the Safe Array functions, you now have to declare the arrays for use
with these functions as type OleVariant instead of Variant.
3. Code located in the OnCreate() event that used to work fine in Delphi 2.01 will not
work in later versions. There are two work-arounds for this (Borland is currently
working on a Patch that should hopefully cure this problem):
Solution A:
Solution B:
Move the code to the OnActivate() event and use a flag to ensure that this code only
runs once.
4. Due to the stronger typing introduced in Delphi 3 and Delphi 4, there are five methods
in Olectra Chart that have been renamed automatically by Delphi. The following is the
Conversion Log appearing at the top of a Delphi 3 PASCAL file created during the
OCX import process:
Note that although these changes still occur in Delphi 4, a Conversion Log is not
generated.
5. In order to access the font object associated with various objects in Olectra Chart, you
now have to access them using a Variant. Here is an example:
var
f: Variant;
begin
f := Chart2D1.Header.Font;
f.Name := ’Times New Roman’;
f.Size := 15;
f.Bold := True;
f := UnAssigned;
end;
6. Accessing properties that are of the following types involves an extra reference in
Delphi 3 that was not required in Delphi 2.01.
n The additional reference is the explicit use of ’Value’. Here is a list of the objects
DerivedDouble:
Chart2D1.ChartArea.Axes[’X’].Max.Value := 50;
DerivedLong:
Chart2D1.Header.Location.Top.Value := 5;
DerivedString:
Chart2D1.ChartArea.Axes[’X’].TimeScale.Format.Value =
’dd/mm/yy’;
n Additionally, the Text object requires an extra reference as well. The additional
reference is the explicit use of ’Text’. Here are a couple examples:
Chart2D1.ChartLabels.Item[LabelName].Text.Text := ’’;
Chart2D1.Header.Text.Text := ’Rain Fall Data’;
Note
n In the above examples, it also shows that the .Item[] reference also requires the use of
square brackets now, where in Delphi 2.01 it also allowed the use of round brackets ().
In the Windows 95/98 environments, lines are drawn using the dash styles predefined by
Microsoft Windows. As a consequence, some 2D Chart dash styles are not displayed
exactly as specified. The following dash styles are affected:
n The short dash pattern (oc2dLineShortDash) is represented as a dash-dot pattern.
n The long-short-long dash pattern (oc2dLineLongShortLongDash) is represented as a
dash-dot-dot pattern.
In the Windows 95/98 environment, any non solid lines of thickness greater than 1 are
rendered as lines with thickness 1.
3.8 Upgrading Visual Basic 4.0 Projects from Olectra Chart 1.1
Olectra Chart OCX
For most development environments, upgrading your chart from version 1.1 of the OCX
to version 6.0 is as easy as loading the .OC2 file into your environment with Olectra Chart
6.0 installed. Saving the file will automatically update your project.
Projects created with Visual Basic 4.0 record the version of the OCX inside the .VBP file.
After you upgrade to Olectra Chart 6.0, your projects containing Olectra Chart 1.1 will not
load correctly. The log file will contain this message:
Class OlectraChart2D.Chart2D of control Chart was not a loaded control
class.
The following topics cover distributing applications created with the 32-bit
Olectra Chart control.
57
4.1 Distributing 32-bit OCX Applications
You can freely distribute any applications that you create with Olectra Chart. An Olectra
Chart application needs its dynamic link libraries present on the system it is run on.
Distributable Files
When distributing 2D 32-bit OCX applications, you may only distribute the following file:
OLCH2X32.OCX
The following MFC and OLE support files must also be installed on the end-user’s system
for Olectra Chart OCX applications to work:
MFC42.DLL
MSVCRT.DLL
OLEPRO32.DLL
OLEAUT32.DLL
If OLEPRO32.DLL has not previously been installed, it must be registered before it can
be used. To register this DLL, follow the same steps used to register the Olectra Chart
Control. If this DLL is installed already, you can assume that it has been registered.
In order to distribute Olectra Chart using VB 6, you must run the Package & Deployment
wizard (located in your VB directory\Wizards\PDWizard ) once to create a file vb6dep.ini.
For VB5, you must run the Setup wizard (located in your VB directory\Setupkit\kitfile32)
once to create a file vb5dep.ini. The following dependences must be added to this file so
you can distribute an application created with Olectra Chart:
[OLCH2X32.OCX]
Register=$(DLLSelfRegister)
Dest=$(WinSysPath)
Uses1=MFC42.DLL
Uses2=MSVCRT.DLL
[OLCH3X32.OCX]
Register=$(DLLSelfRegister)
Olectra Chart OCX
Dest=$(WinSysPath)
Uses1=MFC42.DLL
Uses2=MSVCRT.DLL
[MFC42.DLL]
Register=$(DLLSelfRegister)
Dest=$(WinSysPath)
[MSVCRT.DLL]
Dest=$(WinSysPath)
Note that the above file contains the dependencies for both the 2D and 3D Olectra Chart
controls.
Once you have added the above dependencies, run the Setup wizard and follow the
directions on each screen. On the Confirm Dependency screen, make sure you include the
OCX files.
In VB 5, on the File Summary screen, make sure the following files have been included:
OLCH2X32.OCX
OLCH3X32.OCX
MSVCRT.DLL
MFC42.DLL
If your applications allow the end-user to access the 2D Chart Property Editor, you should
also distribute the Property Editor’s end-user online help, contained in the following files:
OLCH2D-U.HLP
OLCH2D-U.CNT
If you have disabled end-user property editing, you do not need to distribute these files.
Before the 2D Chart control can be used in an application, appropriate entries must be
added to the Microsoft Windows registration database.
To register the control for 32-bit applications, pass the complete path and filename of the
Olectra Chart OCX file, OLCH2X32.OCX, to the REGSVR32.EXE control registration
program.
Building a chart is quite easy. The chart can automatically set properties based on the data,
so axis numbering and data display usually don’t need much customization.
The following topics cover information on the various steps required to create a chart.
61
5.1 Axis Annotation Overview
The annotation along each axis is an extremely important part of any chart. The 2D chart
can annotate any axis with numbers based on the data (Values) or with text you supply
that is displayed at axis coordinates (ValueLabels). The X-axis can also be annotated with
text for each point in the data (PointLabels) or with automatically-generated time values
(TimeLabels).
Whatever annotation method you choose for each axis, the chart goes to considerable
effort to automatically produce the most natural annotation possible, even as chart data
changes. You can change annotation properties to finetune this process.
Values Annotation
Perhaps the most common type of annotation, Values automatically generates numeric
annotation based on the data itself. Values annotation can be used for any axis, with any
chart type, and with any data layout.
See Annotating with Values on page 63 for details on using Values annotation.
ValueLabels Annotation
A very flexible type of annotation, ValueLabels displays text you define at a specific axis
coordinate. This is useful to label only specific coordinates, or to produce annotation in a
form that the chart does not provide. ValueLabels annotation can be used for any axis,
with any chart type, and with any data layout, with the following exceptions:
n When used for the X-axis, the chart type cannot be either Pie, Radar or Filled Radar
n When used for the Y-axis, the chart type cannot be Pie
PointLabels displays text you define at each point along the X-axis. PointLabels
annotation can be used with the X-axis of any chart type.
Olectra Chart OCX
TimeLabels automatically generates X-axis annotation along a time scale, based on the
data and using the starting point and format you specify. This is useful for charts that
measure something in seconds, minutes, hours, days, weeks, months, or years.
TimeLabels annotation can be used for the X-axis with any data layout, with the
following exception:
n The chart type for TimeLabels cannot be either Pie, Radar, Filled Radar or Polar
Numbering Method
Use the NumMethod axis property to select the method used to number an axis. “Round”
rounds the numbering determined by the precision, numbering and ticking increments and
usually provides the most pleasing display. “Precision” determines numbering by the
precision, numbering and ticking increments and produces coarser and more irregular
numbering. NumMethod is located on the Axes tab’s Annotation inner tab on the
Property Editor.
Numbering Precision
Use the Precision axis property to set the number of decimal places to use when
displaying each number. Its IsDefault property allows the chart to automatically
determine precision based on the data. The effect of Precision depends whether it is
positive or negative:
Precision properties are located on their own dialog on the Axes tab’s Annotation inner
tab on the Property Editor. Set AnnotationMethod to Values for an axis and click the
button beside that property to display the dialog.
Use the NumSpacing axis property to set the increment between labels along an axis. Its
IsDefault property allows the chart to automatically determine the increment.
Use the TickSpacing axis property to set the increment between ticks along an axis. This
should generally divide equally into NumSpacing on axes using Values annotation. The
TickSpacing IsDefault property allows the chart to automatically determine the
increment.
These properties are located on their own dialog on the Axes tab’s Annotation inner tab
on the Property Editor.
Use the ValueFormat Object's Category property to specify which format method you
want to use. Each of the value formats have properties that can be modified from the
Values Format dialog. To view the Values Format dialog:
Olectra Chart OCX
1. From the Annotation subtab of the Axes tab, select Values from the Annotation
Method field.
2. Click the Annotation Method button. The Select Annotation Values dialog appears.
3. Click the Format button. The Value Format dialog appears.
4. In the Category list, select the type of formatting you want to apply to the axes values.
The dialog will change to display the properties for that value format.
5. Edit the appropriate formatting options, as required.
#0? Creates a placeholder for a number. Use with . (period) code to specify the
number of digits to display. # does not display extra zeros. 0 displays extra
zeros when there are fewer digits than in the format. ? works like 0 and adds
space for insignificant zeros to align decimal points and fractions.
For example, “#.0#” formats 16 as 16.0, and 98.666 as 98.67.
. (period) Positions the decimal point, used with #, 0, and ? to specify the number of digits
and rounding.
For example, “###.0000” formats 123.45 as 123.4500.
, (comma) When between digits, acts as a thousands separator. When at the end of a value,
divides value by a thousand.
For example, “#,###” formats 21000 as 21,000. “0.0,” formats 12000 as 1.2.
E+ e+ E- e- Converts value to scientific notation, placing “E” or “e” in front of the exponent.
E+ and e+ displays “+” before positive exponents and “-” before negative
exponents. E- and e- only displays “-” before negative exponents. For example,
“0.0E+00” formats 18987 as 1.8E+04.
*<character> Pads the annotation space with <character>.
For example, “$* ##.##” displays as much space as possible between the $ and
value.
[height <n>] Sets the font size of the value or formats that follow. <n> represents the number
of logical units.
For example, “0[height 50%].00[height 100%]” formats 75.5 as (75. 50 ).
[align <value>] Sets the vertical position of the value or formats that follow. Only effective when
used with the [height] code. <value> is either top, bottom, center, baseline, or
top(x). When top(x), the character specified by x is aligned at the top.
For example, “0.0[height 75%][align top(0)]E+00” formats 100 as 1.0 E+02.
[hide] [show] [hide] hides the value or formats that follow. [show] turns off format/value
hiding.
For example, “0.0[hide]E[show]+00” formats 70 as 7.0+01.
Several format codes enable you to define formatting for a range of numbers, in finer
details than the built-in positive, negative and zero groups. The codes that define
conditional formatting are [>value], [<value], [=value], [<>value], [>=value], and
[<=value]. Use these codes to define new groups whose format codes are applied only
when the condition is true. Each group is separated by a semicolon (;). The following
example defines special formatting for values greater than 1000:
###.##;-###.##;#.#;[>1000]0.0E+00
Accounting Format
Use the Accounting Object to determine how this ValueFormat appears. The Accounting
format puts a dollar sign in front of the value, pads the value with zeros (2 is the default)
for the cents, and pads the value with spaces so that the dollar signs and decimals are
aligned. The default format code is:
_-$* #,##0.00;-$* #,##0.00
n The underscore adds a space the size of a dash (-) to the beginning of the annotation,
and the asterisk (*) adds space between the dollar sign and the value to make sure the
dollar signs align correctly.
n Use the OrderCurrencySignValue property to change the order of the negative sign,
dollar sign, and value.
n Use the NegativeValueColor property to specify the color used to display negative
values.
Currency Format
Use the Currency Object to determine how this ValueFormat appears. The Currency
format puts a dollar sign in front of the value, pads the value with zeros (2 is the default)
Olectra Chart OCX
Fraction Format
Use the Fraction Object to determine how this ValueFormat appears. The Fraction format
converts all decimal values to fractions, up to the number of digits specified or with a
fixed denominator. The default format code is:
0 ?/?
Percentage Format
Use the Percentage Object to determine how this ValueFormat appears. The Percentage
format multiplies all values by 100 and displays a percent sign. The default format code is:
0.00%;-0.00%
n Use the DecimalPlaces property to set the maximum number of decimal places to
display.
n Use the OrderPercentSignValue to specify the order of the percent sign, negative
sign and value.
Number Format
Use the Number Object to determine how this ValueFormat appears. The default format
code is:
0.00
n Use the OrderSignValue property to change the order of the negative sign and value.
n Use the NegativeValueColor property to specify the color used to display negative
values.
Use the Scientific Object to determine how this ValueFormat appears. The Scientific
format converts values to scientific notation and places an E in front of the exponent. The
default format code is:
n Use the DecimalPlaces property to set the maximum number of decimal places to
display.
n Use the UseSmallExponent property to display the exponent as a superscript without
the E/e.
n Multipliers, commas and percent signs are ignored with Scientific notation.
Notes
n With scientific notation, using an E- or e- converts values to scientific notation and
places a minus sign in front of negative exponents. Using E+ or e+ converts values to
scientific notation, places a minus sign in front of negative exponents, and a plus sign
in front of positive exponents.
Every label displayed on the axis is one ValueLabel. Each ValueLabel has a Value
property and a Label property.
Use the Value property to set the axis coordinate to display the label. Use the Label
property to specify the text to display. All ValueLabels properties are located on their own
dialog on the Axes tab’s Annotation inner tab on the Property Editor. Set
AnnotationMethod to ValueLabels for an axis and click the button beside that property
to display the dialog.
PointLabels are a collection of labels. The first label applies to the first point, the second
label applies to the second point, and so on.
Use the PointLabels ChartGroup properties to define and edit PointLabels. These are
located on the ChartGroup tab’s Labels inner tab on the Property Editor. Remember to set
the X-axis AnnotationMethod to PointLabels.
Four properties are used to control the display and behavior of TimeLabels:
1. Unit
2. Base
3. Format
4. AnnotationMethod
Time Unit
Use the Unit property to specify how to interpret the X-values in the data. You can select
either Seconds, Minutes, Hours, Weeks, Months, or Years. For example, when set to
Years, X-values that range from 5 to 15 become a time-axis spanning 10 years.
Time Base
Olectra Chart OCX
Use the Base property to set the starting point that the time-axis is measured from. You
can specify the base in a common “mm/dd/yy hh:mm:ss” format, between January 1, 1970
and January 19, 2038. For example, to specify 3:00 pm on June 15, 1996, set the Base
property to “06/15/96 15:00”.
Time Format
Use the Format property to specify what text to display at each annotation point. Its
IsDefault property allows the chart to automatically determine an appropriate format
based on the Unit property and the data, so you often do not need to customize the format.
%A Weekday name
%B Month name
%H Hour (0 to 23)
%I Hour (0 to 12)
%p AM or PM
All TimeLabels properties are located on their own dialog on the Axes tab’s Annotation
inner tab on the Property Editor. Set AnnotationMethod to TimeLabels for the X-axis and
click the button beside that property to display the dialog.
the values to appear on a Time-axis, access the TimeScale property, which is a TimeScale
object, and set its properties as follows:
n Set the Base property to the starting date and/or time.
n Set the Unit property to the time unit to be used. This property must be set to a time
unit constant.
n Set the Format property to the format string to use when generating the time labels.
See Annotating With TimeLabels for details on the contents of this format string.
For example, the following statement sets the starting point to January 15, 1985:
Chart2D1.ChartArea.Axes("X").TimeScale.Base = #1/15/85#
And the following sets the starting point to the current time in Visual Basic:
Chart2D1.ChartArea.Axes("X").TimeScale.Base = Now
Date Methods
The DateToValue method converts an OLE Date value into a Time-axis position (a
floating-point value). To convert a Time-axis position to a Date, use the ValueToDate
method.
To convert a Date to a formatted text string, use the FormatDate method. For information
on date format strings, see Annotating with TimeLabels.
AnnotationPlacement is located on the Axes tab’s Annotation inner tab on the Property
Editor.
Note
Olectra Chart OCX
AnnotationPlacement for the Y-axis is ignored for the Y-axis when the Y2-axis is
displayed.
Chart Orientation
Use the ChartArea IsHorizontal property to change the chart orientation. When set to
Horizontal, the X-axis is drawn vertically and the Y-axes are drawn horizontally. Any
properties set on the X-axis apply to the vertical axis, and Y-axis properties apply to the
Note that IsHorizontal has no effect on polar, radar or filled radar charts.
Axis Direction
Use the Axis IsReversed property to reverse the direction of an axis. For polar, radar and
filled radar charts, reversing the X-axis changes the direction of rotation. IsReversed is
located on the Axes tab’s General inner tab on the Property Editor.
Normal X- and
Y-axes
Fixing axis bounds generally gives better results than fixing data bounds. The chart
determines the extent of each axis by considering the lowest and highest data value, the
origin, and the numbering increment.
Use the Axes Min and Max properties to frame a chart at specific axis values. Their
IsDefault properties allow the chart to automatically determine axis bounds based on the
data bounds. These properties are located on the Axes tab’s Scale inner tab on the Property
Editor.
Note that you cannot set the X axis for Polar charts.
Olectra Chart OCX
Use the Axes DataMin and DataMax properties to frame a chart at specific data values.
Their IsDefault properties set the chart to use the minimum and maximum values in the
data. These properties are located on the Axes tab’s Scale inner tab on the Property Editor.
Note that you cannot set the Axes DataMin and DataMax properties for Polar, Radar and
Filled Radar charts.
Use the axis Title property to add a title to an axis. To remove the title, delete the text.
Title is located on the Axes tab’s Title inner tab on the Property Editor.
Note that you cannot add an axis title to either polar, radar or filled radar charts.
Use the axis TitleRotation property to rotate the axis title to either 90 or 270 degrees
TitleRotation is located on the Axes tab’s Title inner tab on the Property Editor.
The axis font must be scalable to rotate the annotation or title. TrueType fonts such as
Arial or Courier New are scalable. Bitmap fonts such as System, Small Fonts, or MS Sans
Serif are not scalable, and cannot be used if you want to rotate annotation or title.
Because of the nature of logarithmic axes, they impose the following restrictions on the
chart:
n Any data that is less than or equal to zero is not graphed (it is treated as a data hole),
since a logarithmic axis only handles data values that are greater than zero. For the
same reason, axis and data minimum/maximum bounds and origin properties cannot
be set to zero or less.
Olectra Chart OCX
n Axis numbering increment, ticking increment, and precision properties have no effect
when the axis is logarithmic.
n For a logarithmic X-axis, the chart type must be either plot, bubble, area, HiLo,
HiLoOpenClose or candle. For the Y-axis, the chart type must be either plot, bubble,
area, polar, HiLo, HiLoOpenClose, candle, radar or filled radar.
n The annotation method for the X-axis cannot be TimeLabels.
Notes
n Pie charts are not affected by logarithmic axes.
The other way to create a Y2-axis is to create a combination chart. See Combination
Charts using ChartGroups for a complete discussion.
Use the Multiplier Y2-axis property to define the multiplication factor for the Y2-axis.
This property generates Y2-axis values from the Y-axis annotation. The multiplication
Use the Constant Y2-axis property to define a value to be added to or subtracted from the
Y2-axis values generated by Multiplier. Constant is located on the Axes tab’s
Annotation inner tab on the Property Editor.
Hiding Y2-axis
Use the IsShowing axis property to remove the Y2-axis from the display. IsShowing is
located on the Axes tab’s General inner tab on the Property Editor.
You can customize most axis properties for the Y2-axis, including AnnotationMethod,
Min, Max, IsLogarithmic, NumMethod, NumSpacing, and Title.
Tick Length
Use the AxisStyle TickLength property to change the length of the ticks on the axis. The
IsStyleDefault property allows the chart to set the tick length automatically. These
properties are located on the Axes tab’s Axis/GridLines inner tab on the Property Editor.
’ Set tick length on X axis to 5
Chart2D1.ChartArea.Axes("X").AxisStyle.TickLength = 5
Axis Appearance
The AxisStyle object has a LineStyle sub-object that controls the line pattern, thickness,
and color properties of the axis lines and ticks. These are located on the Axes tab’s
AxisStyle tab on the Property Editor, and available via the LineStyle Object .
’ Set tick and axis width on X axis to 2
Chart2D1.ChartArea.Axes("X").AxisStyle.LineStyle.Width = 2
Olectra Chart OCX
Origin Placement
The easiest way to customize an origin is by controlling its placement, using the Axes
OriginPlacement property. When set to Auto, the origin is placed at the axis minimum or
at zero, if the data contains positive and negative values or is a bar chart. You can also
explicitly place an origin at zero, the axis minimum, or the axis maximum.
OriginPlacement is located on the Axes tab’s Annotation inner tab on the Property
Editor.
Origin Coordinates
Note
n When you explicitly set or fix an origin coordinate, the chart ignores the
OriginPlacement property.
n The Y-axis origin cannot be by the user for polar and radar chart types. For these chart
types the origin is automatically set to equal the DataMax property.
Horizontal gridlines are a property of the Y-axis. Vertical gridlines are a property of the X-
axis. You cannot set grid properties on the Y2-axis. For polar and radar charts, circular
gridlines are a property of the Y-axis. Radial gridlines are a property of the X-axis. The
following charts show the difference between radial and circular gridlines:
Olectra Chart OCX
Grid Spacing
Use the gridlines Spacing property to customize the grid spacing for an axis. Its IsDefault
property allows the chart to space the grid automatically, drawing a gridline wherever
Grid Appearance
Use the grid Style properties to customize the line pattern, thickness, and color of the
gridlines. These are located on the Axes tab’s GridStyle tab on the Property Editor. Use
the IsStyleDefault grid property to allow the chart to determine the grid style. The
IsStyleDefault property is located on the Axes tab’s Axis/GridLines inner tab on the
Property Editor.
Radar and filled radar charts use the X-axis gridlines to display radar lines. The radar lines
will not be displayed unless the X-axis gridline spacing is set to IsDefault.
Note
To remain backwards compatible with previous versions of Olectra Chart, Stacking Bar
charts are implemented as a separate chart type from Bar Charts.
This property is located on the Axes tab’s General subtab on the Property Editor.
Note
The implementation of 100 Percent Stacking for Stacking Bar charts is the same.
Hidden and excluded series do not appear in stacking charts, with the exception of
Stacking Bar Charts, in which hidden series create a floating bar chart .
Each group of data is part of a ChartGroup. A ChartGroup also has a set of ChartStyles,
SeriesLabels, PointLabels, and properties that define the chart type and drawing order.
Use the first ChartGroup when creating a chart having just one group of data. Use the
second ChartGroup when adding a second data group to the chart. The second ChartGroup
only works when data exists in the first.
Special Rules
When displaying a combination chart, the chart has the following limitations:
n Pie, radar, filled radar and polar charts cannot be used in combination charts.
n When annotating the X-axis using PointLabels, only the first ChartGroup’s
PointLabels are used.
Use the Load button on the ChartGroups tab’s Data inner tab on the Property Editor, to
load data into the second ChartGroup. See Understanding Data Layout for information on
data layouts.
Use the ChartType ChartGroups property to set the chart type for the second ChartGroup.
ChartType is located on the ChartGroups tab’s General inner tab on the Property
Editor. See Choosing the Chart Type for information on chart types.
Use the DrawingOrder ChartGroups property to set which ChartGroup to draw first.
When set to 1, that ChartGroup is drawn first and appears behind the other.
DrawingOrder is located on the ChartGroups tab’s General inner tab on the Property
Editor.
Legend
The legend in a combination chart combines the SeriesLabels for the first and second
ChartGroups. Use the SeriesLabels property to add, remove, or change SeriesLabels.
SeriesLabels is located on the ChartGroup tab’s Labels inner tab on the Property Editor.
See Using a Legend for information on legends.
Use the FillStyle, LineStyle, and SymbolStyle ChartStyle properties to set or change
ChartStyles for the second ChartGroup. ChartStyles properties are located on the
ChartStyles tab on the Property Editor. See Changing ChartStyles for information on
ChartStyles.
CoordToDataCoord returns, as its return value, the region of the chart in which the pixel
coordinates are located. This region is represented as a region constant.
To determine the pixel coordinates of a given data point, call DataIndexToCoord. For
example, the following code obtains the pixel coordinates of the third point in the first data
series:
Dim PixelX As Long
Dim PixelY As Long
...
With Chart2D1.ChartGroups(1)
.DataIndexToCoord 1, 3, PixelX, PixelY
End With
’ PixelX and PixelY now contain the pixel coordinate value
To determine the closest data point to a set of pixel coordinates, call CoordToDataIndex:
Dim Series As Long
Dim Point As Long
Dim Distance As Long
Dim Region As Integer
...
With Chart2D1.ChartGroups(1)
Region =.CoordToDataIndex (225, 92, oc2dFocusXY, Series, _
Point, Distance)
The third argument passed to CoordToDataIndex specifies how the nearest series and
point value are determined. This argument must be a focus constant.
CoordToDataIndex returns the series and point value corresponding to the closest data
point, and also returns the distance in pixels between the pixel coordinates and the point.
CoordToDataIndex returns, as its return value, the region of the chart in which the pixel
coordinates are located. This region is represented as a region constant. When the returned
region is oc2dRegionInLegend, the returned point value is also set to
oc2dRegionInLegend, and the returned series is the closest element in the legend.
In Visual Basic, coordinate values are measured in twips (1,440 twips equals one inch).
The following code converts the height and width of a chart from twips to pixels:
pixwidth = Chart2D1.Width / Screen.TwipsPerPixelX
pixheight = Chart2D1.Height / Screen.TwipsPerPixelY
To load a previously saved chart description from a file, call the Load method:
Chart2D1.Load "C:\OLECTRA\CHART1.OC2"
Both methods return True if the file operation was successful and False if an error
occurred.
Chart data is normally stored with the other chart properties. If you don’t want the data
saved, set the IsSaved property in the Chart2DData object to False. If you want the chart
data saved to a file, set the FileName property to the name of the file. Saved data can be
loaded from this file using the Load method.
If the IsSaved property is set to True, data is saved with the chart, and the value of the
FileName property is ignored.
Output/Printing Methods
The methods listed below allow you to output the chart. See the Chart2D Object for more
information.
Each of these methods enables you to produce a copy of the chart in bitmap format,
Metafile format, or enhanced Metafile format.
Printing Charts
To print a chart using the standard Windows Print dialog, use the PrintChart method.
This method allows you to specify the image format and the size and position of the chart.
The following code example illustrates how to print a chart:
’ Prints the chart as a Windows bitmap and scaled to fit the entire page
Chart2D1.PrintChart oc2dFormatBitmap, oc2dScaleToMax, 0, 0, 0, 0
The following topics explain how to plot, setup and configure your data for use with
Olectra Chart.
91
6.1 Data Overview
The 2D Chart control enables you to add or modify data at runtime.
Data Organization
Data in a chart is organized into chart groups. Each chart contains two chart groups
(although most charts will only use the first ChartGroup), each of which is treated as a
separate entity. In 2D Chart, a chart group is represented by a ChartGroup object.
Within a chart group, data is represented by the Data property, which is a Chart2DData
object. The Chart2DData object defines the following properties which control the data
to be displayed in the chart:
n The NumSeries property defines the number of data series in the chart group.
n The NumPoints property defines the number of data points in a series. This property
is indexed by series. For example, the statement:
NumPoints = Chart2D1.ChartGroups(1).Data.NumPoints(1)
assigns the number of data points in the first series to the NumPoints variable.
n The Layout property specifies the data layout. Its value must be a data layout constant
specifying either array or general data. If array data is specified, each series is
assumed to have the same number of data points.
n The X and Y properties specify the X- and Y-coordinates of a particular data point.
These properties are indexed by series and point. For example, the statement:
Xval = Chart2D1.ChartGroups(1).Data.X(1,3)
assigns the X-coordinate of the third point in the first data series to Xval.
When IsBatched is set to True, the chart data is not updated when a Chart2DData object
property is changed. Updating does not take place until IsBatched is reset to False.
To change a data value displayed in the chart, all you need to do is set its X and Y
properties. For example, the following statements change the fourth data point in the
second series to (10.5, 7.7):
With Chart2D1.ChartGroups(1).Data
.X(2, 4) = 10.5
.Y(2, 4) = 7.7
End With
For example, the following code adds a fifth and sixth point to the first data series:
If the data is in array format, the new points are added to all of the series.
The following code adds a second data series containing two points:
With Chart2D1.ChartGroups(1).Data
.IsBatched = True
.NumSeries = 2
.NumPoints(2) = 2
.X(2, 1) = 1.0
.Y(2, 1) = 3.14159
.X(2, 2) = 2.0
.Y(2, 2) = 6.02
.IsBatched = False
End With
When a new series is created, a new ChartStyle object is automatically created for it. This
chart style controls how the new data points are to be displayed. By changing the
properties of this ChartStyle object, you can control the appearance of the new data.
If the Y property for a data point is set to a special value known as the hole value, 2D
Chart treats the data point as a missing value, and does not display it on the chart. This
Olectra Chart OCX
For example, the following code treats the third point in the first data series as a missing
value:
With Chart2D1.ChartGroups(1).Data
.HoleValue = 999.1
.Y(1, 3) = 999.1
End With
Fast Update
If the data points being changed fall within the current axis bounds, the 2D Chart control
enables you to use the Fast Update methods to update the graph efficiently.
In order for Olectra Chart to allocate and load the data from a file, it must be in one of two
basic layouts, Array or General. The following examples show the contents of the
MM63.DAT file, in both Array and General formats. The first line of the file tells the
control that the data which follows is in either Array or General format, and is made up of
2 sets of 4 points.
Line 4 of the MM63.DAT file defines the X-value (i.e. points) shared by both of the sets
(Y-values). Lines 6 and 8 in MMF95.DAT define each of the sets of Y-values. Lines
beginning with "#" are comment lines.
Lines 4 and 8 tell the control how many points are in each series. Lines 5 and 9 represent
See Understanding Data Layout on page 29 for more information on Array and General
data layout.
To allocate and load the data from a file, you can either use the Property Editor’s Load
button, which is located on the Data subtab of the ChartGroup tab, or do it
programmatically. Loading the MMF95.DAT file into your chart can be done as follows:
’ Load the data from a file MMF95.DAT
Chart2d.ChartGroups(1).Data.Load "MMF95.DAT"
Instead of using the Load method to specify the location of a data file, you can specify a
URL where the chart can find the data. Olectra Chart provides two different methods to
load data from the Internet:
n Use the Chart2D Object’s LoadURL method to load a chart description file (.OC2).
n Use the Chart2DData Object’s LoadURL method to load a data file (.DAT) into an
existing chart.
In addition, if you want to set a URL location but do not want to load the data, use the
Chart2DData Object’s Datapath property. This property can be set at design time, and
used to initialize the chart data at run-time.
The following example creates a 2-dimensional array, populates the array with data, and
then charts the data:
Sub Main
’ Declare the arrays needed to do the calculations
Dim Rates(1 To 2) As Double
Dim Values(1 To 2, 1 To 12) As Double
’ Set the number of series and points in the chart
Chart2D1.ChartGroups(1).Data.NumSeries = 2
Chart2D1.ChartGroups(1).Data.NumPoints(1) = 12
Chart2D1.ChartGroups(1).Data.NumPoints(2) = 12
’ Set the initial values for the first and second series
Values(1, 1) = 200
Values(2, 1) = 200
Use the ChartGroup Object’s AreSeriesLabelsBound property to use the database column
headings as SeriesLabels.
With these chart types, multiple series are combined to create a single logical data set.
Excluding one series will exclude the entire logical data set. Any excluded logical data set
will not be used in calculating data bounds.
With these chart types, hiding either of the first two series (the Hi and Low values) will
hide the entire logical data set. With HiLoOpenClose charts, hiding either the third or
fourth series (the Open and Close values) will hide only that series; with Candle charts,
hiding either the third or fourth series will hide both the Open and Close series (the candle
portion of the chart).
With these chart types, hiding either of the series will hide the entire logical data set.
The following Fast Update methods are defined by the Chart2DData object:
DrawNewPoints(series, npoints)
n Draws the new points as quickly as possible. Series specifies the data series to be
added to if the data is in general format; if the data is in array format, all data series are
added to, and the value of series is ignored. npoints is the number of points to be
added; the index of the first point to be added is assumed to be one greater than the
value of the LastPoint property.
n DrawNewPoints returns True if fast update was possible (if the data falls within
existing axes bounds, as verified by CheckNewPoints). When DrawNewPoints
returns, the LastPoint property is incremented by npoints.
Examples
Here is a simple example of code that uses the Fast Update methods:
With Chart2D1.ChartGroups(1).Data
’ .LastPoint is assumed to have the value 9
.x(1, 10) = 15.4
.y(1, 10) = 23.1
.x(1, 11) = 7.2
.y(1, 11) = 20.8
.DrawNewPoints 1, 2
End With
For a more practical example of code that uses the Fast Update methods, refer to the
Timer1 procedure defined in the stripper demo program.
directly (as in Microsoft Visual Basic), or using a special mechanism (such as Delphi’s
Variant arrays). For more information, refer to your development environment
documentation.
The following copying data methods are defined by the Chart2DData object:
CopyXVectorIn(value,array), CopyXVectorOut(value,array)
n Copies the X values for a specified series of data either from an array into a chart
(CopyXVectorIn), or from a chart into an array (CopyXVectorOut). value is the
series number for the data that is to be copied. array is either the name of the array
where the X values are stored (CopyXVectorIn), or the name of the array where the X
values are copied (CopyXVectorOut). Note that to use CopyXVectorIn and
CopyXVectorOut, the array must be a one-dimensional array of singles, doubles,
longs, integers, or dates.
CopyYVectorIn(value,array), CopyYVectorOut(value,array)
n Copies the Y values for a specified series of data either from an array into a chart
(CopyYVectorIn), or from a chart into an array (CopyYVectorOut). value is the
series number for the data that is to be copied. array is the name of the array where the
Y values are stored (CopyYVectorIn) where the Y values are copied
(CopyYVectorOut). Note that to use CopyYVectorIn and CopyYVectorOut, the
array must be a one-dimensional array of singles, doubles, longs or integers.
n CopyYVectorIn and CopyYVectorOut return True when the copy is successful,
False otherwise.
CopyYArrayIn(array), CopyYArrayOut(array)
n Copies an array of Y data to multiple series (CopyYArrayIn) or from multiple series
into an array (CopyYArrayOut). array is a two-dimensional array of singles,
doubles, longs or integers. where the data is located or is to be copied. The common X
values are usually set with CopyXVectorIn, and the Y values for all series can be set
with CopyYArrayIn. Note that to use this method the size of the array passed must
match the number of series and points declared by NumSeries and NumPoints.
Arrays must be declared with the number of points as its first element, and the number
of series as its second element. Note that to use CopyYArrayIn or CopyYArrayOut,
your data must be in Array format. Otherwise, use CopyYVectorIn.
Example
Adding a lot of points (in the following example, four series of 10,000 points each) can be
quite slow. The chart must add each point to the chart as it is generated. to copy data arrays
directly to and from the chart, making it easy to quickly create chart data.
’ Declare a variable
Dim Yarray(1 To 10000, 1 To 4) As Double
For convenience, the IsBatched property is also defined for the Chart2DData object and
the ChartLabel object. In these cases, IsBatched batches the modifications to that object.
These IsBatched properties are independent of Chart2D.IsBatched.
It is recommended that you batch around the creation or updating of multiple chart labels.
When double buffering is turned on, every time the chart changes, it will:
n Allocate (if necessary) and clear an off-screen bitmap.
n Render the complete graph to the off-screen bitmap.
When double buffering is turned off, the chart clears the screen image every time a chart is
changed (possibly causing a visual flash). Then, it renders the complete image to the
visible window (possibly allowing the user to see the chart being drawn piece by piece).
Turning off double buffering can improve the chart’s graphing performance and reduce its
memory requirements.
When the chart data and axes are formatted properly, you can customize its elements to
make it clearer and professional-looking. The following topics cover tasks that customize
the appearance of a chart.
105
7.1 Adding Header and Footer Titles
A chart can have two titles, called the header and footer. A title consists of one or more
lines of text with an optional border, both of which you can customize. You can also set
the text alignment, positioning, colors, and font used for the header or footer.
Use the Text title property to add, change, or remove text for a title. Text is located on the
Titles tab’s Label inner tab on the Property Editor. To enter multiple lines of text, press
Enter between each line.
Use the Adjust title property to specify whether to center, left-justify, or right-justify a
multi-line title. Adjust is located on the Titles tab’s General inner tab on the Property
Editor.
Title Positioning
Use the Left and Top location properties to customize the location of the title. When their
IsDefault properties are used, the header is centered over the PlotArea and the footer is
centered below the PlotArea. These properties are located on the Titles tab’s Location
inner tab on the Property Editor. See Positioning Chart Elements on page 117 for more
information.
Title Border
Use the Type and Width border properties to customize the title’s border. These properties
are located on the Titles tab’s Border inner tab on the Property Editor. See Using Borders
on page 115 for more information.
Title Colors
Use the interior properties to customize background and text colors of a title. These are
located on the Titles tab’s Interior inner tab on the Property Editor. See Setting Colors on
page 116 for more information.
Olectra Chart OCX
Title Font
Use the font properties to customize the font used for a title. These are located on the
Titles tab’s Font inner tab on the Property Editor. See Choosing Fonts on page 116 for
more information.
The legend displays the text contained in the SeriesLabels (a ChartGroups property), so
the legend does not appear unless at least one SeriesLabel exists. SeriesLabels are a
collection of labels. The first label applies to the first series, and so on. The SeriesLabels
property is located on the ChartGroup tab’s Labels inner tab on the Property Editor.
Legend Positioning
Use the legend Anchor property to specify where to position the legend relative to the
PlotArea. You can select from eight compass points around the PlotArea. Anchor is
located on the Legend tab’s General inner tab on the Property Editor.
Use the Left and Top location properties to finetune the positioning. When their IsDefault
properties are used, the chart automatically positions the legend. These properties are
located on the Legend tab’s Location inner tab on the Property Editor. See Positioning
Chart Elements on page 117 for more information.
Use the legend Text property to specify the legend title. The legend title appears centred at
the top of the legend. Text is located on the Legend tab’s Title inner tab on the Property
Editor.
Legend Border
Use the Type and Width border properties to customize the title’s border. These properties
are located on the Legend tab’s Border inner tab on the Property Editor. See Using
Borders on page 115 for more information.
Legend Colors
Use the interior properties to customize background and text colors of the legend. These
are located on the Legend tab’s Interior inner tab on the Property Editor. See Setting
Colors on page 116 for more information.
Legend Font
Use the font properties to customize the font used for the legend. These are located on the
Legend tab’s Font inner tab on the Property Editor. See Choosing Fonts on page 116 for
more information.
FillStyle
Use the Pattern property to set the fill drawing pattern for a ChartStyle. The Color
property sets the color used to draw the pattern (the foreground color), and the
BackGroundColor property sets the color used to fill the background. The valid patterns
are shown below:
Solid CrossHatched
25Percent BackwardDiagonal
50Percent Cross
75Percent DiagonalCross
HorizontalStripe ForwardDiagonal
VerticalStripe Horizontal
45DegreeStripe Vertical
135DegreeStripe
These properties are located on the ChartStyles tab’s FillStyle inner tab on the Property
Editor.
LineStyle
Use the Pattern property to set the line drawing pattern, the Width property to set its
width, and the Color properties to set the line color for a ChartStyle. The valid patterns are
shown below:
None
Solid
LongDash
Dotted
LongShortLongDash
DashDot
These properties are located on the ChartStyles tab’s LineStyle inner tab on the Property
Editor.
Use the Shape property to set the symbol type, the Size property to set its size, and the
Color properties to set the symbol color for a ChartStyle. The valid symbols are shown
below:
None VerticalLine
Dot HorizontalLine
Box Cross
Triangle Circle
Diamond Square
Star
These properties are located on the ChartStyles tab’s SymbolStyle inner tab on the
Property Editor.
SliceStyle
Use the Offset property to set the offset for exploding pie slices. See Special Pie Chart
Properties on page 39 for details.
Customizing ChartStyles
Olectra Chart OCX
The 2D Chart control enables you to programmatically change the following properties of
a ChartStyle object:
n The Fill property, which specifies the pattern, color, and background color inside area,
bar, pie and filled radar charts. This property is of type FillStyle.
n The Line property, which defines the line style for the object. This specifies the color,
pattern and thickness of lines in plots. This property is of type LineStyle.
n The Symbol property, which defines the symbol style for the object. This specifies the
color, size and shape of points in plots. This property is of type SymbolStyle.
n The Slice property, which defines the slice style for the object. This specifies the
offset for the exploding pie slices. This property is of type SliceStyle.
The ChartStyles collection contains the ChartStyle objects defined for each series. The
following methods are defined for the ChartStyles collection:
Normally, you will not need to add or remove ChartStyle objects from the collection
yourself. If a ChartStyle object already exists when its corresponding series is created, the
previously created ChartStyle object is used to display the data in this series.
By looping through the ChartStyles collection, you can quickly change the behavior of all
of the bars, lines or points in a chart. For example, the following code lightens all of the
bars in a chart whenever the mouse is clicked:
Private Sub Chart2D1_Click()
Dim Style As Object
For Each Style in Chart2D1.ChartGroups(1).Styles
Style.Fill.Color = Style.Fill.Color + &H50505
Next Style
End Sub
Note that this only works if the Color property is initially set to an RGB color value (if the
most significant bit is set to 0).
Examples
The following statement sets the color of the first bar in a chart to green:
Chart2D1.ChartGroups(1).Styles(1).Fill.Color = RGB(0,128,0)
The following sets the line pattern for the second line in a plot to a dotted line:
Chart2D1.ChartGroups(1).Styles(2).Line.Pattern = oc2dLineDotted
And the following statement sets the symbol style for the third line in a plot to an unfilled
circle:
Chart2D1.ChartGroups(1).Styles(3).Symbol.Shape = oc2dShapeCircle
The PointStyles collection contains the ChartStyles objects defined for each point. The
behavior of the PointStyles collection is similar to that of the ChartStyles collection
described above, except that the PointStyles collection is indexed by 2 variables, the
series and point. When specifying the style for a single point in a series, the child objects
make available an additional method called UseDefault that sets the style for the
individual point to the style used by its series.
Examples
The following statement sets the color of the second bar in the first series in a chart to
green.
Chart2D1.ChartGroups(1).PointStyles(1,2).Fill.Color = RGB(0,128,0)
The following sets the offset for the fourth slice in the third pie in a plot to 10% of the
radius.
Chart2D1.ChartGroups(1).PointStyles(4,3).Slice.Offset = 10
The following sets the fill style for the second point in the third series to the default style
used by the series:
Chart2D1.ChartGroups(1).PointStyles(4,3).Fill.UseDefault = True
The following is the object hierarchy for the ChartStyle and PointStyle objects and their
children:
Olectra Chart OCX
Use the Image Object’s FileName property to specify the name and location of the image
you want to display. The image must be in either Windows bitmap or Metafile format. Use
the IsEmbedded property to include the specified image with the chart. If IsEmbedded is
True, the image will be included with your chart (when the chart is saved). If IsEmbedded
is False, the chart will look for the image file in the specified location. Note that if you set
IsEmbedded, you should not change or remove the value of FileName. This property is
still required to point to the graphic you want to use so that it can be embedded into the
chart at runtime.
Use the Layout property to specify how the image is to be displayed. You can set Layout
to one of the following:
n Centered - places the image in the center of the chart element
n Fitted - resizes the image to fit as much of the chart element as possible, while
maintaining the image’s aspect ratio (so that the image remains in proportion)
n Stretched - resizes the image to fit the entire chart element area. For best results with
Notes
n Enhanced Metafiles are only supported under Windows 95/98 and Windows NT.
n If the background image type either a Metafile (.WMF) or Enhanced Metafile (.EMF)
format, the image will not draw when the chart is either copied to the clipboard or
copied to a file when using the Metafile format. To get around this limitation, it is
recommended that you set the drawing format to a Bitmap format when you want to
copy your chart to the printer, clipboard or file.
n When text areas containing background images are rotated, the image is not rotated
with the text area.
n The background image is not clipped to the circular PlotArea when rendering to a
Metafile for Polar and Radar chart types.
The default orientation for your chart is with the X-axis displayed horizontally, and the Y-
axis displayed vertically. Use the IsHorizontal property to switch the orientation of the X-
Olectra Chart OCX
and Y-axes. You can change the axes orientation for all ChartTypes except for Pie, Polar,
Radar and Filled Radar types.
By default, an outline is drawn around each series for Area, Bar, Stacking Bar and Pie
charts. Use the IsShowingOutlines property to turn the outlines on or off.
The valid border types are shown below; you can also specify that no border is used.
To change a border
Use the border Type property to set the type of border and the Width property to set its
thickness. These properties are located on the Border inner tab, found on the Control,
ChartArea, Titles, Legend, and ChartLabels tabs of the Property Editor.
To Change a Font:
Use the font properties to set the font, style, and size attributes. Font properties are located
on their own dialog on the Font inner tab, found on the Titles, Legend, Axes, and
ChartLabels tabs on the Property Editor. Click the button on the tab to display the dialog.
Notes
n Olectra Chart uses the container’s exposed Ambient font (if available) as its own
default font.
n The Color control in the font chooser dialog has no effect on the text color. To set the
color of text, use the ForegroundColor property, located on the Interior inner tab of
that element (located on the ChartArea tab for the axis text color).
n When you want to rotate the axis annotation or title, you must use a scalable font
(such as any TrueType font) for the axis. See Titling Axes and Rotating Axis Elements
for more information.
color names, RGB values, or interactively using a color chooser. Each of the following
visual elements in the chart has a background and foreground color that you can
customize:
n the entire chart
n Header and Footer titles
n Legend
n ChartArea
n PlotArea (background only)
n each ChartLabel added to the chart
The other chart elements that have color properties are ChartStyles, GridLines, and
Markers.
You can specify a color as one of over 200 recognized named colors. Choose common
colors like Blue or Orange, or more exotic colors like Chartreuse or HotPink. Most of
these colors look best on systems that can display 256 colors or more.
You can choose colors interactively using a color chooser dialog that works just like the
standard Windows Control Panel color chooser. Choose from Windows basic colors,
custom colors, or interactively with a full color spectrum.
Alternately, you can specify a color by its RGB components, useful for matching another
RGB color. RGB color values combine hexadecimal values for the red, green, and blue
components of a color. 00 is the smallest value a component can have; ff is the largest
value. For example, #ff00ff specifies magenta (the maximum value of red and blue
combined with no green).
The background and foreground of all elements except the chart itself can be Automatic.
When a background or foreground is automatic, the chart uses the color of the element
outside it for the background. For example, the header would have the background of the
chart itself when its background is set to Automatic.
To Change a Color:
When the chart controls positioning, it first allows space for the header, footer, and legend,
if they exist (size is determined by contents, border, and font). The ChartArea is sized and
positioned to fit into the largest remaining rectangular area. Positioning adjusts when other
chart properties change.
Use the Left location property to specify the number of pixels from the edge of the chart to
the left edge of the chart element. Use the Top location property to specify the number of
pixels from the edge of the chart to the top of the chart element. Left and Top have
IsDefault properties that allow the chart to automatically position the element.
These properties are located on the Location inner tab, found on the ChartArea, Titles,
Legend, and ChartLabels tabs of the Property Editor.
Use the Width and Height location properties to specify the width and height of the
ChartArea. These properties have IsDefault properties that allow the chart to
automatically size the ChartArea.
These properties are located and enabled on the ChartArea tab’s Location inner tab on
the Property Editor.
You can fix a margin so that it does not change as axis and data properties change, and to
achieve effects such as:
n Scaling or zooming a chart. When margins are all negative, axes and annotation are
clipped outside the PlotArea; the chart appears zoomed-in. When margins are all high
positive values, there is a lot of space around the PlotArea; the chart appears zoomed-
out.
n Moving or translating a chart. For example, when top margin is increased and bottom
margin decreased by the same amount, the chart moves down.
It is easier to achieve these effects interactively. See Interacting with the Chart for details.
To Set Margins
Use the PlotArea Top, Bottom, Left, or Right properties to set the value of a margin.
When you set a margin value, it remains fixed at that value until you change it or set its
IsDefault property.
Use the IsDefault properties of the Top, Bottom, Left, and Right margin properties to
allow the chart to automatically determine appropriate margins.
All PlotArea margin properties are located on the PlotArea tab’s General inner tab on the
Property Editor.
3D Depth
Use the Depth View3D property to set the visual depth of the 3D effect, as a percentage of
the chart width. The maximum value is 500.
3D Elevation
Use the Elevation property to set the distance above the X-axis for the 3D effect, in
degrees. This can be from -45 to 45 degrees.
3D Rotation
Use the Rotation property to set the distance right of the Y-axis for the 3D effect, in
degrees. This cannot be higher than 45 or lower than -45.
Shading
Use the Shading property to set the shading method for the 3D areas of the chart. Using
the Dithering method takes the graph color and uses white or black dots to make the 3D
portion of the graph either lighter or darker, respectively. Using the Color shading method
uses either a lighter or darker shade of the graph color to create the 3D effect.
To adjust the size of a Chart2D object when the Form object is resized, define a Resize
procedure for the form, and adjust the chart's height and width to correspond to the form's
height and width. For example, the following Resize procedure is defined by the chlabels
demo:
Private Sub Form_Resize()
’ Match the graph to the size of the form.
If Width > 700 Then ’ Check the width of the window
’ This keeps a consistent border around the
’ sides of the chart
Chart2D1.Width = Width - 700
Else
’ Sets the width to 0 because the window
’ is smaller than the size of the chart
Chart2D1.Width = 0
End If
There is no limit to the number of ChartLabels a chart can contain. Each ChartLabel has
label, interior color, border and attachment attributes that you can customize.
When you define a ChartLabel, you need to specify how to attach it to the chart and where
to position it relative to its attachment point.
The attachment method you choose depends on what you are using the ChartLabel for.
The following illustrates and describes the valid attachment methods:
Olectra Chart OCX
n Coord attaches to anywhere on the chart. You specify the number of pixels between
the top-left corner of the chart to the ChartLabel.
n DataCoord attaches to anywhere inside the PlotArea. You specify the data
coordinates. This method is not allowed on pie charts using PointLabels for the X-axis
annotation. If any part of the ChartLabel falls outside of the ChartArea, it is clipped.
n DataIndex attaches to a specific data point on the chart. You specify the series and
point indices, and the ChartGroup.
n DataIndex & Data Y attaches to a distance above or below a specific data point. You
specify the series and point indices, the ChartGroup, and the Y-coordinate. This is
most useful for bar and stacking bar charts.
Use the AttachMethod ChartLabel property to set the attachment method, and the
AttachCoord, AttachDataCoord, or AttachDataIndex properties to set the attachment
Once attached to a point on the chart, you can choose the anchoring position that works
best for that ChartLabel. The following shows the valid anchoring positions:
Use the Anchor ChartLabel property to specify where to position the ChartLabel relative
to its attachment point. In addition to the eight compass points, you can choose Home to
center the ChartLabel over its attachment point or Best to allow the chart to determine the
best position. Anchor is located on the ChartLabels tab’s General inner tab on the
Property Editor.
Use the IsConnected property to draw a line connecting the ChartLabel to its attachment
point and the Offset property to set the distance between the ChartLabel and its
Use the Text label property to set or change a ChartLabel’s text. Text is located on the
ChartLabels tab’s Label inner tab on the Property Editor. To enter multiple lines of text,
press ENTER between each line. You can add up to 100 lines of text for each ChartLabel.
Use the Adjust property to specify whether to center, left-justify, or right-justify a multi-
line ChartLabel. Adjust is located on the ChartLabels tab’s General inner tab on the
Property Editor.
Use the Rotation label property to set or change the rotation of a ChartLabel. Rotation is
located on the ChartLabels tab’s General inner tab on the Property Editor. ChartLabels
can be rotated by 0, 90 or 270 degrees.
ChartLabel Border
Use the Type and Width border properties to customize the title’s ChartLabel. These
properties are located on the ChartLabels tab’s Border inner tab on the Property Editor.
SeeUsing Borders on page 115 for more information.
ChartLabel Colors
Use the interior properties to customize background and text colors of a ChartLabel. These
are located on the ChartLabels tab’s Interior inner tab on the Property Editor. See Setting
Colors on page 116 for more information.
ChartLabel Font
Use the font properties to customize the font used for a ChartLabel. These are located on
the ChartLabels tab’s Font inner tab on the Property Editor. See Choosing Fonts on page
116 for more information.
ChartLabel Location
Use the Left, Top, Width and Height location properties to see the current size and
position of a ChartLabel. You cannot change these properties because the size/location is
determined by the label text and the attachment method. These properties are located on
the ChartLabels tab’s Location inner tab on the Property Editor.
You can pass either the chart label's index or its name to Remove.
To quickly remove all ChartLabels from the collection, use the RemoveAll() method:
Chart2D1.ChartLabels.RemoveAll()
The ChartLabel object provides a number of properties that help you define and position
the chart label. The most important of these properties are:
n The Text property specifies the text to appear in the chart label, and is of type Label.
n The Anchor property specifies the location of the chart label relative to the location to
which it is attached. The location is specified as an anchor constant, which represents
a compass direction.
n The IsConnected property is a Boolean which specifies whether a line is to be drawn
from the chart label to its attached location. If True, the line is drawn.
n The Offset property specifies the distance, in the anchor direction, from the chart label
to its attached location, and is of type Long.
To attach a chart label to a data coordinate on the chart, set the AttachMethod property to
oc2dAttachDataCoord, and then set the AttachDataCoord property to the coordinates
of the value. For example, the following attaches a chart label to the data coordinate (1.1,
15.8):
With Chart2D1.ChartLabels(1)
.AttachMethod = oc2dAttachDataCoord
.AttachDataCoord.X = 1.1
.AttachDataCoord.Y = 15.8
End With
You can also combine the above two methods, and attach a chart label to a location whose
X-coordinate is specified by a data point and whose Y-coordinate is specified by a chart
value. To do this, set the AttachMethod property to oc2dAttachDataIndexDataY, as in
the following example:
With Chart2D1.ChartLabels(1)
.AttachMethod = oc2dAttachDataIndexDataY
.AttachDataIndex.Series = 1
.AttachDataIndex.Point = 2
.AttachDataCoord.Y = 15.8
End With
The following is the object hierarchy for the ChartLabels collection and the properties
described above:
Olectra Chart OCX
Chart2D Legend
Object
ChartLabels ChartLabel Collection
AttachCoord
Coord Object
Attach DataCoord
DataCoord Object
AttachDataIndex
DataIndex Object
To improve efficiency, you can batch changes to a chart label. To do this, set the
IsBatched property to True before changing any chart label properties, and set IsBatched
to False once you have finished. This ensures that the chart will be updated only once,
instead of after each property change.
Example
The following code defines a chart label that points to the chart’s legend:
Dim label As Object
...
Set label = Chart2D1.ChartLabels.Add
With label
The chart can have two markers, X and Y. Each marker has positioning and LineStyle
attributes that you can customize.
Plot, area, bar and stacking bar charts can display both markers. The X-marker is drawn
through the X-axis and the Y-marker is drawn through the Y-axis. Pie, polar, radar and
filled radar charts use the X-marker only. When using markers with combination charts,
you can specify the ChartGroup to apply the marker to.
Positioning Markers
When you add a marker, you need to specify how to position it on the chart. The method
you use depends on what you are using the marker for:
n Value (ByValue) positions the marker at the X- or Y- chart coordinate you specify.
The X-marker cannot use this method when the chart is pie using PointLabels X-axis
annotation.
n Index (ByData) positions the marker at a specific data point. You specify the series
index and point index within that series. You specify the chart coordinates. The X-
marker must use this method when the chart is a pie using PointLabels X-axis
annotation.
Use the Method marker property to set the method to use, and the marker’s Index or
Value properties to set the marker position. These properties are located on the Markers
tab’s Attach inner tab on the Property Editor.
Use the IsShowing marker property to display or hide a marker once you have positioned
it. IsShowing is located on the Markers tab’s General inner tab on the Property Editor.
Use the LineStyle Pattern, Width, and Color properties to define the appearance of each
marker. These properties are located on the Markers tab’s LineStyle inner tab on the
Property Editor.
Use the IsStyleDefault marker property to reset marker style to a 1-pixel wide black
dashed line. IsStyleDefault is located on the Markers tab’s General inner tab on the
Property Editor.
Olectra Chart OCX
On plots, area graphs and bar charts, two markers are defined: an X-marker and a Y-
marker. The X-marker is a line perpendicular to the X-axis, and the Y-marker is a line
perpendicular to the Y-axis.
On stacking bar charts, the X-marker is a short line drawn through one of the bar blocks,
and the Y-marker is a line perpendicular to the Y-axis.
On pie charts, only the X-marker is defined, and is a line drawn from the center of the pie
outward through the center of the selected slice.
Once the marker is displayed, it can be positioned. For example, the following code
positions the Y-marker at the point where the mouse is currently located. As the mouse
moves, the Y-marker moves with it.
Private Sub Chart2D1_MouseMove(Button As Integer, Shift As Integer, _
x As Single, y As Single)
Dim px As Long
Dim py As Long
Dim vx As Double
Dim vy As Double
px = x / Screen.TwipsPerPixelX ’ Get the current mouse X position
py = y / Screen.TwipsPerPixelY ’ Get the current mouse Y position
This procedure positions the marker using chart coordinates. You can also position a
marker by specifying a dataset and point through which the marker should be drawn. To
do this, use the Index property instead of the Value property.
Performance Issues
Updating the marker positioning properties occurs very quickly. This is because the 2D
Chart does not repaint the entire chart window to reposition the markers. Marker
performance is improved by setting the IsDoubleBuffered property of the Chart2D
object to True. (However, general chart performance is improved by turning double
buffering off.)
Olectra Chart allows you to interact with the user, reacting to specific mouse, menu and
keyboard actions. You can also determine which tabs from the Property Editor you want
users to see. The following topics cover the different types of user interaction.
131
8.1 Programming Actions
A chart action is a user event that causes some interactive action to take place in the
control. There are three stages of user interaction defined in 2D Chart:
n Starting a user interaction
n Updating a user interaction
n Ending a user interaction
Chart actions are defined for each of these stages. The complete list of actions is specified
by the Action Constants.
Action Maps
An action map is a mapping of a mouse operation and/or key pressing to a chart action.
Each action map consists of three parts:
n The message (indicating what mouse operation or key pressing occurred)
n Any modifier flags
n The keycode (if the message is WM_KEYDOWN or WM_KEYUP)
The ActionMaps collection specifies the action maps currently defined for the 2D Chart
control.
Recognized Messages
If you have a three-button mouse, holding down the middle mouse button is equivalent to
simultaneously holding down the left and right mouse buttons.
Modifier Flags
Recognized Keycodes
Any valid VK_ value is treated as a recognized keycode. Note the following, however:
n All alphabetic characters are forced to upper case.
n MK_SHIFT must appear in the modifier if capitals are desired.
n The CapsLock key toggles the meaning of the MK_SHIFT modifier.
To program an action mapping, use the Add method to add the new action mapping to the
collection.
All 2D Chart actions are can be customized: you can determine which Microsoft Windows
message will call a particular action, and decide on the appropriate steps to perform in
each case.
To remove an existing action mapping, use the Remove method to remove the action
mapping from the collection:
With Chart2D1.ActionMaps
.Remove WM_LBUTTONDBLCLK, 0, 0
End With
Note that Remove generates an exception if the action does not exist.
To call an action directly, call the CallAction method, which is defined by the Chart2D
object. This method is passed the action to be performed and the X- and Y- coordinates of
a window location.
For examples of code using CallAction, refer to the actions demo provided with your
Olectra Chart distribution.
Each of the actions defined in the Action Constants maps to a 2D Chart event method. The
following mappings are defined:
oc2dActionModifyStart ModifyStart()
oc2dActionModifyEnd ModifyEnd()
oc2dActionRotate View3DModify()
oc2dActionScale PlotAreaModify()
oc2dActionTranslate PlotAreaModify()
oc2dActionZoomStart ModifyStart()
oc2dActionZoomCancel PlotAreaModify()
The event methods are defined in the Event Reference section. Note that some actions
trigger multiple events.
To determine the pixel coordinates of a given data point, call DataIndexToCoord. For
example, the following code obtains the pixel coordinates of the point in the second row
and third column:
Dim PixelX As Long
Dim PixelY As Long
...
With Chart2D1.ChartGroups(1)
.DataIndexToCoord 2, 3, PixelX, PixelY
End With
’ PixelX and PixelY now contain the pixel coordinate value
If the data coordinate is out of the visible range of the chart, both of the pixel X- and Y-
coordinates are set to -1.
CoordToDataCoord returns, as its return value, the region of the chart in which the pixel
coordinates are located. This region is represented as a region constant.
To determine the closest data point to a set of pixel coordinates, call CoordToDataIndex:
Dim Row As Long
Dim Column As Long
Dim Distance As Long
Dim Region As Integer
...
With Chart2D1.ChartGroups(1)
Region = CoordToDataIndex 225, 92, Row, Column
End With
CoordToDataIndex returns the row and column of the closest data point, and also returns
the distance in pixels between the pixel coordinates and the point. CoordToDataIndex
returns, as its return value, the region of the chart in which the pixel coordinates are
located. This region is represented as a region constant. When the returned region is
oc2dRegionInLegend, the returned point value is also set to oc2dRegionInLegend, and
the returned series is the closest element in the legend.
Use the ShowChartEditorElement method to set the display state of the Property Editor
tab. The following example hides the Control tab and the Font subtab of the Axes tab:
Chart2d1.ShowChartEditorElement oc2dceeControl, False
Chart2d1.ShowChartEditorElement oc2dceeAxesFont, False
You can add an Olectra Chart 2D control to a web page. Steps 1-5 provide detailed
information on the tools you need, how to insert the control, how to create the license pack
file, how to optimize the download process and what to look for when testing the web
page.
139
9.1 Getting Started
Before you can add Olectra Chart to your web page, you will need the following tools:
Microsoft ActiveX SDK - Use this SDK to create the License Pack File (.LPK) that users
will download when viewing a web page containing an Olectra Chart ActiveX control.
You can download the ActiveX SDK from:
http://msdn.microsoft.com/developer/sdk/inetsdk/asetup/
Microsoft Cabinet SDK - Use this SDK to create the Cabinet file which stores all the
files to be downloaded. Creating a .CAB file helps to minimize the download time, and to
keep all downloaded files together You can download the Cabinet SDK from:
http://www.microsoft.com/workshop/management/cab/cabdl.asp
When this HTML code is processed, the browser checks to see if you have Olectra
Chart registered, and if not it will download and register the control.
Olectra Chart OCX
If you also want to specify a version the control to check for, add the Version element.
This will avoid such problems as using new functionality with a prior version of the
control. The following example shows how to specify the control version to search
for:
<OBJECT ID="Chart2D1" WIDTH=473 HEIGHT=352
CLASSID="CLSID:92D71E93-25A8-11CF-A640-9986B64D9618"
CODEBASE="http://www.yoursite.com/olectra.cab#Version=6,0,0,0">
</OBJECT>
3. To set properties, load data or access the chart, you must write VBScript code. For ex-
ample, the following code sets the header, footer, ChartType and adds some data:
-->
</SCRIPT>
Notes
n The CLSID (pronounced Class ID) specified above is for the 32-bit Olectra Chart 2D.
For information on adding a 3D control see Adding an Olectra Chart 3D Control to a
Web Page on page 245.
n Olectra Chart is safe for scripting, which means that it (or any of its methods) will not
write to the local storage when used within a secure Web browser. Olectra Chart will
also not execute any binary code (for example, a. virus) that is passed to it as data.
n The Codebase element in the above example points to where the .CAB file (which
contains all the files users must download to view the control) is located. For more
information on creating .CAB files, see Packaging the Control on page 144.
n If you are developing using 1.1 of Olectra Chart, and viewing a web page that contains
version 6.0 of the control, conflicts may arise. See Special Version Considerations on
page 143 for more information.
Using the LoadURL method, you can load data or a chart description file (.OC2 and
.OC3) directly from a URL instead of adding it programmatically. If you want to load an
entire chart, use the Chart2D object’s LoadURL method. If you just want to load data
into an existing chart, use the ChartData object’s LoadURL method. Both of these
methods have a single parameter, URLname, which is a string representing the URL where
the file you want to load is located.
The following two examples illustrate the different uses of the LoadURL method from
within an HTML file:
<SCRIPT LANGUAGE="VBScript">
Sub Window_OnLoad()
’Load an .OC2 file
Chart2D1.loadURL("http://www.apexsc.com/OlectraChart6/data/profit.oc2")
If you have a registered version of Olectra Chart 1.1 on your computer, browsing to a web
site containing version 6.0 of the control may cause problems. If the <OBJECT> tag is set to
require Olectra Chart 6.0, the control will download and re-register itself as the current
control. For this reason it is highly recommended that you do not browse locations
containing version 6 of the control on your 1.1 development machine.
To restore Olectra Chart 1.1 as the version on your computer, do the following:
1. Unregister Olectra Chart 6.0. Internet Explorer caches all downloaded ActiveX con-
trol components within a directory called OCCACHE that exists directly under the
WINDOWS or WINNT root directories. In that directory, type at the command prompt:
Regsvr32 /u olch2x32.ocx
After creating the .LPK file, you must add the following lines in your HTML page, before
the <OBJECT> tag used to describe Olectra Chart. In this example, replace filename.lpk
with the name of your pack file:
<OBJECT CLASSID = "clsid:5220cb21-c88d-11cf-b347-00aa00a28331">
<PARAM NAME="LPKPath" VALUE="filename.lpk">
</OBJECT>
Notes
n You must have a registered version of Olectra Chart on your computer to successfully
generate a .LPK file.
n The reference to the resulting .LPK file that you create must be placed on your HTML
page before references to any of your ActiveX controls.
n If your .LPK was created with only Olectra Chart in it, it should be 878 bytes. If it is
smaller, the license pack file was not created properly.
In order for your browser to correctly load and run Olectra Chart you must create an .INF
file that lists all of the control’s dependencies. Create a text file with the suffix .INF that
lists all of the files needed for this component. For 32-bit Olectra Chart 2D, the files
needed are:
olch2x32.ocx
msvcrt.dll
mfc42.dll
[olch2x32.ocx]
File=thiscab
Clsid={92D71E93-25A8-11CF-A640-9986B64D9618}
[mfc42.dll]
File=mfc42.cab
[msvcrt.dll]
File=msvcrt40.cab
Notes
n Many users may already have the mfc42.dll and msvcrt.dll files available on their
computers from prior software installations, so this .INF file will instruct Internet
Explorer to download them only if necessary.
n To minimize download time, compress these files individually using cabarc.exe. For
more information, see the following section, Creating a CAB File.
To create a CAB file that contains the Olectra Chart OCX, DLL and the .INF file,
type:
cabarc n olectra.cab olch2x32.ocx olectra.inf
2. Find the place in the HTML on your Web page where the Olectra Chart control is ref-
erenced. (There should be an <OBJECT> tag with a CLASSID that matches the 32-bit
For example:
<OBJECT ID="Chart2D" WIDTH=313 HEIGHT=225
CLASSID="CLSID:92D71E93-25A8-11CF-A640-9986B64D9618"
CODEBASE="http://www.yoursite.com/olectra.cab">
</OBJECT>
Here is a very simple .HTML file that displays a 2D chart control. In particular, note the
class IDs for the license pack file and the chart control:
<HTML>
<HEAD>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1">
<TITLE>Home Page</TITLE>
</HEAD>
<OBJECT CLASSID="clsid:5220cb21-c88d-11cf-b347-00aa00a28331"
</OBJECT></p>
<p>
<OBJECT ID="Chart2D" WIDTH=313 HEIGHT=225
CLASSID="CLSID:92D71E93-25A8-11CF-A640-9986B64D9618"
CODEBASE="http://www.yoursite.com/olectra.cab">
</OBJECT>
</BODY>
</HTML>
Once you have created the .LPK and .CAB files, copy them to the server where your web
page is. The .LPK file must be in the same directory as the HTML file that references it.
The .CAB file must be in the directory that is specified in the <OBJECT> tag. For
example, in the above HTML code, the file olectra.cab would go in the root directory of
the server where www.yoursite.com is located.
Olectra Chart OCX
You may get a sequence of dialog boxes depending on the security level that your copy of
Internet Explorer is set to. You can change these settings by doing the following:
1. On the View menu, click Options. The Options dialog appears.
2. Click the Security tab.
3. Click the Safety Level button.
Note
n Internet Explorer caches all downloaded ActiveX control components within a
directory called OCCACHE that exists directly under the WINDOWS or WINNT root
directories. If you wish to remove Olectra Chart from your test system, you only need
to delete the files in the OCCACHE directory that correspond to the ones listed in the
.INF file described in Packaging the Control on page 144.
Successful charting requires that you are familiar with basic chart processes and
vocabulary, specifically as they relate to the 3D Chart control. The following topics cover
basic information that anyone who uses 3D Chart should be familiar with.
151
10.1 Chart Terminology
The following shows the terms used to describe chart elements.
As you edit properties, the changes are immediately applied to the chart and displayed.
This enables you to quickly see how a change affects the chart so that you can make
further changes without leaving the Property Editor.
Tabs contain one or more inner tabs that group related properties together. Some tabs
also contain a list that selects a specific object to edit.
2. If the tab contains a list on the left side, select the specific object to edit from that list.
3. Select the inner tab that corresponds to the kind of property you want to edit.
4. Click on a control and change the value of that property.
The change is immediately applied to the chart and displayed unless the IsBatched
property (located on the Control tab’s General inner tab) is set. When IsBatched is
set, click the Apply button to display property changes.
5. Make further changes to the same property or change other properties on this tab or
other tabs.
Special Notes
n The keyboard/mouse combinations that perform the different interactions can be
changed or removed by a programmer. The interactions described here may not be
enabled for your chart.
Rotation
Translation
1. Press SHIFT, hold down both mouse buttons (or middle button on a 3-button mouse).
2. Move mouse to change the positioning of the chart inside the ChartArea.
Scaling
1. Press CTRL, hold down both mouse buttons (or middle button on a 3-button mouse).
2. Move mouse down to increase chart size, or up to decrease chart size.
For more information on 3D Bar charts, see Special Bar Chart Properties on page 233.
For more information on 3D Scatter plots, see Special Scatter Plot Properties on page
233.
Mesh Mesh
Surface Example Bar Example
Notes
n You can customize the top and bottom mesh color and other mesh properties.
Shaded Shaded
Surface Example Bar Example
Notes
n You can customize the top and bottom surface color and other surface properties.
Notes
n You can customize contour levels, ContourStyles, and other contour properties.
Zones Zones
Surface Example Bar Example
Olectra Chart OCX
Notes
n You can customize contour levels, ContourStyles, and other zoning properties.
Notes
n You can customize the top and bottom mesh color and other mesh properties.
n You can customize the top and bottom surface color and other surface properties.
Notes
n You can customize the top and bottom mesh color and other mesh properties.
Notes
n You can customize the top and bottom mesh color and other mesh properties.
n You can customize contour levels, ContourStyles, and other zoning properties.
Olectra Chart OCX
Notes
n You can customize the top and bottom surface color and other surface properties.
n You can customize contour levels, ContourStyles, and other contour properties.
Notes
n You can customize the top and bottom surface color and other surface properties.
Notes
n You can customize contour levels, ContourStyles, and other contour and zoning
properties.
Notes
n You can customize the top and bottom mesh color and other mesh properties.
Notes
n You can customize the top and bottom mesh color and other mesh properties.
n You can customize the top and bottom surface color and other surface properties.
n You can customize contour levels, ContourStyles, and other contour properties.
Notes
n You can customize the top and bottom surface color and other surface properties.
n You can customize contour levels, ContourStyles, and other contour and zoning
properties.
Notes
n You can customize the top and bottom mesh color and other mesh properties.
Notes
n You can customize the top and bottom mesh color and other mesh properties.
n You can customize the top and bottom surface color and other surface properties.
n You can customize contour levels, ContourStyles, and other contour and zoning
properties.
No Chart Displayed
n No chart displays when all four properties are off.
The data must be supplied in one of three basic layouts, Grid, Irregular Grid, or Point.
Data can come from many different sources, such as data files or the results of
mathematical formulae. You can load and save data files, and customize the data itself,
using the Property Editor.
Use Grid layout when the X- coordinates of each point and the Y-coordinates of each point
are always the same distance apart. The following diagram illustrates the characteristics of
Grid layout.
RowCount = 3
ColumnCount = 4
RowDelta = 1
ColumnDelta = 1
RowOrigin = -2
ColumnOrigin = -2
Use Irregular Grid layout when the X- coordinates of each point or the Y-coordinates of
each point are not the same distance apart. The following diagram illustrates the
characteristics of Irregular Grid layout.
RowCount = 4
ColumnCount = 3
ColumnDeltas
RowDeltas
RowOrigin = 0
ColumnOrigin = 0
Use Point Layout for scatter plots when you want to chart multiple series of points. The
following diagram illustrates the characteristics of Point layout.
Series 1 = Purple
Series 2 = Red
Z=3
X=5
Y=1
X Y Z
Point 1 5 1 3
Series 1 Point 2 5 2 4
Point 3 4 3 2
X Y Z
Point 1 2 2 2
Series 2 1 3 3
Point 2
Use the HoleValue property to set the data value that represents a hole in your data. When
the chart sees values in the data grid that are the same as the hole value it displays as a hole
in the chart.
Olectra Chart includes sample chart descriptions and data files that you can use as
templates to build your own custom chart.
The following topics cover distributing applications created with the 32-bit
3D Olectra Chart control.
169
11.1 Distributing 32-bit OCX Applications
You can freely distribute any applications that you create with Olectra Chart. An Olectra
Chart application needs its dynamic link libraries present on the system it is run on.
Distributable Files
When distributing 3D 32-bit OCX applications, you may only distribute the following file:
OLCH3X32.OCX
The following MFC and OLE support files must also be installed on the end-user’s system
for Olectra Chart OCX applications to work:
MFC42.DLL
MSVCRT.DLL
OLEPRO32.DLL
OLEAUT32.DLL
If OLEPRO32.DLL has not previously been installed, it must be registered before it can be
used. To register this DLL, follow the same steps used to register the Olectra Chart
Control. If this DLL is installed already, you can assume that it has been registered.
In order to distribute Olectra Chart using VB 6, you must run the Package & Deployment
wizard (located in your VB directory\Wizards\PDWizard ) once to create a file vb6dep.ini.
For VB5, you must run the Setup wizard (located in your VB directory\Setupkit\kitfile32)
once to create a file vb5dep.ini. The following dependences must be added to this file so
you can distribute an application created with Olectra Chart:
[OLCH2X32.OCX]
Register=$(DLLSelfRegister)
Dest=$(WinSysPath)
Uses1=MFC42.DLL
Uses2=MSVCRT.DLL
[OLCH3X32.OCX]
Register=$(DLLSelfRegister)
Olectra Chart OCX
Dest=$(WinSysPath)
Uses1=MFC42.DLL
Uses2=MSVCRT.DLL
[MFC42.DLL]
Register=$(DLLSelfRegister)
Dest=$(WinSysPath)
[MSVCRT.DLL]
Dest=$(WinSysPath)
Note that the above file contains the dependencies for both the 2D and 3D Olectra Chart
controls.
Once you have added the above dependencies, run the Setup wizard and follow the
directions on each screen. On the Confirm Dependency screen, make sure you include the
OCX files.
In VB 5, on the File Summary screen, make sure the following files have been included:
OLCH2X32.OCX
OLCH3X32.OCX
MSVCRT.DLL
MFC42.DLL
If your applications allow the end-user to access the 3D Chart Property Editor, you should
also distribute the Property Editor’s end-user online help, contained in the following files:
OLCH3D-U.HLP
OLCH3D-U.CNT
If you have disabled end-user property editing, you do not need to distribute these files.
Before the 3D Chart control can be used in an application, appropriate entries must be
added to the Microsoft Windows registration database.
To register the control for 32-bit applications, pass the complete path and filename of the
Olectra Chart OCX file, OLCH3X32.OCX, to the REGSVR32.EXE control registration
program.
Controlling the chart in an application program is generally quite straightforward once you
are familiar with the object hierarchy. For most chart objects, the examples and overviews
in the Object Reference provide all the information needed to program them.
173
12.1 Object Hierarchy
The following are the high-level objects defined as children of the 3D Chart control:
For information on the object hierarchy for a specific chart object, go to the help page for
that object and press the Object Hierarchy button.
Olectra Chart OCX
The Object Reference describes the Chart3D object, the sub-objects automatically created
when the Chart3D object is created, and the properties defined for each object. Properties
that are read-only are indicated as such in their object description.
The following statement turns off the chart’s double buffering feature by setting the
IsDoubleBuffered property of the Chart3D object to False:
Chart3D1.IsDoubleBuffered = False
By default, the first Chart3D object created in an application is named Chart3D1, the
second is named Chart3D2, and so on. This is standard Visual Basic behavior.
As with other Visual Basic objects, you can access a specific object by navigating its
object hierarchy. For example, the following code retrieves the background color of the
main body of the chart:
Dim BackColor As Long
BackColor = Chart3D1.ChartArea.Interior.BackgroundColor
Default Properties
Both of the above statements change the value of the Type property to
oc3dBorderShadow.
Using Collections
Many 3D Chart objects are organized into collections. For example, the chart axes are
organized into the Axes collection.
All collections are indexed by number, with 1 referring to the first element of the
collection, 2 the second, and so on. If the objects in a collection have a Name property, the
collection can also be indexed by object name. For example:
This statement accesses the axis named “X” (the X-axis), and sets the maximum value of
this axis to 25.1. Note that Visual Basic recognizes the default Item property of the
collection, whereas other environments may require an explicit reference to the Item
property:
Chart3D1.ChartArea.Axes.Item("X").Max = 25.1
Some 3D Chart collections are static, whereas others are dynamic. Dynamic collections
have Add and Remove methods defined. Elements cannot be added to or removed from
static collections.
For more details on the behavior of Visual Basic collections, refer to the Visual Basic
documentation.
Visual Basic enables you to access each of the elements of a collection in turn using the
For Each statement. For example, the following code sets the vertical pixel offset (the
distance between the center of each chart label and its point of attachment) to 10:
For Each Label in Chart3D1.ChartLabels
Label.VerticalOffset = 10
Next
Each collection defines a Count property whose value is the current number of objects in
the collection. You can use Count to access some or all of the elements of a collection. For
example, the following is another way to set the vertical pixel offset for the chart labels:
Dim Counter As Integer
For Counter = 1 To Chart3D1.ChartLabels.Count
Chart3D1.ChartLabels(Counter).VerticalOffset = 10
Next
Calling Methods
To call a 3D Chart method, access the object with which it is associated. For example, the
following statement uses the DataCoordToCoord method, defined by the ChartGroups
collection, to convert the data coordinates (5.1, 10.2, 8.4) to their equivalent pixel
coordinates:
Chart3D1.ChartGroups(1).DataCoordToCoord 5.1, 10.2, 8.4, PixelX,
PixelY
Each method is described in the help page for its associated object. For example,
DataCoordToCoord is described in the ChartGroups collection help page.
In the Visual C++ environment, a 3D Chart control behaves like any other OLE control,
which means that it can be incorporated into a container such as a dialog or an application
window.
To add the 3D Chart control to an OLE container project, use Component Gallery as
follows:
1. From the Insert menu, select Component. The Component Gallery dialog box ap-
pears.
2. Select the OLE Controls tab.
3. Select the 3D Chart control icon in the Component Gallery window.
To add the 3D Chart control to your dialog template, perform the following steps:
1. Load the container project into Developer Studio.
2. In the Project Workspace window, click the ResourceView button.
3. Open the Dialog folder.
4. Double-click the main dialog box template.
5. Choose the 3D Chart control icon from the Controls toolbar.
6. Position the mouse in the dialog box, and click to position the 3D Chart control.
7. From the File menu, choose Save All.
Once the 3D Chart control has been added to the project and placed in the dialog box
container, you can access this control from other parts of your project. The easiest way to
do this is to create a member variable of the dialog class, CContainerDlg, of type
CChart3D (the 3D Chart wrapper class). To create a member variable, perform the
following steps:
1. Load the OLE container project.
2. Choose ClassWizard from the View menu.
3. Choose the Member Variables tab.
The member variable you have just added can now be used to access the embedded 3D
Chart control.
At this point, you are ready to actually program the control. To do this, note the following:
n A wrapper class header file is defined for each 3D Chart object. Examples: the
wrapper class header file for the Chart3D object is named chart3d.cpp, and the
wrapper class header file for the Border object is named border.cpp.
n The wrapper class header file for an object defines two routines for each of its
properties: a routine that gets the current value of the property, and a routine that sets
the value of the property. For example, the chart3d.cpp file defines two routines for
the IsDoubleBuffered property of the Chart3D object: GetIsDoubleBuffered(),
which gets the current value of the IsDoubleBuffered property, and
SetIsDoubleBuffered(), which sets the value of the IsDoubleBuffered property.
n Methods defined for an object are included in the wrapper class header file for the
object.
The following statement sets the background color of the chart area. The variable m_chart
contains an instance of a Chart3D object (the main 3D Chart object).
m_chart.GetChartArea().GetInterior().SetBackgroundColor(
RGB(247,206,151));
This statement navigates the 3D Chart object hierarchy by retrieving the values of
successive properties. First, the value of the ChartArea property is retrieved, which is a
ChartArea object. Then, this ChartArea object’s Interior property is retrieved, which is
an Interior object. Finally, the Interior object’s BackgroundColor property is set.
Using Collections
Many 3D Chart objects are organized into collections. For example, the chart axes are
organized into the Axes collection.
To access a particular element of a collection, specify the index which uniquely identifies
this element. For example, the following code changes the maximum value of the X axis
Olectra Chart OCX
to 25.1:
Caxis
axisX(m_chart.GetChartArea().GetAxes().GetItem(COleVariant("x")));
axisX.GetMax().SetValue(25.1);
Calling Methods
To call a 3D Chart method, access the object with which it is associated. For example, the
following statement uses the DataCoordToCoord method, defined by the ChartGroups
collection, to convert the data coordinates (5.1, 10.2, 14.3) to their equivalent pixel
coordinates:
long pixelx, pixely;
m_chart.GetChartGroups().GetItem(COleVariant(short(1)))
.DataCoordToCoord(5.1, 10.2, 14.3, &pixelx, &pixely);
Demo Programs
Sample C++ programs, created using Visual C++, are included as part of the Olectra Chart
distribution. These sample programs are contained in the \CHART\3D\DEMOS\VC
directory.
x1 := VarArrayCreate([1,10000,1,4], varDouble);
// Set the chart to have 4 series of 10000 points
Chart3D1.ChartGroups.Item(1).ElevationData.RowCount := 10000;
Chart3D1.ChartGroups.Item(1).ElevationData.ColumnCount := 4;
// Place data into the array
Chart3D1.ChartGroups.Item(1).ElevationData.CopyZArrayIn( x1);
// Release the variant item
x1 := Unassigned;
end;
Due to the changes made when Borland introduced Delphi 3 and Delphi 4, there are a
number of coding changes that are required to use Olectra Chart. Below is the current list
of known changes that may be required:
1. The name of the file inserted into the code by the IDE on the uses line has changed
from OLCH2X32 to OlectraChart3D_TLB.
2. In order to use the Safe Array functions, you now have to declare the arrays for use
with these functions as type OleVariant instead of Variant.
3. Code located in the OnCreate() event that used to work fine in Delphi 2.01 will not
work in later versions. There are two work-arounds for this (Borland is currently
working on a Patch that should hopefully cure this problem):
Olectra Chart OCX
Solution A:
Around any code that deals with Olectra Chart, use the Chart3D1.IsBatched :=
True/False; statements to put the Chart in Batch mode.
Solution B:
Move the code to the OnActivate() event and use a flag to ensure that this code only
runs once.
4. Due to the stronger typing introduced in Delphi 3 and Delphi 4, there are five methods
in Olectra Chart that have been renamed automatically by Delphi. The following is the
Note that although these changes still occur in Delphi 4, a Conversion Log is not
generated.
5. In order to access the font object associated with various objects in Olectra Chart, you
now have to access them using a Variant. Here is an example:
var
f: Variant;
begin
f := Chart3D1.Header.Font;
f.Name := ’Times New Roman’;
f.Size := 15;
f.Bold := True;
f := UnAssigned;
end;
6. When accessing the data object in Olectra, Delphi 2.01 lets you do it using either
round brackets () or square brackets []. In Delphi 3 you must use square brackets when
accessing the data object. Here is an example:
Chart3D1.ChartGroups.Item[1].Data.x[1, 1] := 1;
Chart3D1.ChartGroups.Item[1].Data.y[1, 1] := 5;
Note
n In the above examples, it also shows that the .Item[] reference also requires the use of
square brackets now, where in Delphi 2.01 it also allowed the use of round brackets ().
In the Windows 95 and Windows 98 environments, lines are drawn using the dash styles
predefined by Microsoft Windows. As a consequence, some 3D Chart dash styles are not
displayed exactly as specified. The following dash styles are affected:
n The short dash pattern (oc3dLineShortDash) is represented as a dash-dot pattern.
n The long-short-long dash pattern (oc3dLineLongShortLongDash) is represented as a
dash-dot-dot pattern.
In the Windows 95 and Windows 98 environments, any non solid lines of thickness greater
than 1 are rendered as lines with thickness 1.
12.7 Upgrading Visual Basic 4.0 Projects from Olectra Chart 1.1
For most development environments, upgrading your chart from version 1.1 of the OCX
to version 6.0 is as easy as loading the .OC3 file with into your environment with Olectra
Chart 6.0 installed. Saving the file will automatically update your project.
Projects created with Visual Basic 4.0 record the version of the OCX inside the .VBP file.
After you upgrade to Olectra Chart 6.0, your projects containing Olectra Chart 1.1 will not
load correctly. The log file will contain this message:
Class OlectraChart3D.Chart3D of control Chart was not a loaded control
class.
Note that this is only required if you are using Visual Basic 4.0. Visual Basic 5.0 (and
later) detects and correct this problem automatically.
Olectra Chart OCX
Building a chart is quite easy. The chart can automatically set properties based on the data,
so axis numbering and data display usually don’t need much customization.
The following topics cover information on the various steps required to create a chart.
183
13.1 Creating Histogram Bar Charts
3D bar charts typically display the values along an axis in a fixed format. You can display
one or more axes in a histogram format. Histograms may (but usually don’t) use an
irregular data layout. There is always one less bar because the row/column delta is used
for the width of each bar. You can display a bar chart in a histogram format along either
the X- or Y-axis.
To display a histogram:
1. Set the ChartType property to Bar. The ChartType property is located on the Chart-
Group tab's General inner tab on the Property Editor.
2. Use the bar RowFormat and ColumnFormat properties to set the display format of
the X- and Y-axes respectively. Both RowFormat and ColumnFormat can be either
fixed or histogram. These properties are located on the Bar tab’s General inner tab on
the Property Editor.
Olectra Chart OCX
Values Annotation
Values automatically generates numeric annotation based on the data itself. Values
annotation can be used for any axis.
ValueLabels Annotation
A very flexible type of annotation, ValueLabels displays text you define at a specific axis
coordinate. This is useful to label only specific coordinates, or to produce annotation in a
form that the chart does not provide. ValueLabels annotation can be used for any axis.
ValueLabels
Every label displayed on the axis is one ValueLabel. Each ValueLabel has a Value
property and a Label property.
Use the Value property to set the axis coordinate to display the label. Use the Label
property to specify the text to display. All ValueLabels properties are located on the Axes
tab’s ValueLabels inner tab on the Property Editor. Set AnnotationMethod to
DataLabels displays text you define at each point along the X- or Y-axes. DataLabels
annotation cannot be used for the Z-axis.
DataLabels are a collection of labels. The first label applies to the first point, the second
label applies to the second point, and so on.
Use the RowLabels and ColumnLabels ChartGroup properties to define and edit
DataLabels. These are located on the ChartGroup tab’s Labels inner tab on the Property
Editor. Set AnnotationMethod to DataLabels for an axis and use this tab to define the
labels.
The axis labelling method in use for a particular axis is specified by the
AnnotationMethod property. Valid values for this property are specified by the
annotation method constants.
Similarly, labels for the Y-axis are supplied by the setting the ColumnLabels property of
the ChartGroup object.
following code sets chart labels at the locations 10, 20 and 30:
With Chart3D1.ChartArea.Axis("X")
.AnnotationMethod = oc3dAnnotateValueLabels
With .ValueLabels
.Add 10#, "Label 1"
.Add 20#, "Label 2"
.Add 30#, "Label 3"
End With
End With
Use the Axes Min and Max properties to fix the minimum or maximum axis extent at a
particular value. Their IsDefault properties allow the chart to automatically determine
axis bounds based on the data bounds. These properties are located on the Axes tab’s
Scale inner tab on the Property Editor.
Z-axis Notes
The Z-axis minimum/maximum cannot be set inside the Z-range of the data. If you have
fixed an extent for the Z-axis and a subsequent data change puts the range outside of the
axis, the chart sets the Z-axis IsDefault property so that its extent is recalculated.
The X- and Y-axis minimum/maximum cannot be set to a location that does not coincide
with a line of data. The values are always adjusted upwards so they do coincide.
Use the axis Title property to add a title to an axis. To remove the title, delete the text.
Use the Stroke and Size CubeFont properties to specify a stroke font for the titles. Use the
TrueType property to specify a True Type font for the axes. All axes titles use the same
font. See Choosing Fonts for more information on using CubeFonts.
The Title, Stroke, TrueType and Size properties are located on the Axes tab’s Title inner
tab on the Property Editor.
For many charts, the length of each axis is the same, so the PlotCube should appear
square. You can change the scale of the X or Y dimension to make the PlotCube appear
stretched or flattened. This can be used to make more densely packed data points easier to
examine in the chart.
Use the XScale property to scale the X dimension of the PlotCube and the YScale
property to scale the Y dimension. The value represents the percentage of the Z dimension
to scale. For example, setting XScale to 200 would make the X-axis appear double the
length of the Z-axis.
These properties are located on the PlotCube tab’s General inner tab on the Property
Editor.
Contour lines and zone colors can be projected onto the PlotCube’s ceiling and floor. This
is useful when you’d like to focus the chart on the 3D surface shape but still provide
contour or zone information on the chart.
Olectra Chart OCX
Use the IsContoured and IsZoned Ceiling and Floor properties to project contour lines or
zone colors on the sides of the PlotCube. These properties have no effect on 3D charts or
bar charts. IsContoured and IsZoned are located on the PlotCube tab’s Ceiling and
Floor inner tabs on the Property Editor.
To position an area manually, change the properties of its Location object. For example,
the following statement sets the Height property to change the height of the chart area:
Chart3D1.ChartArea.Location.Height.Value = 100
Use the Perspective View3D property to control the perspective effect displayed by the
chart. Small values exaggerate the effect and large values diminish it.
Use the XRotation, YRotation, and ZRotation properties to customize the rotation of the
chart. The values are degrees along an axis.
All View3D properties are located on the View3D tab’s General inner tab on the Property
Editor.
Grid lines are a property of an axis, drawn along and perpendicular to it. The grid is drawn
wherever annotation appears on the axis.
Use the GridLines IsOnXYPlane property to add a grid to the XY-plane along the X- or
Y-axis.
Use the IsOnXZPlane property to add a grid to the XZ-plane along the X- or Z-axis.
Use the IsOnYZPlane property to add a grid to the YZ-plane along the Y- or Z-axis.
These properties are located on the Axes tab’s GridLines inner tab on the Property Editor.
Use the GridStyle Pattern property to set the grid line drawing pattern, the Width
property to set the width, and the Color properties to set the line color. The valid patterns
are shown below:
None
Solid
LongDash
Dotted
ShortDash
LongShortLongDash
DashDot
These properties are located on the Axes tab’s GridStyle inner tab on the Property Editor.
Creating a 4D Chart
touring colors for the fourth dimension of chart information. The contour data is locat-
ed on the ChartGroup tab’s Data inner tab on the Property Editor.
The elevation and contour data must have the same origin and the same number of rows
and columns. The row and column deltas must also be identical in both. If these conditions
are not met, a 4D chart is not displayed.
n When a set of contour data is added to a bar chart and the IsZoned ChartGroup
property is set, each bar is drawn with one color (determined by the zoned height of
the bar) instead of being drawn as separate colored segments.
n Contours are never drawn when contour data is added.
For example, the following code sets the third and fourth coordinates of the point in the
second row and first column to 1.55 and 1.75 respectively:
If either of the above conditions are not met, the 4D chart will not be displayed.
To load a previously saved chart description from a file, call the Load method:
Chart3D1.Load "C:\OLECTRA\CHART1.OC3"
Both methods return True if the file operation was successful and False if an error
occurred.
Chart data is normally stored with the other chart properties. If you don’t want the data
saved, set the IsSaved property in the Chart3DData object to False. If you want the chart
data saved to a file, set the FileName property to the name of the file. Saved data can be
loaded from this file using the Load method.
If the IsSaved property is set to True, data is saved with the chart, and the value of the
FileName property is ignored.
Each of these methods enables you to produce a copy of the chart in bitmap format,
metafile format, or enhanced metafile format.
For more details on these methods, refer to the Chart3D object help page.
The following topics explain how to plot, setup, copy and configure your data for use with
Olectra Chart.
197
14.1 Data Overview
The 3D Chart control enables you to add or modify data at runtime.
Data Organization
Data in a chart is organized into chart groups. In 3D Chart, a chart group is represented by
a ChartGroup object. At present, only one chart group can be stored in a chart group
collection.
Within a chart group, the three-dimensional data to be displayed is assumed to come either
from a gridded surface, or from one or more series of points. This data is represented by
the ElevationData property, which is a Chart3DData object. The data displayed can be
in one of three formats:
n Regularly-gridded data, in which the X- and Y-gridlines are evenly spaced
n Irregularly-gridded data, in which the X- and Y-gridlines are not evenly spaced.
n Point data, in which the X, Y and Z coordinates can be specified without restrictions.
To set the data format, set the Layout property to the appropriate data layout constant.
If the Value property for a data point is set to a special value known as the hole value, the
chart treats the data point as a missing value, and does not display it on the chart. This hole
value is specified by the HoleValue property of the Chart3DData object.
For example, the following code treats the point in the third row and first column as a
missing value:
With Chart3D1.ChartGroups(1).ElevationData
.HoleValue = 999.1
.Value(3, 1) = 999.1
End With
When IsBatched is set to True, the chart is not updated when a Chart3DData object
property is changed. Updating does not take place until IsBatched is reset to False.
If the data is regularly-gridded, RowDelta and ColumnDelta each have only one value.
n The Value property specifies the Z-coordinate of a particular data point. This property
is indexed by row and column. For example, the statement
Zval = Chart3D1.ChartGroups(1).ElevationData.Value(1, 3)
assigns the Z-coordinate of the point in the first row and third column to Zval.
To change a data value displayed in the chart, all you need to do is set its Value property.
For example, the following statement changes the value of the point in the third row and
second column to 3.14159:
Chart3D1.ChartGroups(1).ElevationData.Value(3, 2) = 3.14159
For example, the following code adds a fourth row of three points to a chart group:
With Chart3D1.ChartGroups(1).ElevationData
.RowCount = 4
’ set space between third row and fourth row
’ (not necessary if data is regularly-gridded)
The Smooth method passes a center-weighted averaging function over the chart grid,
resulting in a smoother-looking dataset. For example:
Chart3D1.ChartGroups(1).ElevationData.Smooth 0.7
The argument specifies the center weight, and must be between 0 and 1. This method is a
nine-point filter using all points adjacent to the center. Each new value is a weighted
average of the original value and its surrounding points. The weights of the surrounding
points are computed based on the value of the center weight and its distance from the
center point.
The CreateShaded method creates a new Chart3DData object from an existing object,
filling it with a shaded-relief map of the original chart data, suitable for draping over the
original data as the data’s fourth dimension (as described in Displaying 4D Data on page
193.)
The CreateSubset method enables you to create a subset of an existing chart. This method
is passed the following seven arguments:
n The X- and Y-coordinates of the origin of the subset region.
n The X- and Y-coordinates of the endpoint of the subset region.
n The number of X-axis grid lines contained in the region.
n The number of Y-axis grid lines contained in the region.
n The spline interpolation method to use (this must be an interpolation constant)
Drawing 4D Charts
3D Chart enables you to represent four-dimensional plots and bar charts using color as the
fourth dimension. For details, see Displaying 4D Data on page 193.
Individual series are accessed via the PointSeries collection of the Chart3DData object.
The PointSeries collection itself returns a DataCoordCollection of DataCoord objects,
which define the coordinates for the individual points in the series. The following methods
are defined for the DataCoordCollection:
The number of points in the series can be determined via the read-only Count property.
Examples
The following adds a point with coordinates (1, 3, 2) to the second series:
Chart3D1.ChartGroups(1).ElevationData.PointSeries(2).Add 1#, 3#, 2#
Data Points
The coordinates of specific points are accessible via the properties of their respective
DataCoord object. To retrieve the DataCoord object for a coordinate, use the Item
method of the DataCoordCollection. The following code sets the coordinates of the third
point of the second series to (1, 3, 2):
With Chart3D1.ChartGroups(1).ElevationData.PointSeries.Item(3)
.X = 1
.Y = 3
.Z = 2
End With
Note that the Item method is the default method of the DataCoordCollection object, so it is
not necessary to specify the Item method when calling DataCoord methods. The following
sets the y-coordinate of the third point of the first series to 3:
Chart3D1.ChartGroups(1).ElevationData.PointSeries(1)(3).y = 3
In order for Olectra Chart to allocate and load the data from a file, it must be in one of
three basic layouts, Grid, Irregular Grid, or Point. Use the Grid format for surface and bar
charts when the X-coordinates of each point and the Y-coordinates of each point are
always the same distance apart. Use the Irregular Grid format for surface and bar charts
when the X-coordinates of each point or the Y-coordinates of each point are not the same
distance apart. Use the Point format for multiple series of points in scatter plots.
Olectra Chart OCX
See Understanding Data Layout on page 163 for more information on Grid, Irregular
Grid, and Point layout.
The following examples illustrate the Grid, Irregular Grid, and Point file formats.
Lines beginning with a "!" are comments and are ignored by the control.
Line 4 indicates that the file is in the Irregular Grid format, and has 10 by 5 points. Line 5
shows the hole value (100.0). Line 6 contains the 10 X values, and line 7 contains the 5 Y
values.
Lines beginning with a "!" are comments and are ignored by the control.
Line 3 indicates that the file Is in Point format, and has 2 series. Line 6 shows the hole
value (100.0). Line 8 indicates that the first series has 5 points. Lines 10–14 contain the X,
Y, and Z coordinates of the 5 points in the first series. Line 16 indicates that the second
series has 3 points, and the three following lines specify the coordinates of the 3 points.
Lines beginning with a "!" are comments and are ignored by the control.
To allocate and load the data from a file, you can either use the Property Editor’s Load
button, which is located on the Data subtab of the ChartGroup tab, or do it
programmatically. Use the Chart3dData’s Load method to load data from a file:
’ Load the data from a file MMF95.DAT
Chart3d.ChartGroups(1).Data.Load MMF95.DAT
Instead of using the Load method to specify the location of a data file, you can specify a
URL where the chart can find the data. Olectra Chart provides two different methods to
load data from the Internet:
n Use the Chart3D Object’s LoadURL method to load a chart description file (.OC3).
n Use the Chart3DData Object’s LoadURL method to load a data file (.DAT) into an
existing chart.
In addition, if you want to set a URL location but do not want to load the data, use the
Chart3DData Object’s Datapath property. This property can be set at design time, and
used to initialize the chart data at run-time.
The following copying data methods are defined by the Chart3DData Object:
CopyZArrayIn(array)
CopyZArrayOut(array)
Copies the Z values from the chart into an array. array must be a two-dimensional array of
singles, doubles, longs or integers.
When double buffering is turned on, every time the chart changes, it will:
n Allocate (if necessary) and clear an off-screen bitmap.
n Render the complete graph to the off-screen bitmap.
Olectra Chart OCX
When double buffering is turned off, the chart clears the screen image every time a chart is
changed (possibly causing a visual flash). Then, it renders the complete image to the
visible window (possibly allowing the user to see the chart being drawn piece by piece).
Turning off double buffering can improve the chart’s graphing performance and reduce its
memory requirements.
When the chart data and axes are formatted properly, you can customize its elements to
make it clearer and professional-looking. The following topics cover tasks that customize
the appearance of a chart.
207
15.1 Adding Header and Footer Titles
A chart can have two titles, called the header and footer. A title consists of one or more
lines of text with an optional border, both of which you can customize. You can also set
the text alignment, positioning, colors, and font used for the header or footer.
Use the Text title property to add, change, or remove text for a title. Text is located on the
Titles tab’s Label inner tab on the Property Editor. To enter multiple lines of text, press
Enter between each line.
Use the Adjust title property to specify whether to center, left-justify, or right-justify a
multi-line title. Adjust is located on the Titles tab’s General inner tab on the Property
Editor.
Title Positioning
Use the Left and Top location properties to customize the location of the title. When their
IsDefault properties are used, the header is centered over the ChartArea and the footer is
centered below the ChartArea. These properties are located on the Titles tab’s Location
inner tab on the Property Editor. See Positioning Chart Elements on page 219 for more
information.
Title Border
Use the Type and Width border properties to customize the title’s border. These properties
are located on the Titles tab’s Border inner tab on the Property Editor. See Using Borders
on page 214 for more information.
Title Colors
Use the interior properties to customize background and text colors of a title. These are
located on the Titles tab’s Interior inner tab on the Property Editor. See Setting Colors on
page 218 for more information.
Olectra Chart OCX
Title Font
Use the font properties to customize the font used for a title. These are located on the
Titles tab’s Font inner tab on the Property Editor. See Choosing Fonts on page 215 for
more information.
Surface Colors
Use the IsSolid Surface property to make a 3D surface appear solid. The chart draws a
“skirt” around the data to the minimum Z-value. IsSolid is located on the Surface tab’s
General inner tab on the Property Editor.
Use the ZoneMethod Contour property to specify how to determine each zone region.
Contour zoning uses the contour intervals for each zone region, while cell zoning uses the
rectangular block formed by the X/Y grid. Cell zoning produces a coarser-looking surface
but redraws significantly faster than contour zoning. ZoneMethod is located on the
ChartGroup tab’s General inner tab on the Property Editor.
Use the legend Type property to specify whether to draw the legend in a continuous or
stepped style. Continuous legends take less space on the screen than stepped. Type is
located on the Legend tab’s General inner tab on the Property Editor.
Olectra Chart OCX
Use the legend Orientation property to lay out the legend horizontally or vertically, and
the IsReversed property to specify whether to display the SeriesLabels in reverse order.
These properties are located on the Legend tab’s General inner tab on the Property Editor.
Use the legend Anchor property to specify where to position the legend relative to the
ChartArea. You can select from eight compass points around the ChartArea. Anchor is
located on the Legend tab’s General inner tab on the Property Editor.
Use the Left and Top location properties to finetune the positioning. When their IsDefault
properties are used, the chart automatically positions the legend. These properties are
located on the Legend tab’s Location inner tab on the Property Editor. See Positioning
Chart Elements on page 219 for more information.
Legend Title
Use the legend Text property to specify the legend title. The legend title appears centred at
the top of the legend. Text is located on the Legend tab’s Title inner tab on the Property
Editor.
Use the legend Labels property to define a set of custom legend labels used instead of the
automatically-generated numeric labels. When no labels exist, the chart displays the
automatic legend. The first label applies to the first contour level, and so on. Examine the
value of the Levels Contour property to determine the number of legend labels you need to
define. Labels is located on the Legend tab’s Labels inner tab on the Property Editor.
Legend Border
Use the Type and Width border properties to customize the title’s border. These properties
are located on the Legend tab’s Border inner tab on the Property Editor. See Using
Borders on page 214 for more information.
Legend Colors
Use the interior properties to customize background and text colors of the legend. These
are located on the Legend tab’s Interior inner tab on the Property Editor. See Setting
Legend Font
Use the font properties to customize the font used for the legend. These are located on the
Legend tab’s Font inner tab on the Property Editor. See Choosing Fonts on page 215 for
more information.
Specifying Labels
To specify your own labels for a legend, access the Labels property of the Legend object
and call its Add method. For example, the following code creates a set of three legend
labels:
With Chart3D1.Legend.Labels
.Add "First"
.Add "Second"
.Add "Third"
End With
Legend Type
Note that zones are numbered from the bottom up: the first zone label is associated with
the zone appearing at the bottom of the legend, and so on upwards.
The Legend object’s LabelFilter property allows you to specify how many legend labels
to display. When LabelFilter is set to n, every nth label will be drawn.
Olectra Chart OCX
The LabelFilter property is located on the Legend tab’s Labels inner tab on the Property
Editor.
When the Distribution Table specifies contour levels outside the span of the data, the
Legend object’s DistributionRange property controls whether they appear in the legend.
When DistributionRange is set to oc3dDistributionRangeData, only the range of
contour levels in the Distribution Table spanned by the data appear in the legend. When
DistributionRange is set to oc3dDistributionRangeAll all contour levels specified in the
Distribution Table appear in the legend. The DistributionRange property appears as
Range on the Property Editor, and is located on the Legend tab’s General inner tab.
Mesh Filtering
The ColumnMeshFilter and RowMeshFilter properties are located on the Surface tab’s
General inner tab on the Property Editor.
Mesh Transparency
Use the IsTransparent ChartGroup property to make the mesh transparent. The effect is
only visible when the chart is not shaded (controlled by the IsShaded property). When
transparent, everything behind the mesh shows through, including the walls and axes on
the PlotCube and other parts of the mesh. IsTransparent is located on the ChartGroup
tab’s General inner tab on the Property Editor.
Mesh Colors
Use the MeshBottomColor and MeshTopColor Elevation properties to set the mesh
colors. These properties are located on the ChartGroup tab’s Elevation inner tab on the
Property Editor.
Olectra Chart OCX
The valid border types are shown below; you can also specify that no border is used.
Use the border Type property to set the type of border and the Width property to set its
thickness. These properties are located on the Border inner tab, found on the Control,
ChartArea, Titles, Legend, and ChartLabels tabs of the Property Editor.
Legend
Use the font properties to set the font, style, and size attributes. Font properties are located
on their own dialog on the Font inner tab, found on the Titles, Legend, and ChartLabels
tabs on the Property Editor. Click the button on the tab to display the dialog.
Use the Chart3D object’s UseTrueType property to specify whether to use TrueType
fonts for Axis annotation, Axis titles, and ChartLabels. If UseTrueType is True, TrueType
fonts are used. If UseTrueType is False, Cube fonts are used for Axis annotation and Axis
titles. When UseTrueType is False, which type of font a ChartLabel uses depends on how
it is attached to the chart. See Using ChartLabels on page 220 for more information.
Use the CubeFont object’s TrueType property to specify the font, style, and size
attributes of TrueType fonts. Use the CubeFont object’s Stroke property to specify which
cube font to use and the Size property to set its height. Size is measured in thousandths of
the PlotCube length, for example, a value of 80 means the characters are 8% of the length
of the PlotCube height. The following shows the valid cube fonts:
RomanComplex RomanComplexSmall
These properties are located on the Font inner tab of the ChartLabels tab, the Title inner
tab of the Axes tab, and the Font inner tab of the Axes tab on the Property Editor.
Notes
n Olectra Chart uses the container’s exposed Ambient font (if available) as its own
default font.
n The Color control in the font chooser dialog has no effect on the text color. To set the
The mesh, contour lines, surface shading, and zone fills also have color properties you can
customize.
You can specify a color as one of over 200 recognized named colors. Choose common
colors like Blue or Orange, or more exotic colors like Chartreuse or HotPink. Most of
these colors look best on systems that can display 256 colors or more.
You can choose colors interactively using a color chooser dialog that works just like the
standard Windows Control Panel color chooser. Choose from Windows basic colors,
custom colors, or interactively with a full color spectrum.
Alternately, you can specify a color by its RGB components, useful for matching another
RGB color. RGB color values combine hexadecimal values for the red, green, and blue
components of a color. “00” is the smallest value a component can have; “ff” is the largest
Olectra Chart OCX
value. For example, “#ff00ff” specifies magenta (the maximum value of red and blue
combined with no green).
The background and foreground of all elements except the chart itself can be “Automatic”.
When a background or foreground is automatic, the chart uses the color of the element
outside it for the background. For example, the header would have the background of the
chart itself when its background is set to Automatic.
To change a color
When the chart controls positioning, it first allows space for the header, footer, and legend,
if they exist (size is determined by contents, border, and font). The ChartArea is sized and
positioned to fit into the largest remaining rectangular area. Positioning adjusts when other
chart properties change.
Use the Left location property to specify the number of pixels from the edge of the chart to
the left edge of the chart element. Use the Top location property to specify the number of
pixels from the edge of the chart to the top of the chart element. Left and Top have
IsDefault properties that allow the chart to automatically position the element.
These properties are located on the Location inner tab, found on the ChartArea, Titles,
Legend, and ChartLabels tabs of the Property Editor.
Use the Width and Height location properties to specify the width and height of the
ChartArea. These properties have IsDefault properties that allow the chart to
automatically size the ChartArea.
These properties are located and enabled on the ChartArea tab’s Location inner tab on
To adjust the size of a Chart3D object when the Form object is resized, define a Resize
procedure for the form, and adjust the chart’s height and width to correspond to the form’s
height and width. Here is a sample Resize procedure:
Private Sub Form_Resize()
’ Match the graph to the size of the form.
If Width > 700 Then ’ Check the width of the window
’ This keeps a consistent border around the sides of the chart
Chart3D1.Width = Width - 700
Else
’ Sets the width to 0 because the window
’ is smaller than the size of the chart
Chart3D1.Width = 0
End If
The height and width of both the form and the chart are measured in twips (1,440 twips
equals one inch). To convert twips to pixels, use the following code:
pixwidth = Chart3D1.Width / Screen.TwipsPerPixelX
pixheight = Chart3D1.Height / Screen.TwipsPerPixelY
Olectra Chart OCX
There is no limit to the number of ChartLabels a chart can contain. Each ChartLabel has
label, interior color, border, fonts, and attachment attributes that you can customize.
When you define a ChartLabel, you need to specify how and where to attach it to the chart.
The attachment method determines the basic appearance of the ChartLabel. The best
method depends on what you are using the ChartLabel for. The following illustrates and
describes the attachment methods:
Use the AttachMethod ChartLabel property to set the attachment method, and the
AttachCoord, AttachDataCoord, or AttachDataIndex properties to set the attachment
point. These properties are located on their own dialog on the ChartLabels tab’s Attach
Use the IsConnected property to draw a line connecting the ChartLabel to its attachment
point. IsConnected is located on the ChartLabels tab’s General inner tab on the Property
Editor.
Use the HorizontalOffset and VerticalOffset properties to set the distance between the
ChartLabel and its attachment point. They have no effect when displaying a 3D surface or
bar chart. These properties are located on the ChartLabels tab’s Attach inner tab on the
Property Editor.
Use the Text label property to set or change a ChartLabel’s text. Text is located on the
ChartLabels tab’s Label inner tab on the Property Editor. To enter multiple lines of text,
press Enter between each line.
Use the Adjust property to specify whether to center, left-justify, or right-justify a multi-
line ChartLabel. Adjust is located on the ChartLabels tab’s General inner tab on the
Property Editor.
ChartLabel 3D Plane
When displaying a 3D surface or bar chart, use the Plane property to set which plane to
face the ChartLabel. You can select either the XZ or YZ plane. Plane is located on the
ChartLabels tab’s General inner tab on the Property Editor.
ChartLabel Border
When attached by DataCoordinates or DataIndex, the border is a fixed thin line and
cannot be customized. When attached by Coordinates, you can use the Type and Width
border properties to customize the ChartLabel’s border. These properties are located on
the ChartLabels tab’s Border inner tab on the Property Editor. See Using Borders on
page 214 for more information.
ChartLabel Colors
Use the interior properties to customize background and text colors of a ChartLabel. These
are located on the ChartLabels tab’s Interior inner tab on the Property Editor. See Setting
Colors on page 218 for more information.
ChartLabel Fonts
A ChartLabel has both a TrueType font and a CubeFont property. When the Chart3D
object’s UseTrueType property is True, all ChartLabels use TrueType fonts. When the
Chart3D object’s UseTrueType property is False, if the ChartLabel is attached by
Olectra Chart OCX
The ChartLabel object provides a number of properties that help you define and position
the chart label. The most important of these properties are the following:
n The Text property specifies the text to appear in the chart label, and is of type Label.
n The Plane property specifies the orientation of the chart label. The orientation is
specified as a plane constant.
n The IsConnected property is a Boolean which specifies whether a line is to be drawn
from the chart label to its attached location. If True, the line is drawn.
To attach a chart label to a particular grid index, set the AttachMethod property to
oc3dTextAttachDataIndex, and then set the AttachDataIndex property to the index
values for that particular grid location. For example, the following attaches a chart label to
the point at the second row and third column:
With Chart3D1.ChartLabels(1)
.AttachMethod = oc3dTextAttachDataIndex
.AttachDataIndex.Row = 2
.AttachDataIndex.Column = 3
End With
To attach a chart label to pixel coordinates on the chart, set the AttachMethod property to
oc3dTextAttachCoord, and then set the AttachCoord property to the desired pixel
coordinates. For example, the following attaches a chart label to the pixel coordinates
(100, 100):
With Chart3D1.ChartLabels(1)
.AttachMethod = oc3dTextAttachCoord
.AttachCoord.X = 100
.AttachCoord.Y = 100
End With
The following is the object hierarchy for the ChartLabels collection and the properties
described above:
Chart3D
ChartLabel
AttachCoord
Coord Object
Attach DataCoord
DataCoord Object
AttachDataIndex
DataIndex Object
Olectra Chart OCX
To improve efficiency, you can batch changes to a chart label. To do this, set the
IsBatched property to True before changing any chart label properties, and set IsBatched
to False once you have finished. This ensures that the chart will be updated only once,
instead of after each property change.
Every ContourStyle has a FillStyle and a LineStyle. FillStyles are used for zoning colors.
LineStyles are used for contour lines. Most charts will not need to customize
ContourStyles. Situations where you will need to customize them include:
n When it is important in your chart to control the precise ContourStyle for any
particular level;
n When you need to display more than 100 levels; or
n When you want to uniquely identify contour lines. The built-in styles use the same
LineStyle for every ContourStyle.
Use the Color properties to set the fill color for a ContourStyle. These properties are
located on the Styles tab’s FillStyle inner tab on the Property Editor.
Use the Pattern property to set the line drawing pattern, the Width property to set its
width, and the Color properties to set the line color for a ContourStyle. The valid patterns
are shown below:
None
Solid
LongDash
Dotted
ShortDash
LongShortLongDash
DashDot
These properties are located on the Styles tab’s LineStyle inner tab on the Property Editor.
Use the Load and Save buttons on the Styles tab’s General inner tab on the Property
Editor to load and save sets of ContourStyles. Olectra Chart includes sample contour
styles suitable for various kinds of charts.
To Reset ContourStyles
Use the ResetStyles button on the Styles tab’s General inner tab on the Property Editor to
return to the chart’s 100 built-in styles.
Olectra Chart OCX
Chart3D Legend
Object
ChartGroups Collection
Contour
Styles
ContourStyles
collection
Each ContourStyle object in this collection defines two properties which specify the
appearance of a particular contour line or zone in a chart:
n The FillStyle property is a FillStyle object, and specifies the color of the zone
associated with this contour style.
n The LineStyle property is a LineStyle object, and specifies the width, color and
pattern of the contour line associated with this contour style. By default, each line is
one pixel wide and is a solid black line.
A total of 100 contour styles are defined by default. To add additional contour styles, use
the Add method.
Note that the nth contour line or zone in a chart is normally not associated with the nth
contour style in the ContourStyles collection. The relationship between distribution levels
(contour lines/zones) and the ContourStyles collection is as follows: if nstyles contour
For example, if 100 contour styles and 6 distribution levels are defined, the distribution
levels use the 1st, 21st, 41st, 60th, 80th and 100th elements of the ContourStyles
collection, respectively. (The number of distribution levels is specified by the NumLevels
property of the ContourLevels object.) Normally, you will not need to calculate the
contour style index yourself, as the CalcIndex method (described below) calculates it for
you.
To force a one-to-one matchup between contour styles and distribution levels, create an
array of contour styles with the same number of elements as there are distribution levels.
(If you have specified that zone regions are to be drawn, your array of contour styles must
contain one more element than the number of distribution levels. Zone regions are
To find the ContourStyle object associated with a particular contour line or zone, use the
CalcIndex method. For example, the following retrieves the ContourStyle object for the
third contour line:
Dim Index As Long
With Chart3D1.ChartGroups(1).Contour
Index = .Styles.CalcIndex(3)
End With
You can use this approach to change the attributes of individual zones or contour lines. For
example, to change the color for a particular zone, change the Color property of the
FillStyle object. The following statements change the first zone color to green:
Dim Index As Long
With Chart3D1.ChartGroups(1).Contour
Index = .Styles.CalcIndex(1)
.Styles(Index).FillStyle.Color = RGB(0, 128, 0)
End With
To change the line width, color and pattern for a contour line, change the Width, Color
and Pattern properties of the LineStyle object. For example, the following statements
change the second contour line to a dotted green line which is 5 pixels wide:
Dim Index As Long
With Chart3D1.ChartGroups(1).Contour
Index = .Styles.CalcIndex(2)
With .Styles(Index).LineStyle
.Width = 5
.Color = RGB(0, 128, 0)
.Pattern = oc3dLineDotted
End With
End With
The customized contour style table resulting from these changes can be saved into a file
using the Save method, and restored from a file using the Load method. This enables you
Olectra Chart OCX
To revert to the default contour style behavior, invoke the Reset method. All contour
styles will be reset to their default values.
Use the FileName property to specify the name and location of the image you want to
display. The image must be in either Windows bitmap or Metafile format. Use the
IsEmbedded property to include the specified image with the chart. If IsEmbedded is
true, the image will be included with your chart. If IsEmbedded is False, the chart will
look for the image file in the specified location.
Use the Layout property to specify how the image is to be displayed. You can set Layout
to one of the following:
n Centered - places the image in the center of the chart element
n Fitted - resizes the image to fit as much of the chart element as possible, while
maintaining the image’s aspect ratio (so that the image remains in proportion)
n Stretched - resizes the image to fit the entire chart element area
n Stretch to Width - stretches the image horizontally to match the chart element width
n Stretch to Height - stretches the image vertically to match the chart element height
n Tiled - repeats the image to fill the entire chart element
These properties are located on the Control, ChartArea, Legend, ChartLabels, and
Titles Image Tab.
For example, the following statement projects zones onto the ceiling of the plot cube:
Chart3D1.ChartArea.PlotCube.Ceiling.Projection.IsZoned = True
The following is the complete object hierarchy for contour and zone projection on the plot
cube ceiling or floor:
Is Chart3D
ChartArea
PlotCube
Olectra Chart OCX
Ceiling
IsContoured
Projection and IsZoned
properties
Floor
IsContoured
Projection and IsZoned
properties
The contour and zone settings used in these projections are set by the Contour object
defined for that chart group.
Contour and zone projection are ignored in two-dimensional charts and bar charts.
Overview
To generate contours and zones, the chart analyzes the data and based on the number of
levels specified, creates the following:
n A linear distribution table that contains the Z-value that marks each level.
n An assignment of ContourStyles from the chart’s 100 built-in styles. The chart
determines which styles to use by evenly distributing its 100 styles through the
number of levels.
Use the NumLevels ContourLevels property to set the number of contour levels to use.
This has no effect when the chart is using a custom distribution table. You can specify up
to 100 levels; the more levels you use, the finer the distribution table. NumLevels is
located (as Levels) on the Levels tab’s General inner tab on the Property Editor.
When a linear distribution table does not suit the needs of your chart, you can create or
load a custom table that sets the number of levels and the value used to mark each level.
Olectra Chart includes sample distribution table files that you can use as templates to build
a table that suits your chart.
Use the Load and Save buttons on the Levels tab’s General inner tab on the Property
Editor to load and save distribution tables.
Chart3D Legend
Object
ChartGroups Collection
Contour
Levels
ContourLevels Object
By default, distribution levels are evenly spaced. To define your own distribution levels
and spacing, use the Add method to create them. For example, the following code defines
distribution levels at 1000, 2500 and 4200:
With Chart3D1.ChartGroups(1).Contour.Levels
.Add 1000#
.Add 2500#
.Add 4200#
End With
A list of distribution levels can also be saved to a file using the Save method, and reloaded
from a file using the Load method.
Olectra Chart OCX
At any time, you can revert to evenly spaced distribution levels by setting the IsDefault
property to True. The number of distribution levels in the chart will not change when you
do this.
3D Chart defines a contour style for each distribution level. This contour style specifies
the width, color and pattern of the contour line associated with this contour style, and the
color of the associated zone.
The ContourStyles collection defines the contour styles for a particular chart group. To
retrieve the contour style for a particular distribution level, use the CalcIndex method. For
example, the following retrieves the contour style for the third distribution level:
Dim Index As Long
With Chart3D1.ChartGroups(1).Contour
Index = .Styles.CalcIndex(3)
End With
Bar Z Origin
Use the axis Origin property to set the origin of the Z-axis. It is only used with bar charts.
Origin is located on the Axes tab’s General inner tab on the Property Editor.
Use the bar RowSpacing and ColumnSpacing properties to set the space used by each
bar. The value represents the percentage of available space, with valid values between 0
and 100. When 100, the bars touch one another. These properties are located on the
ChartGroup’s Bar inner tab on the Property Editor.
When a bar chart is shaded but not zoned, bars drawn above the Z-origin use the surface
top color and bars drawn below the Z-origin use the surface bottom color. You can
arbitrarily set the color of one bar or entire rows and columns of bars. To define colors that
appear in the legend, you need to create a 4D chart; see Creating 4D Charts on page 192
for more information.
Use the DataColor properties to define custom bar colors. Each color is defined by a row
index, a column index, and the color to use. To set a color for an entire row, specify 0 as
the column index. To set a color for an entire column, specify 0 as the row index.
Use the Elevation object’s HasDropLines property to specify whether or not drop lines
appear between the plotted points and the origin. Each point in a scatter plot has a drop
Changing ChartStyles
The attributes that define how a series of data looks in the scatter plot are called a
ChartStyle. Each series has its own ChartStyle, which you can customize. The ChartStyle
object allows you to programmatically change the following properties of a series:
n The Line property, which defines the line style for the object. This specifies the color,
pattern and thickness of drop lines. This property is of type LineStyle.
n The Symbol property, which defines the symbol style for the object. This specifies the
color, size and shape of points. This property is of type SymbolStyle.
Olectra Chart OCX
The following sets the line pattern for the second series to a dotted line:
Chart3D1.ChartGroups(1).Styles(2).Line.Pattern = oc3dLineDotted
And the following statement sets the symbol style for the third series to an unfilled circle:
Chart3D1.ChartGroups(1).Styles(3).Symbol.Shape = oc3dShapeCircle
The ChartStyles collection contains the ChartStyle objects defined for each series. The
following methods are defined for the ChartStyles collection:
By looping through the ChartStyles collection, you can quickly change the behavior of all
of the lines or points in a chart. For example, the following code lightens all of the points
in a chart whenever the mouse is clicked:
Private Sub Chart3D1_Click()
Dim Style As Object
For Each Style in Chart3D1.ChartGroups(1).Styles
Style.Shape.Color = Style.Shape.Color + &H50505
Next Style
End Sub
Use the Line Pattern property to set the line drawing pattern, the Width property to set its
width, and the Color properties to set the line color for a ChartStyle. The valid patterns are
shown below:
None
Solid
LongDash
Dotted
ShortDash
LongShortLongDash
DashDot
These properties are located on the ChartStyles tab’s LineStyle inner tab on the Property
Formatting Symbols
Use the Symbol Shape property to set the symbol type, the Size property to set its size,
and the Color properties to set the symbol color for a ChartStyle. The valid symbols are
shown below:
Box Cross
Triangle Circle
These properties are located on the ChartStyles tab’s SymbolStyle inner tab on the
Property Editor.
Olectra Chart OCX
Olectra Chart allows you to interact with the user, reacting to specific mouse, menu and
keyboard actions. You can also determine which tabs from the Property Editor you want
users to see. The following topics cover the different types of user interaction.
237
16.1 Programming Actions
A chart action is a user event that causes some interactive action to take place in the
control. There are three stages of user interaction defined in 3D Chart:
n Starting a user interaction
n Updating a user interaction
n Ending a user interaction
Chart actions are defined for each of these stages. The complete list of actions is specified
by the Action Constants.
Action Maps
An action map is a mapping of a mouse operation and/or key pressing to a chart action.
Each action map consists of three parts:
n The message (indicating what mouse operation or key pressing occurred)
n Any modifier flags
n The keycode (if the message is WM_KEYDOWN or WM_KEYUP)
The ActionMaps collection specifies the action maps currently defined for the 3D Chart
control.
Recognized Messages
Modifier Flags
Recognized Keycodes
Any valid VK_ value is treated as a recognized keycode. Note the following, however:
n Αll alphabetic characters are forced to upper case.
n MK_SHIFT must appear in the modifier if capitals are desired.
n The CapsLock key toggles the meaning of the MK_SHIFT modifier.
To determine which action is mapped to a particular Microsoft Windows message, use the
Item property, which is defined by the ActionMaps collection. For example, the
following statement returns the action performed when the left mouse button is clicked:
Dim LeftMouse As Object
To program an action mapping, use the Add method to add the new action mapping to the
collection.
All 3D Chart actions are can be customized: you can determine which Microsoft Windows
message will call a particular action, and decide on the appropriate steps to perform in
each case.
To remove an existing action mapping, use the Remove method to remove the action
mapping from the collection:
With Chart3D1.ActionMaps
.Remove WM_LBUTTONDBLCLK, 0, 0
End With
To call an action directly, call the CallAction method, which is defined by the Chart3D
object. This method is passed the action to be performed and the X- and Y- coordinates of
a window location.
For examples of code using CallAction, refer to the actions demo provided with your
Olectra Chart distribution.
Each of the actions defined in the Action Constants maps to a 3D Chart event method. The
following mappings are defined:
oc3dActionModifyStart ModifyStart()
oc3dActionModifyEnd ModifyEnd()
oc3dActionModifyCancel ModifyEnd()
oc3dActionRotate View3DModify()
oc3dActionScale ViewportModify()
oc3dActionTranslate ViewportModify()
oc3dActionZoomStart ModifyStart()
oc3dActionZoomUpdate no event method called
oc3dActionReset ModifyStart(),
ViewportModify(), ModifyEnd()
oc3dActionProperties property pages are displayed
The event methods are defined in the Event Reference section. Note that some actions
trigger multiple events.
To determine the pixel coordinates of a given data point, call DataIndexToCoord. For
example, the following code obtains the pixel coordinates of the point in the second row
and third column:
Olectra Chart OCX
If the data coordinate is out of the visible range of the chart, both of the pixel X- and Y-
coordinates are set to -1.
CoordToDataCoord returns, as its return value, the region of the chart in which the pixel
coordinates are located. This region is represented as a region constant.
To determine the closest data point to a set of pixel coordinates, call CoordToDataIndex:
CoordToDataIndex returns the row and column of the closest data point, and also returns
the distance in pixels between the pixel coordinates and the point. CoordToDataIndex
returns, as its return value, the region of the chart in which the pixel coordinates are
located. This region is represented as a region constant. When the returned region is
oc3dRegionInLegend, the returned point value is also set to oc3dRegionInLegend, and
the returned series is the closest element in the legend.
The DragZValue method can be used to interactively drag a point to a new coordinate, as
in the surface demo program.
The SurfaceValue method enables you to determine the Z-value of any point on the chart
surface. For example, the following code determines the Z-value of the data coordinates
(106,84):
Dim Zvalue As Double
...
With Chart3D1.ChartGroups(1)
Zvalue = .SurfaceValue 106, 84
End With
In Visual Basic, coordinate values are measured in twips (1,440 twips equals one inch).
The following code converts the height and width of a chart from twips to pixels:
pixwidth = Chart3D1.Width / Screen.TwipsPerPixelX
pixheight = Chart3D1.Height / Screen.TwipsPerPixelY
Use the ShowChartEditorElement method to set the display state of the Property Editor
tab. The following example hides the Control tab and the Title subtab of the Axes tab:
Chart3d1.ShowChartEditorElement oc3dceeControl, False
Chart3d1.ShowChartEditorElement oc3dceeAxesTitle, False
You can add the Olectra Chart 3D control to a web page. Steps 1-5 provide detailed
information on the tools you need, how to insert the control, how to create the license pack
file, how to optimize the download process and what to look for when testing the web
page.
245
17.1 Getting Started
Before you can add Olectra Chart to your web page, you will need the following tools:
Microsoft ActiveX SDK - Use this SDK to create the License Pack File (.LPK) that users
will download when viewing a web page containing an Olectra Chart ActiveX control.
You can download the ActiveX SDK from:
http://www.microsoft.com/msdownload/sbndownload/sbnaxsdk/sbnaxsdk.htm
Microsoft Cabinet SDK - Use this SDK to create the Cabinet file which stores all the
files to be downloaded. Creating a .CAB file helps to minimize the download time, and to
keep all downloaded files together. You can download the Cabinet SDK from:
http://www.microsoft.com/workshop/prog/cab
When this HTML code is processed, the browser checks to see if Olectra Chart is
registered on the computer where the page is being browsed from, and if not it will
download and register the control.
If you want to specify a version the control to check for, add the Version element. This will
avoid such problems as using new functionality with a prior version of the control. The
following example shows how to specify the control version to search for:
<OBJECT ID="Chart3D1" WIDTH=473 HEIGHT=352
CLASSID="CLSID:3D931501-4601-11CF-80B2-0020AF19EE14 "
CODEBASE="http://www.yoursite.com/olectra.cab#Version=5,0,0,0">
</OBJECT>
<SCRIPT LANGUAGE="VBScript">
Sub Window_OnLoad()
Chart3D1.ChartArea.Axes("X").MajorGrid.IsOnXYPlane = True
Chart3D1.ChartArea.Axes("X").MajorGrid.IsOnXZPlane = True
Chart3D1.ChartArea.Axes("Y").MajorGrid.IsOnXYPlane = True
Chart3D1.ChartArea.Axes("Y").MajorGrid.IsOnYZPlane = True
Chart3D1.ChartArea.Axes("Z").MajorGrid.IsOnXZPlane = True
Chart3D1.ChartArea.Axes("Z").MajorGrid.IsOnYZPlane = True
Chart3D1.ChartGroups(1).ChartType = 1 ’Bar
Chart3D1.ChartGroups(1).Elevation.IsMeshed = True
Chart3D1.ChartGroups(1).Elevation.IsShaded = True
Chart3D1.ChartGroups(1).Elevation.ShadedTopColor = RGB(&HFF, &HF8,_
&HDC)
Chart3D1.ChartGroups(1).ElevationData.RowCount = 3
Chart3D1.ChartGroups(1).ElevationData.ColumnCount = 4
Chart3D1.ChartGroups(1).ElevationData.Value(1, 1) = 1.32608
Chart3D1.ChartGroups(1).ElevationData.Value(1, 2) = 1.4186
Chart3D1.ChartGroups(1).ElevationData.Value(1, 3) = 1.49956
Chart3D1.ChartGroups(1).ElevationData.Value(1, 4) = 1.56597
Chart3D1.ChartGroups(1).ElevationData.Value(2, 1) = 1.34446
Chart3D1.ChartGroups(1).ElevationData.Value(2, 2) = 1.43709
Chart3D1.ChartGroups(1).ElevationData.Value(2, 3) = 1.5124
Chart3D1.ChartGroups(1).ElevationData.Value(2, 4) = 1.56768
Chart3D1.ChartGroups(1).ElevationData.Value(3, 1) = 1.35423
Chart3D1.ChartGroups(1).ElevationData.Value(3, 2) = 1.44188
Chart3D1.ChartGroups(1).ElevationData.Value(3, 3) = 1.50643
Chart3D1.ChartArea.PlotCube.XScale = 180
Chart3D1.ChartArea.PlotCube.YScale = 180
Chart3D1.ChartArea.PlotCube.Interior.BackGroundColor = RGB_
(&HD2, &HB4, &H8C)
End Sub
</SCRIPT>
Notes:
n The CLSID (pronounced Class ID) specified above is for the 32-bit Olectra Chart 3D.
For information on adding a 2D control, see Adding an Olectra Chart 2D Control to a
Web Page on page 139.
Using the LoadURL method, you can load data or a chart description file (.OC3 and
.OC2) directly from a URL instead of adding it programmatically. If you want to load an
entire chart, use the Chart3D object’s LoadURL method. If you just want to load data
into an existing chart, use the ChartData object’s LoadURL method. Both of these
methods have a single parameter, URLname, which is a string representing the URL where
the file you want to load is located.
The following two examples illustrate the different uses of the LoadURL method from
within an HTML file:
<SCRIPT LANGUAGE="VBScript">
If you have a registered version of Olectra Chart 1.1 on your computer, browsing to a web
Olectra Chart OCX
site containing version 6.0 of the control may cause problems. If the <OBJECT> tag is set to
require Olectra Chart 6.0, the control will download and re-register itself as the current
control. For this reason it is highly recommended that you do not browse locations
containing version 6 of the control on your 1.1 development machine.
To restore Olectra Chart 1.1 as the version on your computer, do the following:
1. Unregister Olectra Chart 6.0. Internet Explorer caches all downloaded ActiveX com-
ponents within a directory called OCCACHE that exists directly under the WIN-
DOWS or WINNT root directories. In that directory, type at the command prompt:
Regsvr32 /u olch3x32.ocx
2. Remove the files downloaded by version 6.0. If you wish to remove Olectra Chart
from your computer, you only need to delete the files in the OCCACHE directory that
correspond to the ones listed in the .INF file.
After creating the .LPK file, you must add the following lines in your HTML page, before
the <OBJECT> tag used to describe Olectra Chart. In this example, replace filename.lpk
with the name of your pack file:
<OBJECT CLASSID = "clsid: 5220cb21-c88d-11cf-b347-00aa00a28331">
<PARAM NAME="LPKPath" VALUE="filename.lpk">
</OBJECT>
Notes:
n You must have a registered version of Olectra Chart on your computer to successfully
generate a .LPK file.
n The reference to the resulting .LPK file that you create must be placed on your HTML
page before references to any of your ActiveX controls.
n If your .LPK was created with only Olectra Chart in it, it should be 878 bytes. If it is
smaller, the license pack file was not created properly.
In order for your browser to correctly load and run Olectra Chart you must create an .INF
file that lists all of the control’s dependencies. Create a text file with the suffix .INF that
[olch3x32.ocx]
File=thiscab
Clsid={3D931501-4601-11CF-80B2-0020AF19EE14}
[mfc40.dll]
File=http://www.yoursite.com/yourdemo/mfc40.cab
[msvcrt40.dll]
File=http://www.yoursite.com/yourdemo/msvcrt40.cab
Notes:
n Italicized characters in the above example should be replaced with the URL where
these .CAB files will be located on your web server.
n Many users may already have the MFC40.DLL and MSVCRT40.DLL files available
on their computers from prior software installations, so this .INF file will instruct
Internet Explorer to download them only if necessary.
To minimize download time, compress these files individually using cabarc.exe. For more
information, see the following section, Creating a .CAB File.
the download requirements for the ActiveX controls embedded within your HTML
page.
To create a CAB file that contains the Olectra Chart OCX, DLL and the .INF file,
type:
cabarc n olectra.cab olch3x32.ocx olectra.inf
2. Find the place in the HTML on your Web page where the Olectra Chart control is ref-
erenced. (There should be an <OBJECT> tag with a CLASSID that matches the 32-bit
Olectra Chart 3D CLSID. Edit the HTML and add a Codebase element with the suit-
able web site URL and CAB file name.
For example:
<OBJECT ID="Chart3D" WIDTH=313 HEIGHT=225
CLASSID="CLSID: 3D931501-4601-11CF-80B2-0020AF19EE14"
CODEBASE="http://www.yoursite.com/olectra.cab">
</OBJECT>
Here is a very simple .HTML file that displays a 3D chart control. In particular, note the
class IDs for the license pack file and the chart control:
<HTML>
<HEAD>
<meta http-equiv="Content-Type"content="text/html; charset=iso-8859-1">
<TITLE>Home Page</TITLE>
</HEAD>
<p>
</OBJECT>
</BODY>
</HTML>
Once you have created the .LPK and .CAB files, copy them to the server where your web
page is. The .LPK file must be in the same directory as the HTML file that references it.
The .CAB file must be in the directory that is specified in the <OBJECT> tag. For example,
in the above HTML code, the file OLECTRA.CAB would go in the root directory of the
server where www.yoursite.com is located.
You may get a sequence of dialog boxes depending on the security level that your copy of
Internet Explorer is set to. You can change these settings by doing the following:
1. On the View menu, click Options. The Options dialog appears.
2. Click the Security tab.
3. Click the Safety Level button.
4. The choices for Security Level are High, Medium, None. The default for Internet Ex-
plorer is High, so controls that have not been digitally signed will not be downloaded.
Olectra Chart 6.0 is signed.
Internet Explorer caches all downloaded ActiveX control components within a directory
called OCCACHE that exists directly under the WINDOWS or WINNT root directories.
If you wish to remove Olectra Chart from your test system, you only need to delete the
files in the OCCACHE directory that correspond to the ones listed in the .INF file
described in Packaging the Control on page 249.
Olectra Chart OCX
253
annotating 63, 184 Bubble chart
annotating with TimeLabels 69 special properties 34
annotating with ValueLabels 68 Bubble charts
annotating with Values 63 choosing 28
logarithmic 78 hiding series 99
Numbering annoation method 63 minimum and maximum size 34
numbering precision 63
programming considerations 72
rotating 77
ticking increments 64
C
titling 77, 187 C++
axis adding 3D control to 177
adding a second Y- 79 adding Chart control to the main dialog 49
adding a title 187 adding member variable to a project 49
annotating with PointLabels 68 calling methods 51
annotating with TimeLables 69 calling methods in 178
annotation, changing 216 inserting control into an OLE container project 176
annotation, choosing font of 116 inserting the 2D Chart control 49
annotation, overview 62 programming 3D Chart Control 178
bounds, setting 187 programming in 49, 176
changing appearance of 80 setting an object property 50
changing orientation 114 CalcIndex method 227
DataMax property 76 CallAction method 241
DataMin property 76 calling methods 48
direction 74, 75 Candle charts
labelling programming considerations 186 choosing 22
Max property 76 creating complex 37
Min property 76 hiding series 99
rotating annotation 77 special properties 37
setting data bounds 76 ceiling projections 188
tick length, changing 80 centering, images 113
title, rotating 77 changing
title,adding 77 axis appearance 80
zoom 18 borders 115
AxisAllowNegative property 44 grid spacing 82
chart
adding borders to 115
Area, choosing 20
B axis zoom 18
Bar charts Bar, choosing 21
100 percent stacking 36 Bubble, choosing 28
Olectra Chart OCX
254 Index
chart data ChartType property 20, 21, 22, 23, 24, 25, 26, 28
saving 88 CheckNewPoints fast update method 99
chart descriptions choosing
loading and saving 167 area charts 20
storing in files 88, 195 Bar charts 21
chart elements Bubble charts 28
adding images to 229 Candle charts 22
positioning 117, 219 chart type 19
Chart outlines ChartType 154
showing and hiding 114 Filled Radar charts 27
chart properties HiLo charts 23
editing 153 HiLoOpenClose charts 24
chart properties, editing 17 Pie charts 22
Chart Styles Collection 234 Plot charts 19
chart terminology 16 Polar charts 25
chart updates, batching 103 Radar charts 26
chart, interacting with 17 closing, Property Editor 17
Chart2DData object 35 CLSID 247
ChartArea ClusterOverlap property 34
adding borders to 115 ClusterWidth property 35
adding images to 113, 229 collections
changing appearance 114 accessing elements of 47
changing color of 116 using 47, 175
changing width and height 118, 219 using in C++ 50
ChartGroups, creating combination charts 85 color
charting data changing 117
directly from your program 96 colors
using Data Binding 97 changing ChartLabel 222
ChartLabel ChartLabel 124
adding borders to 115 overview 218
border 222 setting 116
cahnging color of 116 setting legend 108
colors, changing 222 specifying named 218
fonts, changing 222 title 106
fonts,choosing 116 ColumnCount property 198
plane, changing 222 ColumnDelta property 166, 199
text, changing 222 ColumnOrigin property 166, 199
ChartLabel fonts, changing 216 columns, adding 199
ChartLabels combination charts, creating using ChartGroups 85
adding a border 124 Complex Candle charts 37
adding images to 113, 229 continuous legends 210
Index 255
coordinates, converting data 86 General file format 95
coordinates, converting passed by reference 88 General layout 29
CoordToDataCoordObject method 88 Grid layout 164
CoordToDataIndexObject method 88 handling missing 94
copying handling missing, 3D 198
data 205 holes in 166
copying data 100 Irregular Grid layout 164
CopyToClipboard printing method 89, 195 loading 3D 204
CopyXVectorIn Chart2DData method 100 loading and saving 31, 167
CopyXVectorOut Chart2DData method 101 loading from a file 95, 202
CopyYArrayIn Chart2DData method 101 loading from a URL 96, 143, 204, 248
CopyYArrayOut Chart2DData method 101 loading second ChartGroup 86
CopyYVectorIn Chart2DData method 101 overview 92
CopyYVectorOut Chart2DData method 101 overview, 3D 198
CopyZArrayIn method 205 Point layout 165
CopyZArrayOut method 205 Point, overview 201
CreateShaded method 200 saving 88
CreateSubset method 200 smoothing 200
creating specifying series 97
.CAB file 250 understanding 163
4D charts 192 Data Binding
Plot charts 19 charting data using 97
stacking charts 83 data bounds, setting 76
Cube Font 215 data coordinates
Currency format 64, 66 converting 136
custom legend labels 211 converting to pixel coordinates 243
custom Values formatting data files, loading and saving 30
accounting format 66 data layout
Currency formatting 66 understanding 29
format codes 65 data points 202
Fraction format 66 picking 137, 243
Number format 67 DataCoordinates attachment method 221
Percentage format 67 DataCoordToCoord method. 243
Scientific Notation format 67 DataCoordToCoordObject method 88
using 64 DataIndex attachment method 221
customizing DataIndexToCoordObject method 88
ContourStyles 227 DataLabels annoation 185
origins 81 Delphi
Property Editor 138 adding 3D Chart Control to 179
CyrillicComplex stroke font 217 adding control to 51
programming in 51, 179
Olectra Chart OCX
256 Index
DrawToDC printing method 89, 195 form resizing 220
DrawToFile printing method 89, 195 format codes
drop lines, adding to Scatter Plot 233 custom Values formatting 65
TimeLabels axis annotation 71
Format TimeLabel property 70
E formatting
creating special ranges for 66
Edit Chart Data dialog 30 formatting symbols 235
editing forms, resizing 121
chart properties 17, 153 Fraction format 64, 66
ElevationData property 198 Fraction Object 66
EncodingMethod property 34 full-range X-axis, Polar charts 43
Enhanced Metafiles 230
error offset, setting 48
ErrorOffset property 48
excluding a series 98
G
excluding series 85 General data
exploding Pie charts 41 file format 95
layout 29
overview 93
F GothicEnglish stroke font 217
GothicGerman stroke font 217
fast update 94 GothicItalian stroke font 217
Fast Update methods 99 graphics zoom, chart area 18
file format GreekComplex stroke font 217
Array data 95 GreekComplexSmall stroke font 217
General data 95 GreekSimplex stroke font 217
file formats Grid data
Grid data 202 file format 202
Irregular Grid 203 layout 164
Point data 203 overview 198
Filled Radar grid lines
choosing 27 adding 82, 191
FillStyle adding and formatting 190
ContourStyle 225 formatting 191
overview 108 horizontal 82
setting 108 vertical 82
filter, legend 212 grid spacing
Floating Bar charts 35 changing 82
floor projections 188 gridlines, adding 82
font
Index 257
hiding a series 98 labelling axes, programming considerations 72
hiding series 85 Layout Chart2DData property 92
HiLo Charts Layout property 30
choosing 23 legend
HiLo charts adding borders to 115
hiding series 99 adding images to 113, 229
HiLoOpenClose charts border, setting 211
choosing 24 borders 108
hiding series 99 changing color of 116
open and close ticks 38 colors, setting 108, 211
special properties 38 custom labels 211
Histogram Bar charts, creating 184 distribution range 213
Hole property 30 filter, adding 212
holes in data 166 font, setting 211
HoleValue property 198 fonts, changing 216
horizontal grid lines 82 fonts,choosing 116
formatting 210
labels, programming considerations 212
I orientation, setting 210
positioning 107, 211, 219
image text and orientation 107
adding to chart elements 113, 229 title 108
setting layout 113, 229 title, setting 211
images using 107
HasMinimumSize property 229 Licence Pack file, creating 144
using as labels 114, 229 license pack file,creating 249
Immediate Feedback Model 16 LineStyle
Index, positining Markers by 128 ContourStyle 225
interacting with the chart 17 customizing Marker 128
introduction to 3D Chart overview 108
summary of features 10 setting 109, 226
introduction to Olectra Chart LineStyle object 227, 228
summary of features 9 loading
Irregular Grid data 3D data 204
file format 203 3D data from a file 202
overview 198 chart description files 31
Irregular Grid layout, data 164 charts and data 31
IsComplex property 37 ContourStyles 226
IsDoubleBuffered property 46, 50, 206 data from a file 95
IsEmbedded property 229 data from a URL 96, 143
IsHalfRange property 43 second ChartGroup data 86
Olectra Chart OCX
258 Index
mesh about 46
bar ChartType 155 about 3D 174
colors, setting 214 navigating 47, 175
contours bar ChartType 157 objects
contours surface ChartType 157 default properties 47
contours, zones bar ChartType 162 programming with 46, 174
contours, zones surface ChartType 162 setting properties of in C++ 50
formatting 213 oc_api.txt 238, 239
shaded bar ChartType 157 oc3dActionModifyCancel 240
shaded surface ChartType 157 oc3dActionModifyEnd 240
shaded, contours bar ChartType 161 oc3dActionModifyStart 240
shaded, contours surface ChartType 161 oc3dActionProperties 240
shaded, contours, zones bar ChartType 163 oc3dActionReset 240
shaded, contours, zones Surface ChartType 163 oc3dActionRotate 240
shaded, zones bar ChartType 160 oc3dActionRotateEye 240
shaded, zones surface ChartType 160 oc3dActionRotateFree 240
surface ChartType 155 oc3dActionRotateXAxis 240
transparency 214 oc3dActionRotateYAxis 240
zones bar ChartType 158 oc3dActionScale 240
zones surface ChartType 158 oc3dActionTranslate 240
MeshBottomColor Elevation property 214 oc3dActionZoomCancel 240
MeshTopColor Elevation property 214 oc3dActionZoomEnd 240
messages oc3dActionZoomUpdate 240
action maps 132 OLEAUT32.DLL 58, 170
methods Olectra Chart
calling 48, 176 distributing 32-bit 58
calling in C++ 51, 178 features summary 9
MFC40.DLL 250 Olectra Chart 1.1, upgrading Visual Basic projects from 54
MFC42.DLL 58, 170 Olectra Chart 2D OCX
Microsoft ActiveX SDK 140, 246 adding to Delphi 51
MinimumSize property 34 OLECTRA.INF 250
missing data, handling 94, 198 OLEPRO32.DLL 58, 170
missing slices, Pie charts 41 OrderCurrencySignValue property 66
modifier flags 133 origin, setting in Polar charts 43
modifier flags, action maps 239 OriginBase property 43
MSVCRT.DLL 58, 170 OriginPlacement property 81
MSVCRT40.DLL 250 origins
customizing 81
placing 81
N Other slice, building 39
Other slice, changing style 41
Index 259
pixel coordinates,converting to data coordinates 137 Property Editor
Plot charts closing 17
choosing 19 customizing 138, 244
plot data displaying 17, 152
overview 93 using 16, 152
PlotArea
adding images to 113
adjusting margins 118
changing background color 116
R
setting margin properties 17 Radar charts
PlotCube choosing 26
changing shape 188 radial grid lines 82
customizing 188 recognized keycodes, action maps 239
Point data registering the 2D chart control, 32-bit 59
editing 167 REGSVR32.EXE 59, 171
file format 203 removing
layout 165 action maps 135, 241
overview 201 returning coordinate values 136
PointDisplay property 42 RGB colors
PointLabels specifying 117
annotating axes with 68 RomanComplex stroke font 216
overview 62 RomanComplexSmall stroke font 216
PointLabels annotation 62 RomanDuplex stroke font 216
PointSeries collection 201 RomanSimplex stroke font 216
Polar charts RomanTriplex stroke font 216
AnnotationAngle property 44 rotating
AxisAllowNegative property 44 axes 77
choosing 25 axis annotation 77
OriginBase property 43 axis title 77
setting origin 43 chart 18, 153
special properties 42 ChartLabels 124
positioning RowCount property 198
axis annotation 73 RowDelta property 166, 199
ChartLabels 122, 220 RowOrigin property 166
legend 107 RowOrigin propety 199
Markers 128 rows
titles 106 adding 199
Precision axis property 63
PrintChart printing method 89, 195
printing S
charts 89, 195
Olectra Chart OCX
saving
methods 89
chart data 88
programming
chart description files 31
2D chart control in C++ 50
3D Chart Control 178 charts and data 31, 167
ContourStyles 226
action maps 134, 240
scaling
actions 132, 238
chart 153
C++ 49
ChartLabels 124 Scatter Plot
in C++ 176 drop lines, adding 233
special properties 233
in Delphi 179
Scientific format 64
Markers 128
programming considerations Scientific Notation format 67
axis labelling 72, 186 Scientific Object 67
ScriptComplex stroke font 217
ChartLabels 223
ScriptSimplex stroke font 217
Distribution Table 232
legend labels 212 series
projections, ceiling and floor 188 data, specifying 97
hiding and excluding 85, 98
properties
SeriesDisplay property 35
editing, chart 17
260 Index
setting text
axis and data bounds 76 legend 107
error offset 48 ThisPoint property 30
shaded ThisSeries property 30
bar ChartType 155 ThresholdMethod property 39
contours bar ChartType 159 ThresholdValue property 39
contours surface ChartType 159 tick length
contours, zones bar ChartType 162 changing 80
contours, zones surface ChartType 162 ticking increments, axes 64
surface ChartType 155 TickLength AxisStyle property 80
zones bar ChartType 159 ticks
zones surface ChartType 159 creating open and close 38
Shaded-Relief Map, creating 200 TickSpacing axis property 64
ShiftPoints fast update method 100 Time axis, using 73
showing, chart outlines 114 TimeLabels
slices, missing 41 annotating axes with 69
slices, missing pie 42 format codes 71
SliceStyle overview 62
overview 108 TimeLabels annotation 62
setting 110 TimeScale axis property 73
smoothing data 200 title
SortOrder property 41 adding images to 229
spacing, grid 82 titles 208
special adding a border 106
3D Bar chart properties 233 aligning text 106
Bar chart properties 34 border, setting 208
Bubble chart properties 34 colors, setting 208
Candle chart properties 37 font, setting 188, 208
HiLoOpenClose chart properties 38 header, adding 208
Pie chart properties 39 legend 108
Polar chart properties 42 positioning 106
Scatter Plot properties 233 positioning, setting 208
Stacking Bar chart properties 35 setting colors 106
special ranges for custom Values formatting 66 setting the font 106
stacking 20 text and alignment 208
Area charts 20 titling
Filled Radar charts 27 axes 187
Plot charts 19 titling axes 77
Stacking Bar charts translating, chart 153
3D, creating 120 TrueType font 215
special properties 35 choosing 216
Index 261
annotating axes with 68
overview 62
ValueLabels annotation 62, 185
Values
custom formatting 64
Values annotation 62, 63, 184
Values Format dialog 64
Visual Basic 4.0 projects, upgrading from Olectra Chart 1.1
54, 182
Visual Basic coordinates, converting 137
Visual Basic, distributing Olectra Chart in 170
W
web page, creating 140
X
X-axis
full or half-range 43
PointLables annotation 62
TimeLabels 62
XValue property 30
Y
Y-axis
adding a second 79
YValue property 30
Z
Zone Projection 230
ZoneMethod Contour property 209
zones bar ChartType 156
zones surface ChartType 156
zooming, chart 154
Olectra Chart OCX
262 Index