|
Scientific & Business
Charts Library
Version 1.03, May 2001, © K.V.Vorontsov, MICEX
|
WARNING: This document was translated authomatically
from Russian ChartLib documentation
by translation program PROMT.
Author do not responds for its quality. If you are interested in
good translation, mail
me please.
ChartLib library is intended for construction of charts in user's applications.
Functions of the library accept an input stream of the data in CHD format
(CHart Description) and output a graphics image in the window of an application
or the file of one of the widespread graphics formats. {CHD}
The library allows to build a graphics of the following types
-
Bidimentional a graphics, containing points, lines and the filled
squares.
-
Bidimentional a graphics with an explosive horizontal axis, in particular
lasting many days a graphics.
-
Some bidimentional diagrams on one slide with possibility of synchronization
on one or several axes.
-
Exchange a graphics with automatic classification of points in interval
histograms or the Japanese candles.
-
Vertical and horizontal histograms.
-
Pie charts.
-
Network and tree charts.
-
Three-dimensional a graphics, containing points, trajectories, tapes and
figures.
-
Three-dimensional surfaces.
Four mechanisms of transmission of input data are supported
-
Loading from a text file of CHD format CL_DataFile function. {CL_DataFile}
-
Transmission of stream of text strings(lines) through CL_DataLine function.
{CL_DataLine}
-
Transmission of the dataflow through CL_DataVector function. {CL_DataVector}
-
Transmission of the interface of a data access through CL_DataMatrix function.
{CL_DataMatrix}
Three types of output devices are supported
-
The window or any other device of a Windows having a context.
-
The file of graphics WMF format or EMF.
-
The file of graphics GIF format.
Three levels of usage of the library are offered on choice
-
ChartLib library.
Contains a base set of functions for conversion of the dataflow in
a graphics image. It is most convenient for on-line generation of GIF-maps
in Internet. It is intended for programmers.
-
TSliChart components.
Expands base possibilities ChartLib under Delphi, simplifies construction
of diagrams in user's applications. It is intended for programmers.
-
ChdView utility.
The application for review of the CHD-files, intended for end users.
Creation of CHD-files needs knowledge of CHD format described in the given
manual.
Structure of distribution kit ChartLib for a Windows
-
Dynamic ChartLib.dll library.
-
ChdView utility for interactive review of diagrams. {chdView}
-
ChdConv utility for converting CHD-files in WMF, EMF and GIF. {chdConv}
-
Examples of CHD-files.
-
Documentation.
-
The initial code TSliChart component for Delphi.
-
The initial code of chdView utilities and chdConv.
-
Demonstration examples of applications on Visual C ++ and Delphi with the
initial codes.
Introduction: entry CHD format
Syntax of CHD format
ChartLib library is oriented to reception(trick) of input data as stream
of strings(lines) of CHD format (CHart Description).
Strings(lines) can be two sorts: controlling commands and the data.
Controlling commands differ the character * in the first position. Empty
strings(lines) are ignored. The strings(lines) starting with **, are perceived
as the comment and also ignored. If at the end of string(line) there are
dots "...", she(it) is prolonged for the following string(line).
Introduction:
Syntax of strings(lines) of the data
In process of arrival of string(line) of the data are remembered in a current
matrix. The slide can have any quantity(amount) of matrixes, but the data
are accepted only by one. Coming strings(lines) are added downwards matrixes.
The dataflow can be switched from one matrix to another with the help of
Data command. {Data}
Values inside text string(line) of the data are divided by commas or
tab characters. The values containing a current separator, it is necessary
to quote. The list of valid separators and characters of quotes can be
changed Syntax command. {Syntax}
Dates are set in [[[YY YY/M M/D D format or D [D]/M [M]/YYYY. Time sets
in hh format [:mm [:ss]]. Date and time are separated by a blank or it
is familiar underlines. If date is given only, time is necessary equal
00:00:00. If time is given only, as date option value SystemDate
or system (today's' date if this parameter is not given takes. Date / time
also it is possible to set values of type the integers compatible to time_t
type of the language With, usually such number is interpreted as number
of seconds, past since midnight January, 1, 1970.
In strings(lines) of the data empty values are admitted. They are set
or skip of value (two separators in succession), or three questions???.
Skip in the data is handled as follows. If this essential given, such as
coordinate of a point an appropriate unit a graphics - a point, the line
or square is not displayed. If it is the auxiliary parameter, such as the
form or color of a point at mapping the default value is used.
ChartLib library operates with objects of four levels:
-
Films
-
Slides
-
Panels
-
Areas
Slides
The main working object is the slide. The slide is a map which is entirely
output in the user's window or the graphics file.
The slide creates NewSlide command. The created slide at once becomes
active - all subsequent commands and strings(lines) of the data will concern
to it(him). To switch an active slide it is possible at any moment with
the help of Slide command. {Slide} {NewSlide}
Films
Film is a sequence of slides. At review of a slide in the window the
user has possibility to switch from one slide on another inside one film.
The slide is inserted into film by SetFilm command. The slide can not
belong to several films simultaneously. Inside film slides allocate by
way of their creation. {SetFilm}
To set a name of film it is possible also at creation of a slide by
NewSlide command. By default, if the name of film is not given, the slide
is inserted into film with a name default.
Panels on slides
The slide can contain one or several diagrams, text boxes and a legend.
The diagram together with auxiliary areas adjoining to it(him) (headers,
axes and their names) will derivate the panel. Each panel has a unique
name which gives it(her) at creation by NewPanel command. The created panel
at once becomes active, and the input stream of commands is routed to it(her).
Any panel can be made active by name or to a serial number on a slide Panel
command. {Panel} {NewPanel}
If on a slide some panels are created, their allocation and relative
sizes are set by Group command. Without this command of the panel have
an identical size and are placed the friend under the friend. {Group}
To use SetFilm commands, NewSlide and NewPanel in obvious sort not necessarily.
If them to not use, film default with a unique slide default, containing
the unique panel with a name default will be automatically created.
Areas on panels
For creation of appearance of panels properties of separate areas on
panels of a slide will be updated. The list of areas of which panels of
various types are made below is resulted.
Areas on panels 2D
Chart |
The bidimentional diagram - the main object on the panel |
Title |
The header a graphics output above the diagram |
TitleBelow |
The header a graphics output under the diagram |
XAxis |
Horizontal axis |
YAxis |
Main vertical axis |
ZAxis |
The second vertical axis. It is not represented, if any point a graphics
has no Z parameter |
XName |
The name of a horizontal axis, is placed below |
YName |
The name of a main vertical axis, is placed at the upper left |
ZName |
The name of the second vertical axis, is placed at the upper right |
TextNear |
Text box for inscriptions inside points |
TextInner |
Text box for inscriptions near to points |
TextRight |
Text box for an inscription near to an active point |
Areas on panels pie
Chart |
Pie chart - the main object |
Title |
Header above the diagram |
TitleBelow |
Header under the diagram |
TextNear |
Text box for inscriptions near to sectors |
TextInner |
Text box for inscriptions inside sectors |
TextRight |
Text box for an inscription near to active sector |
Areas on panels text
Text |
Text box - the main object |
Areas on slides
Legend |
The panel 0 - a legend (the list of denotations on diagrams) |
StatusBar |
The panel 1 - статусная string(line) |
Introduction:
Syntax of controlling commands
Controlling commands are intended for the job(definition) of properties
of objects for a slide and switchings of an input stream of strings(lines)
between films, slides and matrixes of the data.
Controlling commands are three sorts:
* имя_объекта. имя_параметра = value
* имя_параметра = value
* имя_объекта = value
In the first case the command assigns value to the parameter of the indicated
object to a current slide. The current slide also is the object. To it(him)
it is possible to address by name Slide or by name, given it(him) at creation
by NewSlide command. {NewSlide}
In the second case the name of the object is lowered(omitted), and the
command concerns to the current object on a slide. For all diagrams it
is Chart object. If on a slide some panels with the diagrams, current are
considered Chart object on the panel, activated last Panel command or NewPanel.
The current panel also is the object, and to it(her) it is possible to
address by name Panel or by name, given it(her) at creation by NewPanel
command. {Panel}
In the third case the name of the parameter is lowered(omitted), and
the command concerns to main property of the object. For headers, names
of axes and other text objects main property is Text,
for a legend - Line. For example, the following commands
are equivalent:
*Title. Text = the diagram of dependence
*Title = the diagram of dependence
By search of the object by name all objects of the current panel, then
all objects of a current slide all over again are viewed. If the object
is not retrieved, the command is ignored. The described rules are for abbreviation(cutting)
of recording and in most cases allow to manage commands " a point ".
Some commands do not concern to one of objects. They are for handle
of slides and installation of preferences.
The equal-sign can be substituted a blank. Names of commands are case-sensitive:
for example, Visible=on command is true, and visible=on command - is not
present, and will be ignored. {Visible}
Introduction:
the Example 1
There is enough only two commands
CHD format is very simple if not to be engaged in design a graphics. For
the description the graphics quite suffices two NewData commands and Series
which strings(lines) of the data follow. {NewData}
NewData command creates a new matrix of the data with the given columns
and does(makes) its(her) current. The number of values in each subsequent
string(line) of the data should be equaled to quantity(amount) of columns
in a matrix.
Series command creates a series of points on a graphics and describes
its(her) properties, such as X-coordinate, Y-coordinate, color, the form
of a point etc. Each property can be either a constant, or a name of a
column of the data from any matrix of a current slide. Cвойства points
are in detail described in section of a Series.
The following diagram shows the speaker of the prices and sizes of tenders
by actions(shares) of the company ONIONS(BOW) ОЙЛ on the Moscow Interbank
Stock Exchange since February till November, 1999.
The diagram was constructed on an input stream containing on 3 values
in each string(line): date, the price and size. Each string(line) corresponded(met)
to one day. The initial fragment of an input stream below is resulted:
*NewData day,
price, value
*Series X=day Y=price
S=0 LC=1
*Series X=day Z=value S=0 LC=3
28/01/99 25.35 216335
29/01/99 25.68 124938
01/02/99 25.57 10226
...
For it the graphics is a lot of lacks: dates are displayed by numbers,
there is no header and names of axes, it is too many zero in labels of
the right vertical axis, and so on... Formatting a graphics by default
Is those.
Introduction:
the Example 2
And nevertheless it is not enough two commands
The same diagram can be made much more understandable and attractive if
to set background flood filling, to place(install) Russian localization,
to add headers still more some commands of formatting:
*Locale = rus
*Slide. Background
= 17 17 7 7, bidir
*Slide. GradMaxSize
= 2
*Title Tenders by actions(shares)
ONIONS(BOW) ОЙЛ, 1999
*YName
= the price
*ZName = size, one million руб
*XAxis.Type
= date
*YAxis. Color = 1
*ZAxis. Color = 3
*NewData day, price,
value
*Let vmill = value / 1000000
*Series X=day Y=price
S=0 LP=2 LW=2 LC=1
*Series X=day Z=vmill S=0 LP=2 LW=1 LC=3
FD=1 FP=2 FC=15
*Series X=day Z=0 S=0
28/01/99 25.35 216335
29/01/99 25.68 124938
01/02/99 25.57 10226
...
Introduction: the Example
3
Some diagrams on one slide
Let's continue an example with the diagram of a course of tenders. Exchange
a graphics frequently draw the friend under the friend: from above the
prices, from below sizes. A course of the price represent with the help
of interval histograms or the Japanese candlesticks:
The data for this purpose a graphics the same, as in examples 1
and 2. The slide is divided into two panels by NewPanel
commands. Group command places these panels the friend under the friend
and speaks, that the upper panel is three times higher. CandleWidth command
sets width of the Japanese candlesticks in seconds (here it is one week).
{Group} {NewPanel}
** We define the data
*NewData day, price,
value
*Let vmill = value / 1000000
*Slide. Background
= 17 17 7 7, bidir
*Slide. GradMaxSize
= 2
** We define the upper panel of the prices
*NewPanel price
*Title
Tenders by actions(shares) ONIONS(BOW) ОЙЛ, 1999
*YName = the price
*XAxis.
Type = date
*XAxis. Visible off
*Series X=day MC=price
MS=2
C=7
*CandleWidth 604800
** We define the lower panel of sizes
*NewPanel volume
*Title. Border 0, 1,
0, 1
*Title. IndentVert
0
*XAxis. Type = date
*XAxis. SpaceVert
1
*XAxis. IndentVert 0
*Series X=day MC=vmill
ML=0
MS=3
C=15
*CandleWidth 604800
** We allocate panels the friend under
the friend, we shall clock axes
*Group (3,1 ( 1 ) main
= price, volume
*SyncAxis price.
XAxis, volume. XAxis
27/01/99 24.85 66913
28/01/99 25.35 216335
29/01/99 25.68 124938
...
Introduction: the Example
4
Exchange tenders - a unusual camera angle
It is possible to go further and to aim to construct the third diagram
on the same columns of the data. For example, it could be the histogram
of allocation of sizes of tenders under the prices. It seems, under such
sight angle still nobody looked at exchange tenders:
Let's create one more panel and we shall place on it(her) гистограммную
a series. Two additional commands are necessary for construction of the
histogram of allocation. HorizHist speaks, that the histogram horizontal
and each point is displayed separately inside a column. ColWidth command
sets width of a column of the histogram.
** We define the data
*NewData day, price,
value
*Let vmill = value / 1000000
*Slide. Background
= 17 17 7 7, bidir
*Slide. GradMaxSize
= 2
** We define the upper panel of the prices
*NewPanel price
*Title
Tenders by actions(shares) ONIONS(BOW) ОЙЛ, 1999
*YName = the price
*XAxis.
Type = date
*XAxis. SpaceVert
1
*XAxis. IndentVert 0
*XAxis. RulePose
both
*Series X=day MC=price
MS=2
C=7
*CandleWidth 604800
** We define the lower panel of sizes
*NewPanel volume
*Title. IndentVert
0
*XAxis. Type = date
*XAxis. Visible off
*Series X=day MC=vmill
ML=0
MS=3
C=15
*CandleWidth 604800
** We define the right panel with the histogram
of sizes
*NewPanel hist
*HorizHist = detailed
*ColWidth=5
*YAxis. Visible off
*Series Y=price HW=vmill HS=time C=15
** We allocate panels the friend under
the friend, we shall clock axes
*Group (3,1 ( 2,1 )
main = price, hist, volume
*SyncAxis price.
XAxis, volume. XAxis
*SyncAxis price. YAxis, hist. YAxis
27/01/99 24.85 66913
28/01/99 25.35 216335
29/01/99 25.68 124938
...
Introduction: the Example
5
It is possible to do without the data
More precisely, the data can be calculated under formulas. For example,
to construct the diagram of номального function of the allocation, there
is enough only four strings of the description:
*Let x = pointno/5-4
*Let y = FNorm (x)
*ResizeData 40
*Series X=x Y=y
Let command creates a new column of the data, values in which are calculated
under the indicated formula. The built - in variable
pointno gives a serial number of a current point, and ResizeData command
installs number of strings(lines) in columns x and y, that is number of
points on a graphics.
That in the total it turns out:
Controlling commands
Symbols in descriptions of commands:
-
Valid values of parameters are selected(allocated) bold. As
well as commands, they are case-sensitive. Therefore Visible=on command
is true, and Visible=On command - is not present.
-
Optional parameters of commands consist in square brackets [...]
-
Properties with value b are булевскими (logical) and accept values on,
yes, true or 1, designating "yes", and off, no, false or 0, designating
"are not present".
-
Properties with value color are the color number in a
color box.
Commands:
the Common properties applied to all objects
In this section properties which all objects without exception have are
described: slides, panels, a graphics, an axis, texts.
Visible = b
To display the object. Visible=off hides the
object.
Advice:
Apply Slide. Visible=off command
if want, that the slide was skipped at scrolling film.
Color = color
Primary color of the object. Color parameter
sets the color number in the graphic palette.
BorderColor = color
Color of a framework of the object. Color parameter
sets the color number in the graphic palette.
Border = wL [, wT, wR,
wB]
Width of a framework of the object. The command with four arguments sets
width of 4 sides of a framework: left, upper, right and lower accordingly.
By default frameworks are not present.
Border3D = we, wi
Width external we and internal wi facets of a framework for volumetric
effect. If before width to put a minus, a facet pressed, differently -
convex. The sum we and wi should not exceed value Border. By default the
volumetric effect is absent: we = wi = 0.
Background = color
Background color of the object. Color parameter
sets the color number in the graphic palette.
Background = LT, TR, RB, BL [, bidir]
To display a background of градиентной object flood filling.
First four parameters set colors left upper, right upper, right lower
and left lower corners of painted over area accordingly. Efficiency of
plotting is higher for vertical (LT=TR, RB=BL) and horizontal (TR=RB, BL=LT)
than a gradient.
Optional bidir parameter sets double-sided flood filling.
Background = off
To disable plotting a background. The object is represented atop of an
available background.
Transparency = n
Transparency of a background; n can accept material values from 0 (a transparent
background) up to 1 (opaque). By default 1. If for a background flood filling
is given градиентная, Transparency parameter is ignored.
Advice:
Apply this command to TextRight object to set a semipermeable transparency
for output of the text comment near to an active point. {TextRight}
GradMaxSize = n
GradMinCells = n
Parameters of efficiency градиентной flood fillings. Flood filling is drawn
by a grid from rectangular cells of various colors. GradMaxSize sets a
maximum size of cell in pixels (by default 20). GradMinCells sets minimum
number of cells (by default 20).
FontStyle = style
Type style of the text, style can accept one of 8 predetermined values:
title,
name,
label, info, inside, near,
right,
status,
or font1..., font9 for user's fonts. By default type style
is installed according to assignment of text box, see DefFont command.
{DefFont}
IndentHoriz = n
Horizontal indent at the left and to the right of main contents of the
object.
IndentLeft = n
IndentRight = n
Horizontal indent accordingly at the left and to the right of main contents
of the object.
IndentVert = n
Horizontal indent at the left and to the right of main contents of the
object.
IndentTop = n
IndentBottom = n
Vertical indent accordingly at the left and to the right of main contents
of the object.
SpaceHoriz = n
Horizontal interval between separate units inside the object.
SpaceVert = n
Vertical interval between separate units inside the object.
MinWidth = len
MinHeight = len
Minimum width and height of area in pixels. It is used for thin adjustment
of layout of axes and texts on diagrams.
Advice:
With the help of ZAxis. MinWidth=10 command slightly it is possible
to remove a right edge a graphics from boundary of a slide.
Style = style_name
To apply to the object style with a name style_name, earlier определёный
DefStyle command. {DefStyle}
Example: a routine
*DefStyle bsty
*Background 17
*Border 2
*EndStyle
*XAxis. Style bsty
It is equivalent to commands
*XAxis. Background 17
*XAxis. Border 2
As all commands are by default routed on a current slide, installation
of style for slide Slide. Style operates as макрос. Thus contents of style
are executed in accuracy how if it was written instead of this command.
It is impossible to define(determine) style with which help it would
be possible to set common properties as to a slide, and to other objects.
For example, the command
*Slide. Style bsty
Will change properties Background and Border not for the slide, and for
Chart object as for a slide it(he) is current area and all commands " without
a point " направляеются to it(him).
Commands:
Properties of text boxes
To text boxes concern: headers graphics Title
and TitleBelow; names of axes XName, YName, ZName; text boxes TextInner,
TextRight and TextNear; panels such as text, legend Legend and статусная
string(line) StatusBar. Text boxes can be multilower case with preset splitting
into strings(lines).
Text = text
The output text. Strings(lines) are divided by \n character. Is main property
for the text objects, therefore the following commands are equivalent:
*Title. Text = the diagram of sine
*Title = the diagram of sine
Justify = s
Horizontal alignment of strings(lines) of the text, s can accept values
left,
center,
right.
Shadow = x, y, t, s
The text discards a shadow. X parameters and y set offset of a shadow,
number t in a range from 0 up to 1 - transparency of a shadow (0 corresponds(meets)
to an invisible shadow, 1 - completely opaque). Number s - размытость shadows
in pixels. By default t = 0.5, s = 0.
If x = y = 0 or t = 0 the shadow is not represented.
Commands:
Properties of a legend
The legend represents the table of strings(lines). Each string(line) consists
of an icon and the comment. The legend is placed along lower or a right
edge of a slide that is installed by property of slide LegendPose.
Line = list-text
To set the next string(line) of a legend. The string(line) consists of
an icon set by an argument list list and the comment text. In list list
properties C, W, S, U, TC, LC, LW, LS, LA, FC are specified, FS and their
numerical values similarly to Series. Line command is main property of
Legend object, therefore his(its) name together with a point can be omitted(dropped).
{Legend} {Series}
Example:
*Legend C=5 S=3 W=8 LC=3 LW=2
bargains
PlacingStyle = s
Way of allocation of strings(lines) of a legend:
column - in one column,
lines - densely in some strings(lines),
table - the table.
At the first way strings(lines) not finding room a column are discarded.
At the second and the third output of all strings(lines) of a legend is
guaranteed. By default table.
PatternWidth = n
PatternHeight = n
Width and height of icons in pixels, by default 23 and 8 accordingly.
Commands:
Properties of axes
Axes are represented sideways from a graphics, contain bar and text labels.
Axes can be horizontal and vertical.
Type = type
The type of an axis:
date - on an axis dates are postponed;
time - on an axis time is postponed;
real - a numerical axis (by default).
DateTimeRange = date1 - date2,
time1 - time2
Explosive horizontal axis of time with a range of dates date1-date2 and
a range of time time1-time2 inside each date.
Ranges = min1 , max1 [,
per1 , n1] |... | minN
, maxN [, perN , nN]
The explosive horizontal axis composed from N of ranges. Each range are
or one interval [min, max], or a series from n intervals of equal length,
отстоящих from each other on the value of period per:
[ min, max],
[ min + per, max + per],
... And so on up to...
[ min + (n-1) per, max + (n-1) per].
Ranges are obliged to go in ascending order, not overlapping each other
(value max + (n-1) per for i-го a range should not exceed min for (i+1)-го
a range).
SyncMaster = b
If off the scale of an axis is dependent from scales of the clocked
axes. By default on.
Advice:
Apply this command in that case when axes of two diagrams are clocked,
but at choice of a scale the first diagram is defining only. That points
the second graphics were not taken into account at scaling, set for him(it)
*SyncMaster=off.
Rule = width, depth, tickext, tickint
Rule = off
Parameters of the bar representing a scale of an axis. If one, two or three
last parameters are lowered(omitted), their values do not vary. In brackets
default values are resulted:
width - width of bar (3); if width < 0 scale
divisions are drawn only;
depth - depth of bar (0);
tickext - an external hanging indent of tics (2);
tickint - an internal hanging indent of tics (3).
The second variant of the command cleans(removes) bar.
RulePose = s
From what side of an axis to represent bar, s accepts values:
left - at the left;
right - on the right;
top - from above;
bottom - from below;
both - from both sides.
For vertical axes by default right, for horizontal - top.
RuleColor = color
Color of bar. Color parameter sets the color
number in the graphic palette.
Color of text inscriptions about divisions of bar is installed by Color
command. {Color}
SpaceInterv = p
Only for an explosive horizontal axis. Maximum width of a separator of
intervals in percentage concerning width of an interval. By default 4 %.
Besides width of a separator does not exceed value SpaceHoriz for the given
axis.
DateFormat = format
The format of output of dates for an axis such as date or an explosive
lasting many days axis. By default % *d%b %y. The formatted string(line)
format sets with the help of the specification
of output of dates and times.
LabelFormat = format
The format of output of labels of an axis. If not it is given, the optimal
format is selected automatically. For an axis such as real the formatted
string(line) format should contain one of f specifications,
e, E, g, G. For an axis such as time the format sets with the help
of
the specification of output of dates and times.
Example:
LabelFormat command = %.2f limits output of numbers by two signs after
a comma.
Labels = b
To display on an axis text labels.
Justify = s
Horizontal alignment of text labels:
left - to the left;
right - to the right;
center - on centre;
auto - optimal (by default).
All commands controlling the dataflow, are properties of a slide. The slide
has one or several matrixes. Entry strings(lines) of the data act in that
matrix which at present is declared current.
Matrixes are main raw material for construction of diagrams. Property
graphics Series allows to place(install) correspondence
between columns of the data in matrixes and properties of series of points.
NewData n = [type1] name1
..., [typeN] nameN
To create a new matrix of the data with a name or number n, consisting
of N columns. The created matrix becomes current. All strings(lines) of
the data, the following behind this command, should contain on N values.
Each column sets the name name before which through a blank the type
of the data stored(kept) in column type can be indicated:
byte - the whole,
real - material,
text - text.
If type type is lowered(omitted), it is supposed real.
The name of a matrix n can be lowered(omitted), but then to it(her)
it will be impossible to address by name in Data commands, ClearData,
DeleteData
and ResizeData {Data}
Data = n
To make current a matrix of the data with a name or number n. The number
of values in all strings(lines) given, following for this command, should
be equal to number of columns in a matrix n.
Advice:
If on your slide some matrixes, and strings(lines) of the data act
alternately, use Data command.
ClearData = n
To clear a matrix with a name or number n. The number of strings(lines)
in a matrix becomes equal to zero, the number and types of columns are
saved.
If the name is lowered(omitted), the current matrix is cleared.
DeleteData = n
To delete all columns of the data (including the expressions given by Let
command) in a matrix with a name or number n. The given way of clearing
is more radical in comparison with ClearData.
{Let}
If the name is lowered(omitted), the current matrix is cleared.
Let [type] name = expr
To create in a current matrix a column of the data with a name name and
type type, calculated on expression expr. Expressions
can contain names of columns of matrixes of the data defined on current
or any other slide (in the latter case before a name of a column through
a point the name of a slide is written) as variables. If the type is lowered(omitted)
and not defined(determined) unambiguously as expression, it is supposed
real.
The computable column does not contain in input datas and is not stored(kept)
in memory, and calculated for each point on the given expression expr.
Advice:
To take a column of the data from other slide, use as a name of a variable
a construction slide.name, where slide - a name of a slide. An alternate
way: after DataSlide=slide command it is possible to access to columns
of the indicated slide without the obvious instruction(indication) of a
name of a slide and a point. {DataSlide}
ResizeData n rows
To set number of strings(lines) in a matrix with a name or number n equal
rows. The number of strings(lines) in a matrix is usual is defined(determined)
automatically in process of arrival of strings(lines) of the data. ResizeData
command is necessary only in that case when all vectors in a matrix were
created by Let command and are computable. {Let}
If the name of a matrix n is lowered(omitted), the command is applied
to a current matrix.
Commands:
Properties of bidimentional diagrams and histograms
The diagram consists of series. A series consists of points. Each point
has about 50 properties. The majority of properties is usual are set by
constants or are in general omitted(dropped). In that case they actually
are properties of a series.
A series is not the independent object. All commands listed in the
present section, are properties of Chart object on panels such as 2D.
Series name: property1=value1
..., propertyN=valueN
To create on a graphics a new series of points with a name name and a set
of properties property1..., propertyN. Each property
of a series sets one or a two-letter name property and value value. Value
can be or a name of a column of the data, or a numerical constant. It is
possible to specify a name of a column of the data from other slide with
the help of a construction slide.name, where slide - a name of a slide
from which takes a column of the data. The name of a series name can be
lowered(omitted).
The detailed description of Series command with the complete list of
properties see here.
SeriesModify name: property1=value1
..., propertyN=valueN
Change of one or several properties before the defined series. The property
list has the same syntax, as well as in Series command. If the name name
is lowered(omitted), the last created series is meant. {Series}
SeriesOn = name
SeriesOff = name
Two commands accordingly include and disable mapping a series with a name
n. If the name is lowered(omitted), the last created series is meant.
ExtraX = min [, max]
ExtraY = min [, max]
ExtraZ = min [, max]
Additional indent at the left and on the right on a horizontal axis. Numbers
min and max are set in percentage of width a graphics. If max it is lowered(omitted),
it is necessary min = max. By default indents are absent.
CandleWidth = n
Width свечей on exchange diagrams (in seconds). Value n can be set in formats
of time:
чч:мм:сс
чч:мм
And also as number of days, weeks, months or years:
n days
n weeks
n months
n years
By default CandleWidth=00:05:00.
CandleBase = n
Base reference point свечей on exchange diagrams. Value n can be set in
the format of date - time. By default 0.
Advice:
Set this parameter equal to arbitrary Monday on week candle diagrams,
differently all candles will start on Thursday.
Set this parameter equal to the first day of arbitrary month at construction
of monthly diagrams.
ZoomX = x1, x2
ZoomX = min, x
ZoomX = max, x
ZoomX = max
To set an interval of axis X in which the diagram is viewed, one of 4 ways
accordingly:
[ x1, x2] - both boundaries of an interval are given;
[ min, min+x] - the length of an initial part is
given;
[ max-x, max] - the length of a finite part is given;
[ min, max] - to contain all points a graphics.
x1, x2, x it is possible to set coordinates in percentage concerning
length (max-min). For this purpose before coordinate the character of %
is put. An example: to produce an average third graphics ZoomX = %33, %67.
After loading a slide for all diagrams it is by default installed ZoomX
= %0, %100.
ZoomY
ZoomZ
Commands for axes Y and Z, similar ZoomX.
SyncYZ = y0, z0
SyncYZ = max
SyncYZ = off
To clock scaling on axes Z and Y. If AutoScaleZ
> 0, SyncZY parameter is ignored. By default max.
In the first variant of the command the coordinate y0 on axis Y is
combined with coordinate z0 on axis Z.
In the second variant maximum intervals in which there are all points
a graphics are combined.
The third variant disables synchronization.
EmptyIntervals = b
To include the empty intervals which are not containing points, in explosive
axis X (explosive axes are formed by Ranges commands and DateTimeRange).
It is ignored, if axis X is not explosive. By default off. {Ranges}
AutoScaleX = s
AutoScaleY = s
AutoScaleZ = s
The mode of automatic scaling on axes X, Y and Z accordingly. In the mode
of autoscaling the scale on an axis is installed so that all were visible
or nearly so all (for исключеним " far ejections ") points a graphics.
S parameter accepts values:
off - without autoscaling (by default);
max - an interval in which all points are
visible;
robust - an interval in which can be not
visible far отстоящие points, see RobustPoints
and RobustLimit;
var - the interval is equal to the average
standard deviation multiplied on RobustFactor.
Autoscaling is made on all points with property U=8 and on all points
with U=16, having a size. Autoscaling can not be made on a vertical and
horizontal axis simultaneously.
For histograms with vertical columns works only AutoScaleX, with horizontal
- only AutoScaleY.
RobustPoints = n
RobustLimit = n
The parameters used at discarding of points in the mode of scaling AutoScale
= robust. Far отстоящими are considered no more RobustPoints points
provided that they will defend from the nearest point on distance not less
(Max-Min) *RobustLimit. The parameter is distributed to all axes. By default
RobustPoints=2, RobustLimit=0.5.
RobustFactor = n
The parameter used at discarding of points in the mode of scaling AutoScale
= var. Far отстоящими the points which are taking place from average
arithmetic, calculated on all points, on distance more Var * RobustFactor,
where Var - an average standard deviation are considered. Operation of
the parameter is distributed to all three axes. By default 2.
VGrid = n
Sort of a vertical grid. If n < 0, the grid is not represented. If n=0,
the grid is drawn by solid lines. If n > 0, the grid is drawn by strokes
of length n in sites of a grid. By default 0.
HGrid = n
Sort of a horizontal grid. The command is similar VGrid.
GridOverFills = b
To draw lines of a grid atop of flood fillings. By default on.
GridColor = color
Color of lines of a grid. Color parameter
sets the color number in the graphic palette.
SelectColor = color
Color of the selected(allocated) points, by default white. Color
parameter sets the color number in the
graphic palette.
ActiveColor = color
Color of an active point, by default yellow. Color
parameter sets the color number in the
graphic palette.
HighlightColor = color
Color of illumination of a point at the instruction(indication) on it(her)
a mouse pointer, by default yellow. Color parameter
sets the color number in the graphic palette.
ShowTN = s
Output mode of texts TN near to points:
never - are not output for all points;
always - are output for all points;
last - only for the last point of a series;
select - only for the selected(allocated)
points.
By default in interactive select mode, in not interactive - always.
PoseTN = s
Layout of text TN near to points:
off - to not output;
left - to the left
of a point;
right - to the right
of a point;
up - from above from
a point;
down - from below from
a point.
By default right. If the comment does
not get into area a graphics, layout of the text can be automatically changed.
ShowLN = s
Output mode of texts LN near to lines. Accepts the same values, as ShowTN
parameter. By default never. {ShowTN}
TableTitle = text
Header of the summary table of the selected(allocated) points, consisting
of headers of the columns, divided the character ";". By default "; Info
". If the header starts with a character - separator ";", in the first
column of the table numbers of strings(lines) are output.
ArrowSize = n
ArrowAngle = n
Parameters of arrows to segments with property LA. Set a size and a corner
(in degrees) wings of arrow accordingly. By default 10 and 10.
StatusOnMouseMove = expr
Статусная the string(line) output at cursor update of the mouse on a graphics.
The
string(line) with inserts expr can contain names of columns of the
data, and also variables CoordX, CoordY, CoordZ,
CoordXText, CoordYText, CoordZText, designating a current cursor position
in real coordinates.
By default
StatusOnMouseMove = " [CoordXText];
[CoordYText] "
StatusOnMouseMove command should go directly after the description of a
series (Series command) to which X-coordinates of points the output information
is anchored. {Series}
StatusOnMouseDrag = expr
Статусная the string(line) output at selection by the mouse of rectangular
area on a graphics. The string(line) with
inserts expr can contain names of columns of the data, the same variables,
as in StatusOnMouseMove command, and also variables CoordXStart, CoordYStart,
CoordXStartText, CoordYStartText, designating an initial cursor position
in real coordinates.
By default
StatusOnMouseDrag = " [CoordXStartText]
- [CoordXText]; [CoordYStartText] - [CoordYText] "
StatusOnMouseDrag command should go directly after the description of a
series (Series command) to which X-coordinates of points the output information
is anchored. {Series}
Commands:
Properties of histograms
All commands listed in the present section the same as and in previous,
are properties of Chart object on panels such as 2D. They work only in
the event that on a graphics are present гистограммные
series of points.
VertHist = type
The type of the vertical histogram, value type should be one of the following:
simple - the simple histogram with columns
of one or different colors;
detailed - the detailed histogram, columns
consist of separate points of different color;
pie - a pie chart;
piedetailed - a pie chart with the sectors
consisting of separate points of different color.
HorizHist = type
The type of the horizontal histogram. The parameter is similar VertHist.
nCols = n
nPointsPerCol = n
ColWidth = n
Three alternate ways to set splitting of a range of values into columns.
It is by default used nCols=15.
nCols - number of columns of the histogram;
nPointsPerCol - an average of points in a column;
ColWidth - width of columns.
ColumnsThickness = n
Width of columns in percentage concerning distance between adjacent columns.
AverageColors = b
If it is included, color of each column of the histogram is calculated
as average colors of points making her(it).
OutlineColumns = b
If it is included, for histograms such as detailed and piedetailed
each column (sector) of the histogram is outlined by a framework.
Commands:
Parameters of three-dimensional maps
All commands of the given unit are properties of the panel such as 3D.
ViewTheta = f
The parameter of the initial layout of the scene. A corner of a sight (in
degrees from-180 up to +180) along a meridian.
ViewFi = f
The parameter of the initial layout of the scene. A corner of a sight (in
degrees from-180 up to +180) along a parallel.
ViewPersp = f
The parameter of the initial layout of the scene. A perspective of a sight,
distance from the spectator up to the map.
ViewScaleX = f
ViewScaleY = f
ViewScaleZ = f
Parameters of the initial layout of the scene. Coefficients of expansion
of the scene on three axes.
Commands:
Handle of slides and films
The commands working with slides and films, are not properties of any object.
These are global commands.
NewSlide = name
To create a slide with a name name. If such slide already exists, it(he)
is deleted and substituted new. By default film has a unique slide with
a name default. The created slide is inserted into the end of current film.
If the slide has a name default, the library changes this name at arrival
of the first string(line) of the data on a slide. Up to this moment the
slide is considered empty and can be replaced with other slide.
NewSlide
To create a slide with a name default. As against the previous form of
the command the new slide creates always irrespective of, whether there
are already slides with a name default.
Slide = nslide
To make active (to make current) a slide, indicated nslide parameter. The
subsequent commands and strings(lines) of the data will concern to this
slide. The slide should be is preliminary is created by NewSlide command.
If the indicated slide does not exist, the command is ignored. {NewSlide}
Nslide parameter accepts the following values:
name film a slide with a name name in film film;
n film a slide with number n;
< < film the first slide;
> > film the last slide;
< n a slide
with number, on n smaller numbers of a current slide;
> n a slide
with number, on n big numbers of a current slide;
<
the previous slide;
>
The following slide;
The name of film can be omitted(dropped). If it is not indicated, there
is a current film. It is impossible to move on slides in film with a name
default as from it is allocated(removed) under separate slides.
SlideMove = nslide
To put a current slide before a slide which layout is given by nslide parameter.
This parameter accepts all same values, as the parameter of Slide command.
{Slide}
DataSlide = nslide
DataSlide off
To place(install) link with the data source on the other slide. After that
Letи Series commands can access to columns of the data on a slide nslide
as to own, not using names with a point. Nslide parameter accepts all same
values, as the parameter of Slide command. {Slide}
{Series} {Let}
The second variant of the command breaks off link with the data source.
ClearSlide
To clear a current slide, having deleted all his(its) data, panels and
parameters of formatting. The name of film to which posesses a slide does
not vary only.
DeleteSlide
To delete a current slide, having deleted all his(its) data, panels, parameters
of formatting, and having eliminated it(him) from current film. This command
operates more considerably, than ClearSlide.
SetFilm = name
To withdraw a slide from current film and to include it(him) in film with
a name name. By default up to SetFilm command the slide belongs to film
default.
DeleteFilm = name
To delete film with a name name and all his(its) slides. If the name name
is lowered(omitted), film to which posesses a current slide is deleted.
If film with a name name does not exist, the command is ignored.
The commands described in this section, are applied to a slide. They allow
to compose a slide from separate panels with diagrams or text comments.
NewPanel n [: type]
To create on a slide the panel such as type with a name or number n.
Valid types of panels:
2D - the bidimentional diagram or the histogram;
3D - the three-dimensional scatter diagram;
pie - a pie chart;
text - the text comment;
If the type is lowered(omitted), it is supposed 2D.
By default on a slide there is one panel with a name default, number
1 and 2D type. First NewPanel command substitutes its(her) new panel.
If the panel with a name n already exists, she(it) is deleted and substituted
new.
Panel = n
To make active on a slide the panel with a name or a serial number n. All
subsequent commands and strings(lines) of the data will form the indicated
panel.
Panels are numbered since 0 by way of their creation on a current slide.
Panels with numbers 0 and 1 are reserved for статусной strings(lines) and
legends.
Group (hrows) (wcols) group = panels
To group panels and the groups listed in panels list, in group with a name
group. Panels allocate with the rectangular table from left to right, from
the top downward. Table lines have the relative heights indicated in the
list of numbers hrows. Columns have the relative widths indicated in wcols
list.
Example: the command
*Group (2,1 ( 2,1,1 ) gr5 = p1, p2,
p3, p4, p5
Groups panels p1, p2, p3, p4, p5 in group gr5:
If the slide has some panels, and Group command is absent, vertical
grouping Group (1 is by default applied..., 1) (1).
SyncAxis = panel1.axis1 ...,
panelN.axisN
To clock N the axes which are taking place on panels panel1 ...,
panelN. Names of axes axis1 ..., axisN
Can be XAxis, YAxis or ZAxis. After synchronization
scaling of one of diagrams automatically scales the others. Zoom commands
and Type operate on all clocked axes; other commands are perceived by the
clocked axes individually. It is impossible to clock a horizontal axis
with vertical.
TitlePose = s
Position of upper header on the current panel:
normal - above names of axes Y and Z,
econom - it is economical (between names
of axes).
TitleBelowPose = s
Position of lower header on the current panel:
normal - under the name of axis X,
econom - it is economical (near to the name
of axis X).
XNamePose = s
Position of the name of axis X on the current panel:
left - at the left,
right - on the right,
left-econom - at the left near to divisions
axes X,
right-econom - it is economical on the right
(by default).
LegendPose = s
Position of a legend on a current slide:
right - on the right,
down - below (by default).
About = text
The text output in статусную string(line) upon termination of allocation
of a slide.
Commands:
Parameters of the interactive mode
Parameters of the interactive mode are not properties of any object. These
are global commands.
SelectShape = s
The form выделителя points, s accepts values:
no - it is impossible to select(allocate)
the areas, only separate points
rect - a rectangle (by default);
ellipse - the ellipse;
half - a half-plane;
strip - a bar.
SelectMode = s
The mode of selection:
no - it is impossible to select(allocate)
neither areas, nor separate points
add - to select(allocate) points;
sub - to deselect points;
xor - to change selection of points (by default).
SelectOutside = b
To select(allocate) the points which are taking place outside visible area.
By default off.
Cursor = s
The form of the cursor marking current position of the mouse:
off - the cursor is not output (by default);
cross - a dotted cross;
ticks - marks on each side a graphics.
DrawBlockSize = n
Block size at background plotting. By default 100.
Advice:
If plotting a graphics in the window decelerates operation of other
applications, value of this parameter should be reduced.
Preferences are not properties of any object. Their operation is distributed
to all objects, including on all slides.
DefColor color = R, G, B
To add in the graphic palette color with
number color, given by a triplet Red, Green, Dark blue. If color < 27,
the command changes the standard predetermined color.
DefFont style = library: family, width
x height, flags, angle
Installation of type style style. Value style should be or a name of standard
style, or the font number in the graphic palette of fonts. By default in
the graphic palette 8 standard fonts with numbers 1-8 are defined and the
place for definition 9 user's is left:
1 = title - the font for header,
2 = name - the font for names of axes,
3 = label - the font for labels of axes,
4 = info - the font for inscriptions on a
graphics,
5 = inside - the font for inscriptions inside
points TI,
6 = near - the font for inscriptions about
points TN,
7 = right - the font for comment TR,
8 = status - the font for статусной strings(lines),
9 = font1 - the font, defined the user,
...
17 = font9 - the font, defined the user.
library
The name of the font library depending on the operating system and
current implementation ChartLib. In the present version two libraries of
fonts are supported:
Win - the fonts of a Windows used at drawing
in the window and EMF files or BMP;
GdFont - the fonts used at creation of GIF
files.
To each style style there corresponds(meets) the defined font in each
library library. The parameter can not be lowered(omitted).
family
The name of the set of the font, accepted in the given font library
library.
width
Width of characters in pixels. If width parameter is lowered(omitted)
or equal to zero, the proportional font is selected.
height
Height of characters in pixels.
flags
Flags of additional properties of the font, encoded by characters:
B - bold,
b - bold,
I - oblique,
U - underlined,
S - crossed.
If flags parameter is lowered(omitted), the normal font is selected.
angle
Corner of turn of the font in degrees counter-clockwise. If it is lowered(omitted),
0 - the text allocates horizontally from left to right.
Example:
*DefFont title = Win: Times
New Roman, 8x20, BI
*DefFont title = GdFont: Courier, 9x15,
BI
DefStyle = style_name
To begin definition of style with a name style_name. All subsequent commands
down to the first EndStyle or DefStyle will not be executed and to be remembered
in the command list of style.
The saved command list (style) can be applied in the further to any
area, including to a slide, with the help of Style command. {Style}
EndStyle
To complete definition of style.
Advice:
It is important to not forget this command at the end of definition
of style. Otherwise all subsequent commands will not be fulfilled and to
be remembered in style.
Syntax = usage1 { symbols1}...
usageN { symbolsN }
To place(install) syntax of an input stream of the data. To each character
of string(line) symbolsi The role usage is assignedi
. Roles are set by one-letter codes:
C - valid characters of the beginning of
controlling command
N - valid characters - separators of decimal
signs in numbers
T - valid characters - separators of hours
- инут-секунд
D - valid characters - separators of day
- месяца-года
F - valid characters - field separators in
strings(lines) of the data
Q - two characters for the left and right
quote in strings(lines) of the data
In strings(lines) symbolsi It is authorized to specify
unprintable special symbols.
By default entry syntax is given by the command
*Syntax = C {*} N. T {:} D {/} Q
{" "} F {\t,}
Locale = text
To place(install) localization (installations of the country and the language)
by rules of setlocale function of C language. The string(line) of the description
text can accept values eng, rus, american, deu,
fra,
and others. The given command influences only the format of output of numbers
and dates. The format of input is installed by Syntax command. {Syntax}
Encoding = char
Specifies the coding of an input stream of strings(lines). Char character
can accept only 4 values:
W - the coding of Windows CP-1251,
D - the coding of a DOS alternate,
K - coding KOI-8,
I - coding ISO-8859-5.
If the parameter is not given, strings(lines) of an input stream will
not be recoded.
OutEncoding = char
Specifies the output coding at creation of tables and output of the information
on points a graphics. By default W.
SystemDate = date
SystemDate = today
The date installed automatically for values of type date / time if time
is indicated only. If SystemDate parameter is not given, system (today's'
date by default takes. The same effect is reached(achieved) by the second
form of the command.
Include filename
To include in an input stream of strings(lines) contents of a text file
of CHD format with a name filename.
Commands:
Resources of debugging
Debug commands are intended for reset of the housekeeping information in
files. During operation the library can generate files of three types:
-
The broad gully - file. Contains the protocol of all error
messages by way of their arrival. The name of the broad gully - file is
installed by interface CL_WorkDebug function. The broad gully - file is
disabled by call CL_WorkDebug (0). By default the broad gully - file is
disconnected. {CL_WorkDebug}
-
The dump - file. It is used for obtaining the auxiliary and debug
information by **Dump * commands. Includes / disables DumpFile command,
it is by default disconnected. {DumpFile}
-
The echo - file. Contains an exact copy of an input stream of strings(lines),
including the data transmitted through interface CL_DataVector function,
but not including the data transmitted through CL_DataMatrix.
Includes / disables EchoFile command, it is by default disconnected. {EchoFile}
{CL_DataVector}
DumpFile [filename]
Installs a name of the debug file in which the information is output
by debug **Dump * commands. If the filename is lowered(omitted), all subsequent
debug commands will be ignored. The name of the debug file can coincide
with a filename of the protocol of errors, устанавленного with the help
of interface CL_WorkDebug function. {CL_WorkDebug}
DumpData expr
Outputs in the debug file a vector of the data given with the help of expression
expr.
Usually as expressions text strings(lines)
with inserts are used.
DumpDataStructure
Outputs in the debug file the information on all vectors in all matrixes
of the data on a current slide.
DumpSeriesStructure
The graphics outputs in the debug file the information on all vectors in
all series of points current.
DumpSlideStructure
Outputs in the debug file the information on all areas on a current slide.
DumpSlidesList
Outputs in the debug file the list of all accessible slides.
DumpPcode expr
Outputs in the debug file result of compilation (pseudocode) of expression
expr.
EchoFile [filename]
To include copying an input stream of strings(lines) in the file with a
name filename. If the filename is lowered(omitted), the echo will be disconnected.
Echo str
Outputs in the file - protocol string(line) str. The string(line) should
not be quoted.
Commands:
Out-of-date commands
These commands are properties of Chart object on panels such as 2D. All
of them are connected to Format command working in early versions of the
library.
All these commands, and also properties of series DR,
DB, DT in the further can not be supported.
Format = format
The formatted string(line) format sets structure of one or several series
of points and defines(determines) structure of columns of a matrix of the
data. If the current matrix of the data already contains columns the new
matrix creates.
Controlling Format command combines in itself NewData commands, Let
and Series. Owing to the extreme congestion she(it)
will not be supported in the following versions of the library. Matrix
commands are closely connected to it(her), MatrixClear, MatrixEnable and
SeriesSize
also considered out-of-date. Instead of them it is recommended to use NewData
commands, Data,
ClearData,
ResizeData,
SeriesOn
and SeriesOff. {NewData} {Matrix}
{NewData}
Format command sets properties of series with the help of the property
list the same as it is done(made) with Series command, but with the following
differences:
-
It is possible to set at once some series in one command, having
separated their characters / or \;
-
As values of properties it is authorized to set not only numerical constants,
names of columns of the data and variables, but also the arbitrary expressions
made in parentheseses, and also string constants with inserts;
-
For property can be not indicated in general any value (the equal-sign
in this case also is omitted(dropped));
-
The command defines(determines) a new matrix of the data which columns
correspond(meet) to all properties of all series for which it is not indicated
any value;
-
If property X for a series is lowered(omitted), it will be taken for the
previous series.
Format command reduces number of necessary commands, but does(makes) the
description a graphics by less legible. For example, the following two
descriptions create the same diagram:
The description 1
*Let x = pointno/10-4
*Let y = exp (-x^2/2)
*Let z = FNorm (x)
*Series p: X=x Y=y S=0 LC=13 LW=2
*Series f: X=x Z=z S=0 LC=33 LW=2
*SeriesSize 80:
f, p
The description 2
*Format X = (pointno/10-4) Y = (exp
(-X^2/2)) S=0 LC=13 LW=2...
\ Z = (FNorm (X)) S=0
LC=33 LW=2
*SeriesSize 80
SeriesSize = size: name1 ...,
nameN
To place(install) number of points in series with names name1
..., nameN Equal size. The number of points is usual is defined(determined)
automatically at reading an input stream of the data. The command is necessary
only in that case when all properties of the indicated series are given
by constants or computable columns of the data.
If the list of series is lowered(omitted), the last created series
takes.
Matrix = n
Matrix = name
To make active a matrix of the data with number n or a name name. If such
matrix still is not present, she(it) will be created. All subsequent strings(lines)
of the data down to other Matrix command or Format
will be routed to the given matrix. Indexing of matrixes starts with zero.
The name of Matrix command can be reduced up to one M character.
MatrixClear [= n]
To clear a matrix of the data with number or a name n. If the name or number
are not indicated, the matrix is cleared active at present. The command
deletes only the data, not mentioning formats. The graphics is used for
rearrangement.
MatrixClear command operates only on series available at present, therefore
she(it) should be given after Format command.
MatrixEnable = [n], b
To show or hide all series of points stored(kept) in a matrix with number
or a name n. If the name or number are not indicated, the command concerns
to an active matrix. As against MatrixClear, installation MatrixEnable
= off does not delete the data but only cleans(removes) appropriate
series of points with a graphics. By default on.
MatrixEnable command operates only on series available at present,
therefore she(it) should be given after Format command.
Color of any object on a slide sets number in the graphic palette. Examples
of the commands specifying color, are Color and BorderColor.
Colors of points in Series command also are set by numbers in the graphic
palette with the help of color properties of
series C, G, LC, LG, FC, FG. {Series}
The standard graphic palette of ChartLib library contains 27 colors
with numbers from 0 up to 26. DefColor command allows to add new colors
and to reassign already available. The changes made in a color box, are
global, and influence all slides and films. {DefColor}
Properties of series
Appearance of a series of points on a graphics is defined(determined) by
a set of its(her) properties. Each property can be or common for all series,
or individual for each point. If property is not given, it is accepted
equal to a standard default value. Names, sense and standard values of
all properties are enumerated below.
A series creates Series command. Each property of a series sets one
or a two-letter name which the equal-sign and value follows. Value should
be either a numerical constant, or a name of a column of the data defined
by NewData commands or Let. Properties are divided by
commas or blanks. {NewData} {Series}
For example, the following command will derivate a new series with a
name priceline:
*Series priceline: X=time Y=price
S=0 LP=2 LC=1
In this series of coordinate of points X and Y are set by columns of the
data time and price accordingly. Properties S, LP and LC are identical
to all points of a series. All other properties have standard values.
The created series can be reassigned anew, repeatedly having set Series
command with the same name of a series and other values of properties.
For example, to replace red color of lines on dark blue, it is necessary
to give the command
*Series priceline: X=time Y=price
S=0 LP=2 LC=3
The same result is reached(achieved) by shorter command:
*SeriesModify priceline: LC=3
SeriesModify command has the same syntax, as Series, but as against last
does not create a series anew but only changes the indicated properties.
{SeriesModify}
The name of a series can be omitted(dropped) at creation of a series.
However if after that to define(determine) one more series access to the
first for Series commands, SeriesOn, SeriesOff,
SeriesModify and SeriesSize will be closed for ever.
The number of points in a series is equal to maximum length of columns
of the data indicated in properties of a series. Usually all columns have
identical length, however this condition is not mandatory. Missing values
are interpreted as empty.
If properties of a series do not refer to one column of the data defined
by NewData command the number of points in such series is by default equal
to zero. That in the obvious image to set number of points, it is necessary
to use SeriesSize command or ResizeData. {SeriesSize}
{NewData}
Points are represented on a graphics by figures of the fixed size in pixels.
X
Xcoord; X-coordinate of a point. If for the given series X parameter is
not indicated, it(he) takes from the previous series. If thus the given
series is the first in a matrix X it is necessary equal to number of a
point (indexing of points starts with 0). Property X is incompatible with
TX.
Y
Ycoord; Y-coordinate of a point. Property Y is incompatible with TY, Z
and MC.
Z
Zcoord; the alternate Y-coordinate of a point, which axis is displayed
on the right. If the point has Z parameter Y parameter is ignored.
TX
TextX; the Label of a point output on a horizontal axis instead of X-coordinate.
Property X is ignored, points allocate on axis X with uniform step FIFO,
since zero.
TY
TextY; the Label of a point output on a vertical axis instead of Y-coordinate.
Properties Y, Z, MC are ignored, points allocate on axis Y with uniform
step FIFO, since 0.
C
Color; the color number of a point. In the graphic
palette 27 colors with numbers from 0 up to 26 are predetermined, and
it is possible to define(determine) others with the help of DefColor command.
{DefColor}
By default C it is equal to number of a series.
G
Gradient; the second color of a point, also sets number in the
graphic palette. It is ignored, if I parameter is not given.
By default G=0 - black.
I
Intensity; intensity. If I parameter is not indicated, color of points
in a series is defined(determined) only by C parameter. Otherwise color
is calculated so that at minimum option value I it(he) was equal C, and
at maximum - G. At intermediate values I color C smoothly passes in G.
W
Weight; a dot pitch in pixels. If not it is given, takes W=5. If W=0, the
point is not represented.
S
Shape; the form of a point. If S=0, the point is not represented. Valid
values are given in the table:
If the point has property TI its(her) size is installed under text TI which
is represented inside a point. Thus property S regulates the form of the
figure concluding this text:
K
Key; key number of a point. Any two points on a graphics can be connected
a line called as pair connection (is (see lower). For this purpose
both points should have key numbers. To connect it is possible the points
which are taking place both in one series, and in different. Any two points
on one to graphics should not have identical numbers K.
By default the point has no key number and can incorporate only to
an adjacent point.
U
Usage; modes of usage the points set by the sum of the following values
(by default 16):
U=1 - mandatory preliminary plotting of a point;
U=2 - mandatory preliminary plotting of a line;
U=4 - mandatory preliminary plotting of flood filling;
U=8 - the mandatory registration of a point at autoscaling;
U=16 - the registration of a point at autoscaling
if she(it) has a size;
U=32 - to not display обводку a point.
TI
TextInside; the text inside a point. At output of the text the point extends
up to a size of the minimum rectangle containing the text. Multilower
case texts are admitted, a separator of strings(lines) is the pair "\n
characters.
A little the sense of properties S (the form of a point) and W (dot
pitch) varies. Property S will update an outline of a rectangle, adding
to it(him) hanging indents of the various form (see the table). Property
W sets the value of hanging indents.
TN
TextNear; the text near to a point. Multilower case texts are admitted,
a
separator of strings(lines) is the pair "\n characters.
TR
TextRight; the text output at activation of a point by the right key of
the mouse. Multilower case texts are admitted, a separator of strings(lines)
is the pair "\n characters.
Cвойство works only at output a graphics in the window.
TB
TextStatusBar; the text output in статусную string(line) when the mouse
pointer stops on a point.
Cвойство works only at output a graphics in the window.
TT
TextTable; the text output in the summary table of selected points. A separator
of columns is the character ";". If the point has no field TT, by default
in the table coordinates of a point are output.
Cвойство works only at output a graphics in the window.
TQ
TextQuery; the text which is given out on search of the information on
a point through interface CL_ChartGetPointInfo function. {CL_ChartGetPointInfo}
TC
TextColor; color of texts TN, TR and TI, sets number in the
graphic palette. By default black.
If properties BX, BY, BZ are given, the point is represented not by a figure
of the fixed size in pixels, and boxing. The boxing is a rectangle on bidimentional
to a graphics or a parallelepiped on three-dimensional to a graphics. Properties
X, Y, (Z) and BX, BY, (BZ) set coordinates of two opposite corners of boxing.
To boxings all properties of points except for W are applicable(applied).
BX
BoxX; the second coordinate on axis X. The width of boxing along axis X
is equal |X-BX |.
BY
BoxY; the second coordinate on axis Y. The width of boxing along axis Y
is equal |Y-BY |.
BZ
BoxZ; the second coordinate on axis Z. The width of boxing along axis Z
is equal |Z-BZ |.
A series is considered гистограммной if she(it) contains one of properties
HS or HW. In current implementation ChartLib on a graphics there can be
only one histogram (this limitation will be removed in the further). She(it)
is created on all points of all гистограммных series. Thus on the histogram
can be superimposed usual a graphics.
HS
HistSort; values on which points are ordered in columns of histograms.
If not it is indicated, points allocate FIFO.
HW
HistWeight; weight (contribution) of a point in a column of the histogram,
by default 1.
Exchange a graphics differ that, that instead of points on them candles
are represented. The candle has four Y-coordinates: the price of opening,
a ceiling price, a floor price and the price of closing.
Strings(lines) in a matrix of the data correspond(meet) either to separate
bargains, or time slices. In the first case it is enough to set MC equal
to the price (or to size) bargains. In the second case it is necessary
to set all four MO parameters, MH, ML, MC. In both cases the form свечей
is calculated according to CandleWidth parameter which sets duration of
all свечей in seconds.
X
Xcoord; X-coordinate of a point in seconds. For correct calculation свечей
it is necessary, that points of an input stream followed in the chronological
order.
MC
MarketClose; the last value on a time slice (for example the price of closing
or the price of the last bargain). MC parameter is mandatory for the points
used at creation of exchange diagrams. If the point has MC properties Y
and Z are ignored.
MO
MarketOpen; the first value on a time slice (for example the price of opening
or
the price of the first bargain). If MO parameter is absent for a point,
by default it is necessary MO=MC.
MH
MarketHigh; maximum value on a time slice. If the point does not have MH
parameter, by default it is necessary MH=MC.
ML
MarketLow; minimum value on a time slice. If the point does not have ML
parameter, by default it is necessary ML=MC.
MS
MarketStyle; style of a candle. If MS=0, the candle is not represented.
Style of interval histograms with the prices of opening and closing (MS=1)
is by default placed(installed). Valid values are listed in the table:
MT
MarketTrades; number of the points (bargains) forming a candle. This parameter
does not influence the map of a candle and is used only for output of text
comments TN, TR or TB, containing variable CandleCount (is (see lower).
C
Color bull (MO < MC) candles at MS=2 or 3, sets number in the
graphic palette.
By default C=7 - white.
G
Color bear (MO > MC) candles at MS=2 or 3, sets number in the
graphic palette.
By default G=0 - black.
I
Intensity; intensity. If I parameter is not indicated, color свечей is
defined(determined) only by C parameters and G. The rule otherwise operates:
the above I, the color is closer to average between C and G.
LC, LG, LI
Define(determine) color of an outline of a candle the same way, as well
as color of lines (is (see lower).
TN, TR, TB
Text properties have for свечей the same sense, as for points. If text
property sets with the help of expression in it(him) is admitted to use
variable
- parameters of a current candle.
Cвойства TR and TB work only at output a graphics in the window.
Lines it is possible to connect sequential points of one series, or appropriate
points of adjacent series. For connection of arbitrary points it is necessary
to use pair connections.
LC
LineColor; color of a line, sets number in the
graphic palette. The parameter is similar C.
By default LC it is equal to number of a series.
LG
LineGradient; the second color of a line, sets number in the
graphic palette. The parameter is similar G.
By default LG=0 - black.
LI
LineIntensity; intensity of a line. The parameter is similar I.
LW
LineWeight; line width in pixels. If not it is given, LW=1.
LS
LineShape; the form of a line. By default LS=1. Valid values are listed
in the table:
LP
LinePath; the form of a trajectory. By default LP=1. The line is not drawn,
if LP=0. Valid values are listed in the table:
LD
LineDirection; a direction of a line. By default LD=1.
LD=0 - there is no line,
LD=1 - the line connects a current point with following
in series,
LD=2 - the line connects a current point to the
same point in a following series,
LD=3 - both lines are drawn.
For the last series lines of type 1 can be displayed only.
LA
LineArrow; the type of arrow. By default LA=0. Valid values are listed
in the table:
A series containing properties PA and PB, describes lines, instead of points.
The ends of each line are set by key numbers of connected points. All properties
of such series, except for parameters of line LC, LG, LI, LW, LS, LP, LD,
LA, are ignored. If one of properties PA or PB is indicated only, all series
is ignored. To connect it is possible any points even if they are in different
series. It is impossible to connect the points which are taking place on
different panels.
PA
PairA; key number of the first point of a segment. Pair connection is ignored,
if any of points a graphics has no the key number K conterminous to value
of property PA.
PB
PairB; key number of the second point of a segment. Pair connection is
ignored, if any of points a graphics has no the key number K conterminous
to value of property PB.
LB
LineStatusBar; the text output in статусную string(line) when the mouse
pointer stops on a line. Property LB is applicable(applied) only to pair
connections, but not to the segments connecting adjacent points (is (see
higher).
Cвойство works only at output a graphics in the window.
It is possible to adhere flood filling to any point. Property FD installs,
what else points should be used alongside with current for definition of
the form of flood filling.
FC
FillColor; color of flood filling, sets number in the
graphic palette. The parameter is similar C.
FG
FillGradient; the second color of flood filling, sets number in the
graphic palette. The parameter is similar G.
FI
FillIntensity; intensity of flood filling. The parameter is similar I.
FS
FillShape; the form of flood filling. Color of hatching sets properties
LC, LG, LI. By default FS=1. Valid values are listed in the table:
FD
FillDir; a direction of flood filling from a line connecting current and
following points in a current series. If FD=0, flood filling is not represented.
By default FD=1. Valid values are listed in the table:
FP
FillPath; the form of the trajectory connecting adjacent points in a current
series. The parameter is similar LP. By default FP=1.
The outline of flood filling is defined(determined) by pair properties
FD and FP. For example, the following table differs from previous that,
that instead of FP=1 was given FP=3:
Properties DB, DR, and DT are entered that in Format command it was possible
to define(determine) the columns of the data not having direct assignment
and used only in expressions. In each series it is possible to set some
data fields. {Format}
As well as Format command, these properties are
anachronisms and, probably, will not be supported in the following versions
of the library. Instead of them it is necessary to use Let command. {Let}
DB
DataByte; the Data such as Byte (integers).
DR
DataReal; the Data such as Real (real numbers).
DT
DataText; the Data such as Text (text strings(lines)).
Usage of expressions
ChartLib library is equipped with the built - in calculator of expressions.
Expressions are used mainly in Let commands and Format
for definition of computable columns in matrixes of the data. Besides expressions
are set in Status commands, DumpData, DumpPcode
and in interface CL_ChartGetXYInfo function. {CL_ChartGetXYInfo}
{Status} {Let}
Expressions are created from variables, constants, signs of operations,
functions, and brackets of any level of an enclosure.
In a role of variables names of columns of the data entered by NewData
commands and Let appear. Names of variables can consist
of any characters, however if the name contains special symbols (signs
of operations, brackets) or blanks, it is necessary to conclude it(him)
in apostrophes. {NewData}
The scope of names is limited to a current slide. To address to the
column of the data defined on the other slide, it is necessary to use "
a name with a point ":
ИмяСлайда. ИмяСтолбцаДанных
Names of the variable and predetermined constants are case-sensitive, for
example PI is a constant, and pi - a variable; variables XYZ and xyz are
various. At the same time names of functions are not case-sensitive, for
example sin, SIN and Sin - three correct function names of sine.
Expressions:
Data types and constants
Valid data types:
-
Logical bool (0 or 1);
-
Whole int (4-байта);
-
Material with double precision real;
-
String string (strings(lines) of arbitrary length);
-
Date - time datetime (number of seconds, past since January, 1 1970);
-
Error error.
Cast coercion in expressions is carried out automatically, but it is possible
to use also transfer functions (see below). Bool types and datetime are
subsets int. At coercion of numerical types to bool positive values will
be transformed in true, negative and 0 - in false. Error type is equivalent
string and contains error message.
It is possible to set integer constants both in a decimal number system,
and in binary or hexadecimal, for example:
0b0100.1010 - binary 74
0xFFFF - hexadecimal 65535
In binary and hexadecimal constants the point is for visual separation
of bits and at calculations is ignored.
Real constants are set or in the exponential form, or with a floating
point: 2.345e+8, 345E-8, 20.345.
String constants are written in rabbit
earses. It is possible to include characters in string constants with any
codes, including quotes and unprintable special symbols:
\ooo - the character given by decimal
ooo code
\xHH - the character given by hexadecimal
HH code
\a - AlertBel character, \x07
\b - Backspace character, \x08
\t - HorizontalTab character, \x09
\n - Newline character, \x0A or \x0D
\x0A
\v - VerticalTab character, \x0B
\f - Formfeed character, \x0C
\r - CarriageReturn character, \x0D
\\ - the character of return(converse)
слэша \
\ " - the character of a rabbit ears "
Constants of date - time are set as string with conversion of type:
datetime (" 2005/08/21 11:15:20 "). By default a separator of year, month
and day in dates is the character "/". The separator can be changed Syntax
command.. {Syntax}
Non-initialized values to which in a matrix of the data there corresponds(meets)
skip or???, matter empty. Conversion empty to numerical types gives 0,
to the string type - "empty".
By default in the library values of some constants which can be used
in all expressions are predetermined:
empty;
false = int (0);
true = int (1);
PI = 3.1415926535897931;
MINUTE = long (60);
HOUR = long (60 * 60);
DAY = long (60 *
60 * 24);
WEEK = long (60 * 60 *
24 * 7);
There are the predetermined variables used in various contexts.
Characteristics of a current matrix of the data
Are used mainly for construction of diagrams of the functions set analytically,
instead of a data table. Are admitted(allowed,valid) in Let command. {Let}
RowIndex |
Line number in a matrix (indexing of strings(lines) starts with zero) |
RowsCount |
Number of strings(lines) in a matrix |
Characteristics of a current candle
The group of variables is intended for output of the text information to
exchange diagrams. These переменые are used in the expressions specifying
text comments TN, TR, TB in candle
series.
CandleLeft |
X-coordinate of a left edge of a candle |
CandleRight |
X-coordinate of a right edge of a candle |
CandleOpen |
Y-coordinate of the first point of a candle (the price of opening) |
CandleClose |
Y-coordinate of the last point of a candle (the price of closing) |
CandleLow |
Minimum Y-coordinate of points of a candle |
CandleHigh |
Maximum Y-coordinate of points of a candle |
CandleCount |
Number of points by which the candle is derivated |
Characteristics of a point of a slide
The group of variables is used in two contexts:
-
In Status command for creation of the text статусной the strings(lines),
output at cursor update of the mouse; {Status}
-
In the expressions transmitted to interface CL_ChartGetXYInfo function
for obtaining of the information on a point of a series, the nearest to
the indicated point of a slide. {CL_ChartGetXYInfo}
CoordX,
CoordXText |
The X-coordinate of a mouse pointer enumerated in real coordinates |
CoordY,
CoordYText |
The Y-coordinate of a mouse pointer enumerated in real coordinates |
CoordZ,
CoordZText |
The Y-coordinate of a mouse pointer enumerated in real coordinates
concerning axis Z if she(it) is present on a graphics. |
CoordXStart,
CoordXStartText |
X-coordinate of a mouse pointer in an index point at selection of the
rectangular area, enumerated in real coordinates |
CoordYStart,
CoordYStartText |
Y-coordinate of a mouse pointer in an index point at selection of the
rectangular area, enumerated in real coordinates |
Variables with suffix Text contain the values of coordinates optimally
formatted in view of a current scale a graphics.
Expressions:
Strings(lines) with inserts
The string(line) with inserts is the expression by the form reminding a
string constant inside of which it is inserted one or several expressions
in square brackets. Strings(lines) with inserts are used for abbreviation(cutting)
of recording of concatenations and formatting of numerical values. For
example, the following expressions are equivalent, but the latter has the
most understandable recording:
" The Number пи = " and PI and ",
is more exact пи = " and format (" % .16f ", PI) and "."
" The Number пи = [PI], is more exact пи
= [PI %.16f]. "
Result of both expressions will be string(line)
The number пи=3.14159, is more exact
пи=3.1415926535897931
After an expression - insert the format of the output can follow, starting
is familiar % and proceeding up to closing square brackets. The same formats
of output are used in format function.
Expressions:
Formats of output of numbers
Numerical formats are used in strings(lines)
with inserts and in format function.
Formats are set by rules of printf function of the language With. The
numerical format contains the sign of % which optional parameters follow:
-
[flag] - a combination of flags-, +, 0, a blank, *;
-
[width] - minimum length of output string(line) in characters;
-
[.prec] - number of signs after a comma at output of real numbers.
Also it is completed by one of key d characters, i, o, u, x, X, f, e, E,
g, G.
% [flag] [width] d or i |
Integer with it is familiar |
% [flag] [width] u |
Integer without the sign |
% [flag] [width] o |
Octal integer without the sign |
% [flag] [width] x |
The hexadecimal whole without the sign, capital letters a, b, c, d,
e, f are used |
% [flag] [width] X |
The hexadecimal whole without the sign, capital letters A, B, C, D,
E, F are used |
% [flag] [width] [.prec] e
% [flag] [width] [.prec] E |
Material in экспоненциальнойформе: 1.2e4, 3.1E-4 |
% [flag] [width] [.prec] f |
Material with a floating point: 12000.0, 0.00031 |
% [flag] [width] [.prec] g
% [flag] [width] [.prec] G |
Shortest of two формe and f |
Expressions:
Formats of dates and times
Formats of dates and times are used in strings(lines)
with inserts and in format function.
Formats are set by rules of strftime function of the language With.
As against numerical formats any quantity(amount) of formats of date -
time can be united for output of one value. For example, result of expression
" Today [now () % *d %B %Y, %A, %H:
% M: % S]. "
There will be a string(line) of sort
Today 4 February 2000, Monday, 15:04:55
The optional argument [flag] can accept only one value *. For formats of
% *c and % *x it(he) outputs date in more detailed form. For other formats
- deletes leading zero (4 instead of 04).
% [flag] c |
Standard performance of date and time |
% [flag] x |
Standard performance of date |
%X |
Standard performance of time |
% [flag] Y |
Four-unit year (from 1970) |
% [flag] y |
The last two digits of year (from 00 up to 99) |
%B |
The complete name of month |
%b |
The reduced name of month |
% [flag] m |
Number of month (from 01 up to 12) |
% [flag] d |
Day of month (from 01 up to 31) |
% [flag] H |
Hours (from 00 up to 24) |
% [flag] I |
Hours (from 00 up to 12) |
%p |
The indicator till midday / after midday |
% [flag] M |
Minutes (from 00 up to 59) |
% [flag] S |
Seconds (from 00 up to 59) |
%a |
The reduced name of day of week |
%A |
The complete name of day of week |
% [flag] w |
Serial number of day of week (0=воскресенье, 1=понедельник..., 6=суббота.) |
% [flag] j |
Serial number of day in one year (from 001 up to 366) |
% [flag] U |
The serial number of week in one year (from 00 up to 51) if week starts
with Sunday |
% [flag] W |
The serial number of week in one year (from 00 up to 51) if week starts
with Monday |
%z
%Z |
The complete and reduced name of time zone |
Formats of date - time d, x, X clash with the same numerical formats.
If one of these characters appeared last in the format of date - time,
after it(her) it is necessary to put T character:
" Today [now () % *xT]. "
Expressions:
Operations and their priority
In expressions the following operations (are admitted by way of rise of
priority):
, |
Sequential calculation |
: = |
Assignment |
or |
Logical OR |
and |
Logical And |
not |
Logical NOT |
<=> = < > < >
= |
Operations of matching |
|
Concatenation of strings(lines) |
+ - |
Arithmetic addition and subtraction |
* / mod |
Arithmetic multiplying, division and the rest |
^ |
Exponentiation |
The priority of operations can be changed with the help of brackets.
Operations of assignment and sequential calculation are used for abbreviation(cutting)
of recording and rise of speed of calculations. The sense of these operations
and their usage are completely similar to C language. For example, the
following two expressions produce the same result, but the second is calculated
more effectively:
exp (23.67*x*x+1.2905*x-45.892) +
1/exp (23.67*x*x+1.2905*x-45.892)
T: = exp (23.67*x*x+1.2905*x-45.892),
T+1/T
Result of the operation of assignment is value of expression to the right
of the sign: =.
Result of the operation of sequential calculation is the last expression
in the list.
Variables, standing assignments in the left part are local variables
of the given expression and should not coincide with names of columns of
the data.
Small difference from traditional programming languages is present in
operations of matching. Recording 0 < = x < 1 is correct and is abbreviation(cutting)
of longer expression 0 < = x and x < 1, that is has usual
mathematical sense. Chains of matchings of the arbitrary length, including
any of 6 operations of matching, for example 0 < x < = y1 = y2 >
1 are admitted.
Functions generally can have arbitrary number of arguments which are written
after a function name in brackets through a comma.
On number of arguments of the function are divided into 4 groups:
-
Functions with the fixed number of arguments (sqrt, sin, exp, mod).
-
Functions with optional arguments (log, rand, setbit).
-
Functions with arbitrary number of arguments (min, if, steps, xor).
-
Functions without arguments (now (), rand ()).
For functions without arguments empty brackets are mandatory.
Below the complete list of valid functions with their specifications
and descriptions is resulted. Specifications specify types of all arguments
and returned value.
Specifications are resulted as
имя_функции (типы_входных_аргументов): тип_значения
Optional arguments consist in square brackets []. Arguments which can repeat
more than once, consist in curly brackets {}. The word any means,
that the argument can have the arbitrary type.
Expressions: Functions of type conversion
Bool (any): bool
Conversion any in the logical type
Int (any): int
Conversion any in the whole type
Real (any): real
Conversion any in the material type
String (any): string
Conversion any in string the type
Datetime (any): datetime
Conversion any in date and time
Expressions: Functions of check of values
IsEmpty (any): bool
TRUE if any empty or erratic
IsNumber (any): bool
TRUE if any it is resulted(brought) in real type
IsTime (any): bool
TRUE if any it is resulted(brought) to datetime
Expressions: Numerical functions with the fixed
number of arguments
Abs (real): real
Absolute value (unit) of number real
Sign (real): int
сигнум numbers real, accepts values:-1 at real < 0;
0 at real=0; 1 at real > 0
Max ({real}): real
Maxima of numbers
Min ({real}): real
Minimum of numbers
Sqrt (real): real
The square root of number real
Sin (real): real
Sine of number real
Cos (real): real
Cosine of number real
Tg (real): real
Tangent of number real
Arcsin (real): real
Arcsine of number real
Arccos (real): real
Arccosine of number real
Arctg (real): real
Arctangent of number real
Sh (real): real
Hyperbolic sine of number real
Ch (real): real
Hyperbolic cosine of number real
Th (real): real
Hyperbolic tangent of number real
Exp (real): real
Exponential curve of number real
Log (real, [real2]): real
Log real1 on the basis real2, or natural if real2 it is lowered(omitted)
FNorm (real, [real1], [real2]): real
The function of normal allocation with МО=real1 and СКО=real2.
If real2 it is lowered(omitted), it is necessary МО=0, СКО = real1.
If real1 and real2 are lowered(omitted), it is necessary МО=0, СКО=1.
rand ([real1], [real2]): real
Random number from a range [real1, real2), [0, real1) or [0,1)
round (real): real
Roundoff up to the nearest the whole
upround (real): real
The nearest greater or equal the whole (ceiling)
dnround (real): real
The nearest smaller or equal the whole (floor)
Xor (bool, {bool}): bool
Logical eliminating OR
Expressions: Bit functions for integers
Bit (int1, int2): bool
int2-ый Bats in an integer int1
SetBit (int1, [int2], [bool]): int
To place(install) int1-ый bats of number int2 (0 if it is lowered(omitted))
in bool (1 if is lowered(omitted))
NotBit (int): int
Bit negation
OrBit (int, {int}): int
Bit OR
AndBit (int, {int}): int
Bit And
XorBit (int, {int}): int
Bit eliminating OR
Expressions: Functions for operation with date
and time
now (): datetime
Current date - time
time (any): datetime
Conversion any in datetime with selection of time
date (any): datetime
Conversion any in datetime with selection of date
year (datetime): int
Selection of year from datetime
month (datetime): int
Number of month in one year, indexing with 1
day (datetime): int
Number for in one month, indexing with 1
hours (datetime): int
Selection of hours since midnight from datetime
minutes (datetime): int
Selection of minutes from datetime
seconds (datetime): int
Selection of seconds from datetime
WeekDay (datetime): int
Number of day of week, ВС=0, ПН=1..., СБ=6
YearDay (datetime): int
Number of day in one year
Expressions: Functions for operation with strings(lines)
len (string): int
Length of string(line)
pos (string1, string2): string
The position of string(line) string2 in string(line) string1,
or (-1) if not is retrieved; indexing of characters of string(line) starts
with 0
left (string, int): string
Head part of string(line) in length int
right (string, int): string
Tail of string(line) in length int
mid (string, int1, int2): string
Average part of string(line) since a position int1 in length
int2, indexing with 0
format (string, any): string
Formatted output any according to the specification given in
string
Expressions: Conditional and threshold functions
if ({bool1, any1}, [anyLast]): any
The conditional, returns:
any1, if bool1=TRUE,
any2, if bool2=TRUE,
... And so on...,
anyLast if all odd arguments are equal FALSE.
steps (real1, {real}): int
The step-function, returns:
0, if real1 < real2,
1, if real2 < =real1 < real3,
2, if real3 < =real1 < real4,
... And so on...
switch (any, {any1, any2} [anyLast]): any
The switch of values, returns:
any2, if any=any1,
any4, if any=any3,
... And so on...
anyLast if all equalities are not true.
API: functions of ChartLib library
To use functions of ChartLib library in the program on With or With ++,
it is necessary to include heading cl.h file in the project:
*include "cl.h"
Operation with ChartLib library includes the following mandatory steps:
-
Initialization of the library by CL_WorkStart function. {CL_WorkStart}
-
Creation of a slide by CL_DataLine functions, CL_DataVector,
CL_DataFile.
{CL_DataLine}
-
Creation new рисователя CL_DrawerCreate,
or activation of old CL_DrawerUse.
-
Installation of sizes of slide CL_SlideSetRect
on a surface рисователя, in pixels.
-
Installation of viewport for all diagrams on slide CL_SlideMaxZoom
or CL_ChartSetZoom.
-
Optimal allocation of areas on slide CL_SlideRefresh.
-
Drawing of a slide entirely CL_SlideDraw, or
portions CL_SlideBeginDraw and CL_SlideContinueDraw.
-
The termination(ending) of operation CL_WorkFinish.
Transmission of strings(lines) to the library and from the library is carried
out through clString type:
typedef const char* clString;
By transmission of strings(lines) it is necessary to observe two rules:
-
If the string(line) is for data transfer in the interface function
she(it) transfers as clString and the library can not update her(it).
-
If the string(line) is for returning the data from the interface function
she(it) transfers as clString* and calling(causing) program should not
update her(it).
API:
the error Codes, returned by the interface functions
All functions of the library return an integer, non-negative in case of
successful completion. If the result of the function is less than zero
it is an error code.
CL_ERR_NOTSTARTED =-1001;
// the library was not initialized by CL_WorkStart function
CL_ERR_CANTSTART =-1002;
// it is impossible to initialize the library
CL_ERR_EXCEPTION =-1005;
// the exclusive situation caught try-catch
CL_ERR_OPENLOG =-1008;
// it is impossible to open the broad gully - file
CL_ERR_SLIDE =-1011;
// there is no slide
CL_ERR_CHART =-1012;
// there is no diagram on a slide
CL_ERR_POINTINFO =-1015;
// there is no recording with the information on a point
CL_ERR_DRAWER =-1020;
// it is impossible to create or use indicated рисователь
CL_ERR_DRAWERUPDATE =-1021; // current
рисователь does not support the function of upgrade
CL_ERR_DRAWERSAVE =-1022;
// current рисователь does not support the function of saving
CL_ERR_DRAWERDELETE =-1023; // it is
impossible to delete active рисователь
CL_ERR_FILENAME =-1030;
// the filename is not given
CL_ERR_DATA =-1040;
// data errors are detected
CL_ERR_DATAMATRIX =-1041;
// it is impossible to place(install) structure of a matrix
CL_ERR_DATARECORD =-1051;
// recording for data reading from a vector - column is not defined
CL_ERR_VECTOR =-1052;
// on a slide there is no vector - column with the indicated name
CL_ERR_VECTORSIZE =-1053;
// in vector - column there is no string(line) with indicated number
CL_ERR_VECTOREADONLY =-1054; // it is impossible
to write the data in a vector - column
CL_ERR_AREANOTFOUND =-1060; // the
slide has no such area
CL_ERR_AXIS =-1070;
// the diagram has no axis
CL_ERR_OVERZOOM =-1071;
// exceeding of valid accuracy at scaling a graphics
CL_ERR_NOSERIES =-1081;
// there is no such series
CL_ERR_NOPOINT =-1082;
// there is no such point in a series
CL_ERR_POINTSELECT =-1091; //
the point can not be selected(allocated)
CL_ERR_POINTACTIVE =-1092; //
there is no active point
CL_ERR_UNDERDEVEL =-1999;
// the function yet is not realized
API:
Initialization and completion
int CL_WorkStart ()
Initialization of the library. The function should be called(caused) before
the first call to other functions of the library, for example at start
of the application. Repeated initialization is not an error, and only increases
the counter of initialization.
Returns CL_ERR_CANTSTART if not удаётся to initialize the library.
It is a fatal error, and further usage of the library is impossible.
int CL_WorkFinish ()
Release of the library upon termination of operation. Reduces the counter
of initialization so real release will take place only after CL_WorkFinish
it will be called(caused) as much time, how many it was called(caused)
CL_WorkStart. After real release call to other functions of the library,
except for CL_WorkStart, can result in unpredictable consequences.
int CL_WorkDebug (clString filename, FErrorsHandler
errfunc)
Installation of filename broad gully - file and the external error handler
errfunc. If filename=0, output in the broad gully - file is disabled. If
errfunc=0, external error handling is disabled. By default there is no
neither the broad gully - file, nor external error handling.
For each error, except for purely message, in the broad gully - file
the last transferred(handed) CHD-string and its(her) number, and also the
link to a place in initial C ++ the code in which the given error was detected
is output.
The function of external error handling errfunc is described in clTypes.h
file as follows (the external error handler can not change or release character
strings srcfile, chdline and message):
typedef int (*FErrorsHandler) (
int srcline,
// a line number of the initial code
const char* srcfile, //
a name of a source file
int chdlineno,
// a line number in CHD-stream
const char* chdline, //
processed CHD-string
const char* message
// the text of the message
);
API: Functions
for operation with output devices
int CL_DrawerCreate (TDrawerDef* data)
To create and make active the output device of the given type. Returns
a unit number with which help of it(him) repeatedly it is possible to make
active CL_DrawerUse function. Structure TDrawerDef contains the data necessary
for creation of devices of various types: {CL_DrawerUse}
struct TDrawerDef {
TDrawerType type;
// рисователя type
char* filename;
// a filename for GPT, GIF, WMF
FILE* fout;
// the file open outside of the library, is used if filename == 0
int fhandle;
// the descriptor of the file, is used if filename == 0 and fout == 0
TIntRect Rect;
// rectangular area of drawing
int hdc;
// a context of the device for a Windows - рисователей
};
// Rectangular area in screen coordinates
struct TIntRect {
int x1, y1;
int x2, y2;
};
// Types of devices
enum TDrawerType {
CL_DRAWER_NO = 0,
// the type is unknown
CL_DRAWER_BUF = 1,
// the buffer in memory
CL_DRAWER_GPT = 2,
// debug text file GTP
CL_DRAWER_GIF = 3,
// the GIF-file
CL_DRAWER_WIN = 4,
// the window or other context of the device of a Windows
CL_DRAWER_WMF = 5,
// a Windows матафайл
CL_DRAWER_EMF = 6
// Enhanced a Windows матафайл
};
For device CL_DRAWER_GIF it is necessary to set a size of area of output
Rect and a filename filename.
For device CL_DRAWER_WIN sets a descriptor of a context hdc.
For devices CL_DRAWER_WMF, CL_DRAWER_EMF sets a filename.
int CL_DrawerUpdate (TDrawerDef* data)
To reinstall parameters of the active device. Call of this function is
necessary directly ahead of the beginning of copying or scaling if parameters
of the device could vary. In particular, it is necessary at drawing in
the window of a Windows.
The device should be preliminary is created by CL_DrawerCreate function.
{CL_DrawerCreate}
int CL_DrawerUse (int drawer)
To make active the output device with number drawer.
The device should be preliminary is created by CL_DrawerCreate function.
{CL_DrawerCreate}
int CL_DrawerSave ()
To save all graphics from the active device in the file given at creation
(CL_DrawerCreate)
or upgrade (CL_DrawerUse) of the device.
Some devices can not support the given function.
The device should be preliminary is created by CL_DrawerCreate function.
{CL_DrawerCreate}
int CL_DrawerDelete (int drawer)
To delete the output device with number drawer.
The device should be preliminary is created by CL_DrawerCreate function.
To delete the device, active in the present moment, it is necessary to
make active any other device all over again. {CL_DrawerCreate}
API: Functions
of operation with the data
This group of functions does not use the device of mapping, therefore the
data can be loaded, not having the active device. All functions accepting
on an input(entrance) number of a slide, return error code CL_ERR_SLIDE
if the current slide is not defined.
int CL_DataVector (int slide, const TInputData*
data)
To add a vector of the data to a slide. Structure TInputData allows to
set a vector, composed of the varied data. It is necessary to take into
account, that fields unused and Type are the 4-byte whole, and a total
size of structure TInputData - 16 bytes:
struct TInputData {
int unused;
TDataType Type;
union {
Byte
byte;
double
real;
char*
text;
};
};
// Types of input data
enum TDataType {
CL_DATA_NODATA,
// the end of string(line) of the data
CL_DATA_BYTE,
// an integer 0. 255
CL_DATA_REAL,
// вещ number
CL_DATA_TEXT,
// string(line) char*
};
The latter in a vector should be a unit such as CL_DATA_NODATA.
Skips in the data are transferred by the following values:
*define CL_EMPTY_BYTE (-32768)
*define CL_EMPTY_REAL (-1.7E308)
*define CL_EMPTY_TEXT "??? "
int CL_DataLine (int* slide, clString line)
To add string(line) of the data to a slide. The function perceives both
strings(lines) of the data, and controlling commands. Some commands can
change number of an active slide slide.
int CL_DataFile (int* slide, clString filename)
To count strings(lines) of the data from the file and to add them to a
slide. The function is realized through cyclic call to CL_DataLine. For
all slides in which new strings(lines) the data have acted(arrived), the
maximum viewport (see CL_SlideMaxZoom) is
installed.
int CL_DataMatrix (int slide, int rows,
clString description, FMatrixInterface func, void* object)
To register an external matrix of the data for a slide slide. The number
of strings(lines) in a matrix sets перемнной rows. The number and types
of columns, and also a name of a matrix, are transferred through text string(line)
description. Its(her) syntax in accuracy same, as well as for arguments
of NewData command. In general, operation of interface CL_DataMatrix function
is completely similar to operation NewData, behind that exception, that
the data are stored(kept) not by the library, and outside of her(it). {NewData}
The external matrix sets with the help of the function of a data access
func. This function is defined(determined) by the user of the library and
called(caused) from within libraries. The type of FMatrixInterface function
is described as follows:
typedef int (*FMatrixInterface) (void*
object, int row, int col, TInputData* data);
The function of access should calculate value in cell of a matrix, standing
on an intersection row-ой strings(lines) and col-ого a column. The calculated
value and his(its) type should be brought in structure TInputData. {TInputData}
The pointer object it is possible to use to transfer functions of access
any data. It is necessary in that case when the same function of access
is used for performance of several matrixes. The object, указаный at registration
of the function of access, will be transferred it(her) by each call as
the first argument. It is completely safe to do(make) the pointer object
zero.
To reassign an external matrix (to change rows, func or object), repeatedly
it is necessary to call(cause) CL_DataMatrix, having transferred it(her)
in quality description only a name of a matrix.
int CL_DataGetValue (int slide, int
point, clString colname, TInputData* data)
To count value from cell of the data, standing string(line) on an intersection
with number point and a column with a name colname. Value is written in
structure TInputData under the pointer data. {TInputData}
Returns value 0 if there is no error;
CL_ERR_VECTOR If on a slide there is no column with the indicated name;
CL_ERR_VECTORSIZE If in column there is no string(line) with indicated
number.
int CL_DataSetValue (int slide, int
point, clString colname, const TInputData* data)
To write value in cell of the data, standing on an intersection of string(line)
with number point and a column with a name colname. Written value transfers
through the pointer data to structure such as TInputData.
The function returns 0 if there are no errors;
CL_ERR_VECTOR If on a slide there is no column with the indicated name;
CL_ERR_VECTORSIZE If in column there is no string(line) with indicated
number;
CL_ERR_VECTOREADONLY If the column contains not stored(kept), and the
computable data.
API:
Functions of operation with slides
All functions of operation with slides demand, that was preliminary any
device of mapping is activated. Even if the function does not output a
graphics, she(it) can access to the device at definition of a size of the
text.
The functions accepting on an input(entrance) number of a slide, return
error code CL_ERR_SLIDE if the current slide is not defined.
int CL_SlideMaxZoom (int slide)
To place(install) for all diagrams on a slide maximum viewport. The maximum
area allows to see all points on all diagrams.
int CL_SlideRefresh (int slide)
To refresh a slide. Call of the given function is necessary after addition
of the data or change of displayed area.
int CL_SlideSetRect (int slide, int
xleft, int ytop, int xright, int ybottom)
To set sizes of a slide in coordinates of the current output device.
int CL_SlideGetSize (int slide, clString
area, int *xleft, int *ytop, int *xright, int *ybottom)
To produce a size and position of area of a slide with a name area. Error
CL_ERR_AREANOTFOUND - is not present such area. See valid
names of areas.
int CL_SlideDraw (int slide)
To display a slide entirely on the current output device. At output of
a slide in the window instead of CL_SlideDraw it is recommended to use
CL_SlideBeginDraw functions and CL_SlideContinueDraw (is (see lower), as
it allows other processes to be fulfilled simultaneously with plotting
a slide.
int CL_SlideBeginDraw (int slide,
int from_stage)
int CL_SlideContinueDraw (int slide, int to_stage)
CL_SlideBeginDraw function starts plotting a slide from a stage from_stage
inclusively, but nothing draws.
CL_SlideContinueDraw function continues plotting a slide up to a stage
to_stage inclusively.
Stages of plotting with following numbers are admitted(allowed,valid):
0 beginning of plotting
1 all not graphics areas, background, grid, mandatory
units of diagrams
2 filled squares
3 боксы
4 histograms
5 candles
6 lines and pair connections
7 points
8 active point, including the text comment
9 инициация search of a current point
10 continuations of search of a current point, its(her)
illumination and output статусной the information
11 dynamic units on diagrams
12 end of plotting
CL_SlideContinueDraw function trace a slide stage by stage. Main operation
происводится at stages 2 - 7.
At 2-nd stage for all points of all diagrams squares appear only. At
3-rd stage all points of all diagrams are again viewed and represented
only боксы. And so up to 7-th stage inclusively. The indicated sequence
of stages (layers) of plotting is selected specially, that less extensive
units (such as lines and points) were drawn atop more extensive (squares,
боксов, etc.).
Plotting is optimized so that at each stage the series which are not
having appropriate units, were skipped entirely.
The number of the units displayed by CL_SlideContinueDraw function
for once, sets DrawBlockSize command. {DrawBlockSize}
Since 8-th stage nonconstant (dynamic) units of diagrams are displayed.
API:
Functions of operation with the diagram
If the slide contains some diagrams functions of the given group will act
on the current diagram, defined the last fulfilled Panel command or NewPanel,
and also operations of the user (click of the mouse on a graphics makes
active the diagram the same way as it is done(made) with Panel command).
{Panel}
int CL_ChartGetZoom (int slide, double
*x1, double *y1, double *x2, double *y2)
To produce current rectangular area a graphics in real coordinates.
int CL_ChartGetMaxZoom (int slide,
double *x1, double *y1, double *x2, double *y2)
To produce maximum rectangular area a graphics in real coordinates.
int CL_ChartSetZoom (int slide, double
x1, double y1, double x2, double y2)
To place(install) rectangular area a graphics in real coordinates.
int CL_ChartScreenToReal (int
slide, int x, int y, double* X, double* Y, double* Z)
To transform screen кординаты (x, y) in real (X, Y, Z).
int CL_ChartRealToScreen (int
slide, double X, double Y, int* x, int* y)
To transform real (X, Y) кординаты in screen (x, y).
int CL_ChartGetXYInfo (int slide,
int x, int y, clString series_name, clString expr, clString *buffer)
To produce the text information on a point of a series with a name series_name
on screen coordinates (x, y). The information is calculated on expression
expr (usually it is string(line) with inserts) and produces through the
pointer on string the buffer buffer. Expression expr is written by the
same rules, as for Let command. In частнисти, it can contain names of stored(kept)
and computable columns of the data. {Let}
Called(caused) program has no right to update the data under the pointer
buffer.
int CL_ChartGetPointInfo (int
slide, TPointInfo* info)
To produce the information on a point with a serial number info-> point
in a series with a serial number info-> series=0. Indexing of series and
points starts with zero.
Returns an error code:
CL_ERR_NOSERIES - if there is no such series,
CL_ERR_NOPOINT - if there is no such point in a series.
The given function allows to touch all points a graphics. For each
point in structure TPointInfo number of a series, number of a point, text
information TQ and tag выделенности is written:
struct TPointInfo {
clString panel_name;
// a name of the panel
clString series_name;
// a name of a series
int series;
// number of a series
int point;
// number of a point in a series
double X, Y, Z;
// coordinates of a point
clString text;
// information string(line)
int selected; whether
// the point selected(allocated) is
int can_be_selected; whether
// there can be a point selected(allocated)
};
int CL_ChartGetTableLine (int slide,
TPointInfo* info)
To produce the next string(line) in the table of the selected(allocated)
points. Before the first call it is necessary to assign to counters of
series and points reference values info-> series=0 and info-> point =-2
(it is possible to set info-> point =-1 to skip a title bar of the table);
at the following calls of their value to change it is not necessary. The
given function is similar previous and differs that, that sorts out only
the selected(allocated) points and does not demand the job(definition)
of counters of series and points at each call.
If the point is selected(allocated), but has no property TT, in info->
text the information by default is written.
The function returns 0 if review of points is completed, 1 - if there
were not output points.
int CL_ChartDrawPoint (int slide,
TPointInfo* info, int stage)
To draw a stage stage for a point info-> point in a series info-> series.
Indexing of series and points starts with zero. For points stages of plotting
with following numbers are admitted(allowed,valid):
2 filled squares
3 боксы
4 histograms
5 candles
6 lines and pair connections
7 points
int CL_ChartSelectPoint (int slide, TPointInfo*
info, int selectmode)
To select(allocate) a point with a serial number info-> point in a series
with number info-> series. Indexing of series and points starts with zero.
The mode of selection selectmode can accept values: 1 - to select(allocate)
points, 2 - to deselect, 3 - to invert selection.
Returns error code CL_ERR_POINTSELECT if the point can not be selected(allocated).
int CL_ChartSelectAll (int slide,
int selectmode)
To select(allocate) all points a graphics. The mode of selection selectmode
can accept values: 1 - to select(allocate) points, 2 - to deselect, 3 -
to invert selection.
int CL_ChartGetActivePoint (int
slide, TPointInfo* info)
To write the information on an active point in structure info.
Returns 0 in case of success, CL_ERR_POINTACTIVE - if there is no active
point.
int CL_ChartSetActivePoint (int
slide, TPointInfo* info, int dir)
To make active a point info-> point
in a series info-> series or adjacent with it(her) depending on value dir:
dir = 0 - a point info-> point in a series info-> series;
dir =-1 - the previous point in a series info-> series;
dir = +1 - the following point in a series info-> series;
dir = +2 - the nearest point in the following series;
dir =-2 - the nearest point in the previous series.
If the point can not be active (has no size, there is outside a visible
part a graphics, etc.) to make active the nearest visible in a direction
dir=1.
Returns 0 in case of success,
1 - if the point is activated, but is outside displayed area,
CL_ERR_POINTACTIVE - if the point does not exist or can not be selected
(then active остаётся a current point).
API:
Interactive functions
Interactive functions are for processing movements of the mouse and pressings
the keys of the keyboard. At writing the interactive shell for ChartLib
library it is possible to realize any processing of these events, however
the indicated functions provide standard behaviour of diagrams in the interactive
mode, described in section of documentation " Interactive
possibilities ".
int CL_OnMouseDown (int slide, int x, int
y, int buttons)
int CL_OnMouseUp (int slide, int x, int y, int buttons)
int CL_OnMouseMove (int slide, int x, int y, int buttons)
Event processing of the mouse. The point (x, y) contains current screen
coordinates of the mouse. The status of buttons buttons can accept the
following values and also to be combined from them by summation:
enum TButtonsState {
CL_BUTT_NO = 0,
CL_BUTT_SHIFT = 1,
CL_BUTT_ALT = 2,
CL_BUTT_CTRL = 4,
CL_BUTT_LEFT = 8,
CL_BUTT_RIGHT = 16,
CL_BUTT_MIDDLE = 32,
CL_BUTT_DOUBLE = 64
};
int CL_OnKeyPress (int slide, int keycode,
int buttons)
Processing of pressing some keys of the keyboard. The key code keycode
can accept the following values:
enum TKeyCode {
CL_KEY_NO = 0,
CL_KEY_LEFT = 1,
CL_KEY_RIGHT = 2,
CL_KEY_UP = 3,
CL_KEY_DOWN = 4,
CL_KEY_PAGEUP = 5,
CL_KEY_PAGEDOWN = 6,
CL_KEY_HOME = 7,
CL_KEY_END = 8,
CL_KEY_TAB = 9,
CL_KEY_ENTER = 10,
CL_KEY_INSERT = 11,
CL_KEY_DELETE = 12,
CL_KEY_BACKSP = 13,
CL_KEY_SPACE = 14,
CL_KEY_ESCAPE = 15
};
int CL_SlideCallBack (int slide, FCallBack
function, void* object)
To place(install) the reflexive function of a slide. The reflexive function
is defined(determined) in the program using ChartLib library, and called(caused)
from within libraries at approach of specific events.
The type of the reflexive function is described as follows:
typedef int (*FCallBack) (TCallBackInfo*
cb);
Calling(causing) the reflexive function, ChartLib fills in data structure
TCallBackInfo specially intended care of the information on occurred event
in called(caused) program:
struct TCallBackInfo {
void* object;
// the object given at installation of the reflexive function of a slide
TCallBackType type; // the type
of event
clString text;
// статусная string(line), string(line) of the data, the information on
a point
clString area;
// a name of area of a slide on which there was an event
int series;
// number of a series of points
int point;
// number of a point in a series
int selected;
// the point is selected(allocated)?
TZoom prev;
// a former size of viewport
TZoom curr;
// a current size of viewport current a graphics
};
Visible area a graphics
struct TZoom {
double x1, y1, z1;
double x2, y2, z2;
};
Types of the events resulting(bringing) in a call of the reflexive function
enum TCallBackType {
CL_CBACK_NO = 0,
CL_CBACK_DATACHANGE = 1,
// change of the data
CL_CBACK_ZOOM = 2,
// scaling a graphics
CL_CBACK_POINTACTIVATE = 3,
// activation of a point
CL_CBACK_POINTSELECT = 4,
// selection or a deselecting of one point
CL_CBACK_POINTHIGHLIGHT = 5, // illumination
of a point
CL_CBACK_SCENECHANGE = 6,
// change of layout of the 3D-scene
CL_CBACK_STATUSCHANGE = 7
// change статусной strings(lines)
};
API:
the Example of usage of ChartLib library:
ChdView utility for converting a graphics
ChdConv utility is intended for converting diagrams from files of CHD format
in files of graphics GIF formats, EMF, WMF. She(it) is included in distribution
kit ChartLib together with the initial code.
The command line allows to convert arbitrary number of files for once:
chdConv <format> <files>...
<Format> <files>
Where <format> - one of options-gif,-emf,-wmf,-gpt, indicating, in what
format to convert all <files> written behind it(her). The converted
file is written in the current directory under the same name and the extension
appropriate to the format.
The initial code of chdConv utility below represented.
*include <stdio.h>
*include <math.h>
*include "cl.h"
int slide = 0;
const int MAXBUF = 256;
char save [MAXBUF];
TDrawerDef
drdata;
// Generation of the file
int generate (const char* filename, const
char* extension, TDrawerType type) {
if (*filename == '-' ||
*filename == '?') return 0;
// Creation of a filename
const char *s, *point
= filename, *shortname = filename;
for (s=filename; *s; s
++) {
if
(*s == '/' || *s == '\\') shortname = s+1;
if (*s
== '.') point = s;
}
if (point < =shortname)
point = s;
char name [MAXBUF];
strncpy (name, shortname,
point-shortname);
name [point-shortname]
= '\0 ';
sprintf (drdata.filename=save,
" %s. % s ", name, extension);
// The debug message
printf (" doing %s\n ",
drdata.filename);
// Loading the data
CL_DataLine
(*slide, "*NewSlide");
CL_DataFile
(*slide, filename);
CL_DataLine (*slide, "
*StatusBar.Visible
off ");
// Creation рисователя
drdata. Rect.x1=0; drdata.
Rect.y1=0;
drdata. Rect.x2=548; drdata.
Rect.y2=412;
drdata.type = type;
CL_DrawerCreate
(*drdata);
// Generation and recording a graphics
CL_SlideSetRect
(slide, 2, 2, 546, 410);
CL_SlideMaxZoom
(slide);
CL_SlideRefresh
(slide);
CL_SlideDraw
(slide);
if (type == CL_DRAWER_GIF)
CL_DrawerSave
();
// Just in case - disconnect of echo
- output of commands
CL_DataLine (*slide, "*EchoFile");
return 1;
}
void usage () {
printf (" ChartLib v1.03
(c) K.Vorontsov, MICEX, 1999-2001\n ");
printf (" CHD (CHart Description
format) converter to GIF, GPT and EMF.\n ");
printf (" chdConv usage:\n
");
printf ("
chdConv [-gif] f1.chd f2.chd. -convert files to Compuserve GIF\n ");
printf ("
chdConv-gpt f1.chd f2.chd. -convert files to Graphics Primitives Text\n
");
printf ("
chdConv-emf f1.chd f2.chd. -convert files to Enhanced Metafile\n ");
printf ("
chdConv-wmf f1.chd f2.chd. -convert files to Windows Metafile\n ");
}
int main (int argc, char* argv []) {
if (argc == 1) {
usage
();
return
0;
}
TDrawerType
otype = CL_DRAWER_GIF;
const char* ext = "gif";
// Initialization of the library
CL_WorkStart
();
CL_WorkDebug
("chdConv.log", 0);
// Reading the command line and processing
of files
for (int a=1; a < argc;
a ++) {
if
(*argv [a] == '-') {
ext
= argv [a] +1;
if
(strcmp (ext, "gif") == 0) otype = CL_DRAWER_GIF;
else
if (strcmp (ext, "gpt") == 0) otype = CL_DRAWER_GPT;
else
if (strcmp (ext, "emf") == 0) otype = CL_DRAWER_EMF;
else
if (strcmp (ext, "wmf") == 0) otype = CL_DRAWER_WMF;
}
else
if (*argv [a] == '?')
usage
();
else
generate
(argv [a], ext, otype);
}
// Release of the library
CL_WorkFinish
();
return 0;
}
TSliChart components
TSliChart components gives the convenient interface to ChartLib library
for Delphi and expands its(her) possibilities a little. In particular,
it(he) realizes double-buffer at output in the window, printing on the
printer and saving of a slide in GIF formats, BMP and EMF.
TSliChart:
Инсталяция the component
Before the beginning инсталяции it is necessary to be convinced, that ChartLib.dll
file from distribution kit ChartLib is copied in the system directory of
a Windows. Further инсталируется components standard for Delphi a way:
-
To select from Component menu Install Component item.
-
To select with help Unit file name/Browse src\WinDelphi\SliChart.pas file
from distribution kit ChartLib.
-
In Package window to fulfil compilation (Compile button) and installation
(Install button) package.
-
To close the current project with help File/Close All, having saved the
project.
The ambassador инсталяции components should appear in graphic palette Delphi
in section Samples on name SliChart.
TSliChart:
Usage the component in the project
Components it is used in Delphi environment similarly to other successors
of TCustomControl class. In USES command it is necessary to specify SliChart
unit.
It is important to remember the following features TSliChart component:
-
Components always displays in accuracy one slide. However it is possible
to switch from one slide to another with the help of Slide CHD-command.
{Slide}
-
That the object such as TSliChart, placed on the form, handled events of
the mouse and the keyboard, property of form ActiveControl should specify
this object. To place(install) this property it is possible both during
development, and in execution time.
-
That on a graphics it was possible to select(allocate) points, it is necessary
to place(install) for property SelectMode any
value except for smNone.
-
That on a graphics it was possible to select(allocate) areas, it is necessary
to place(install) for property SelectShape any
value except for shNone.
-
That the function of construction of the summary table on the selected(allocated)
points worked, it is necessary to place(install) property SelectedPointsGrid.
The guideline 1: use heading chd-files
TSliChart components does not allow to describe a slide during development.
To set appearance, data structure and structure of a slide it is possible
only in the program way with the help of CHD-commands. For execution of
the separate command for the component is present DataLine procedure. However
the best way to generate a slide is to collect all commands in the separate
"heading" CHD-file and to load it(him) once DataFile procedure. It gives
a side benefit - the heading file can be corrected, changing appearance
a graphics without recompilation of the application. {DataFile}
{DataLine}
The guideline 2: select the optimal moment for upgrade of a slide
During arrival of the data on a slide the library, components do not
update a slide. It is made for rise of efficiency that upgrade to make
once after a series of operations with the diagram. Upgrade includes installation
of scale SlideMaxZoom and image generation
SlideRefresh.
The guideline 3: use SetFilm command to organize show of films
{SetFilm}
By default, if SetFilm command is not fulfilled, the slide is located
in film with a name default. It is special film for allocation of single
slides. In it(him) scrolling, moving and deleting of slides is impossible.
TSliChart:
Properties the component
TSliChart class inherits from parent TCustomControl class of property:
Align, Anchors, AutoSize, ClientHeight, ClientWidth, Color, Constraints,
Cursor, Height, HelpContext, Hint, Left, Name, PopupMenu, Tag, Top, Visible,
Width.
Other properties are defined in TSliChart class.
Property HasBuffer: boolean
It is equal True if the mode of double-buffer is included, and False otherwise.
If it is included, the slide appears faster and without flashing, but
demands the greater memory size. Installation HasBuffer in True is recommended
at show of films.
Property HasStatus: boolean
It is equal True if the slide has built - in статусную string(line), and
False otherwise.
If it is switched off, implementation статусной strings(lines) is entirely
shifted for the user the component. For this purpose it is enough to it(him)
to define(determine) the handler of event OnStatusChange
printing статусную the information in the necessary place.
Property HasStatus is equivalent to Slide. Visible CHD-command = on|off.
Property SelectOutside: boolean
Property SelectOutside is equivalent to SelectOutside CHD-command. {SelectOutside}
Property SelectMode: TSelectMode
Property SelectMode is equivalent to SelectMode CHD-command. {SelectMode}
TSelectMode type is defined as
// Modes of selection of subsets
of points
TSelectMode = (smNone, smSelect, smUnselect,
smInvert);
Property SelectShape: TSelectShape
Property SelectShape is equivalent to SelectShape CHD-command. {SelectShape}
TSelectShape type is defined as
// Forms of selection of subsets
of points
TSelectShape = (shNone, shRectangle,
shEllipse, shHalf, shStrip);
Property SelectedPointsGrid: TStringGrid
The string table for output of the summary table of the selected(allocated)
points. If the given property is not placed(installed), output of the table
on pressing will
be impossible.
Property SlideNo: integer
Registration number of a slide in ChartLib library. This number transfers
functions of the library as the first argument.
Property is accessible only to reading.
Property Busy: boolean
It is equal True if the slide is in a status of copying. Otherwise False.
Property is accessible only to reading.
Property ChartLibError: integer
Number of the last error which have occurred in functions of ChartLib library.
Property is accessible only to reading.
TSliChart:
Events the component
TSliChart class inherits from parent TCustomControl class of event:
OnCanResize, OnClick, OnConstrainedResize, OnDblClick, OnDockDrop,
OnDockOver, OnDragDrop, OnDragOver, OnEndDock, OnGetSiteInfo, OnKeyDown,
OnKeyPress, OnKeyUp, OnMouseDown, OnMouseUp, OnMouseMove, OnMouseWheel,
OnMouseWheelDown, OnMouseWheelUp, OnResize, OnStartDock, OnUnDock.
Other events are defined in TSliChart class. Events OnPropertyChange,
OnShowTable, OnPaintStart, OnPaintFinish have standard TNotifyEvent type.
Other events have TChartEvent type which also is described in SliChart.pas
unit:
TChartEvent = procedure (Sender:
TObject; var Info: TChartBackInfo) of object;
The handler of event is transferred by structure TChartBackInfo which contains
the information on event.
TChartBackInfo = record
slide: TSliChart;
// the pointer on the object
event: integer;
// the type of event
text: PChar;
// статусная string(line), string(line) of the data, the information on
a point
area: PChar;
// a name of area of a slide on which there was an event
series: integer;
// number of a series of points
point: integer;
// number of a point in a series
selected: integer; //
the point is selected(allocated)?
prev: TZoom;
// the previous boundary of viewport
curr: TZoom;
// current boundary of viewport
prev_slide: integer; // number of
a current slide before switching
curr_slide: integer; // number of
a current slide after switching
end;
Event OnStatusChange: TChartEvent
Event occurs at upgrade статусной strings(lines). The output text contains
in variable Info.text.
Define(determine) this event to realize own статусную string(line).
The example of implementation is in the initial code of chdView utility.
Event OnDataChange: TChartEvent
Event occurs at arrival of each new string(line) of the data.
Event OnSlideChange: TChartEvent
Event occurs at switching a current slide by DataLine functions and DataFile.
Variables Info.prev_slide and Info.curr_slide contain number of a current
slide before switching accordingly. Variable Info.text contains a filename
from which the given slide was loaded. {DataLine}
Event OnDataFile: TChartEvent
Event occurs directly ahead of loading of the file. The filename contains
in variable Info.text.
In the initial code of chdView utility this event is used for upgrade
of a window title.
Event OnZoom: TChartEvent
Event occurs at scaling visible area a graphics in the window. Coordinates
of former area are in variable Info.prec, coordinates following - in Info.curr.
Event OnPointActivate: TChartEvent
Event occurs at activation of a point. Variables Info.series and Info.point
contain number of the activated point.
Event OnPointSelect: TChartEvent
Event occurs at selection of a point. Variables Info.series and Info.point
contain number of the selected(allocated) point.
Event OnPointHighlight: TChartEvent
Event occurs at illumination of a point. Variables Info.series and Info.point
contain number of a highlighted point.
Event OnSceneChange: TChartEvent
Event occurs at change of position of the three-dimensional scene.
Event OnPropertyChange: TNotifyEvent
Event occurs at change one of the following properties the component: HasBuffer,
SelectOutside, SelectMode, SelectShape.
In the initial code of chdView utility on event OnPropertyChange the
current status of these properties in статусной to string(line) is updated.
Event OnShowTable: TNotifyEvent
Event occurs by call of the summary table of the selected(allocated) points,
and only in that case when property SelectedPointsGrid
is placed(installed).
Event OnPaintStart: TNotifyEvent
Event occurs directly ahead of plotting of a slide.
Event OnPaintFinish: TNotifyEvent
Event occurs right after the terminations(endings) of plotting of a slide.
TSliChart:
Procedures and functions the component
procedure DataFile (const FileName: PChar)
To count strings(lines) of commands and the data from the file.
Clone of CL_DataFile function. {CL_DataFile}
procedure DataLine (const Line: PChar)
To transfer a slide string(line) of CHD format containing the command or
the data.
Clone of CL_DataLine function. {CL_DataLine}
procedure DataVector (var Data: TInputData)
To transfer a slide a vector of the data of CHD format. Data type TInputData
is defined in SliChart.pas file as follows:
const
CL_DATA_NODATA = 0; // the end of
string(line) of the data
CL_DATA_BYTE = 1; // an
integer
CL_DATA_REAL = 2; // вещ
number
CL_DATA_TEXT = 3; // string(line)
char*
type TInputData = record
unused: integer;
case dType: integer of
CL_DATA_BYTE: (dByte: Smallint);
// an integer
CL_DATA_REAL: (dReal: double);
// вещ number
CL_DATA_TEXT: (dText: PChar);
// string(line) char*
end;
Clone of CL_DataVector function. {CL_DataVector}
procedure DataMatrix (rows: integer; fields:
PChar; func: FMatrixInterface; obj: TObject);
To register an external matrix of the data. The function of access to the
external data is defined in SliChart.pas file as follows:
FMatrixInterface = function (
DataHolder: TObject;
row, col: integer;
var data: TInputData
): integer; cdecl;
Clone of CL_DataMatrix function. {CL_DataMatrix}
procedure DataGet (row: integer; colname: PChar;
var data: TInputData)
To count cell of the data, standing in a current matrix of the data on
an intersection of string(line) with number row and a column with a name
colname.
Clone of CL_DataGet function. {CL_DataGet}
procedure DataPut (row: integer; colname: PChar;
var data: TInputData)
To write value in cell of the data, standing in a current matrix
of the data on an intersection of string(line) with number row and a column
with a name colname.
Clone of CL_DataPut function. {CL_DataPut}
procedure SlideSetRect ()
To place(install) coordinates rectangular area of output of a slide (in
pixels) on a size the component.
Clone of CL_SlideSetRect function. {CL_SlideSetRect}
procedure SlideMaxZoom ()
To place(install) maximum viewport for all diagrams of a slide.
Clone of CL_SlideMaxZoom function. {CL_SlideMaxZoom}
procedure SlideRefresh ()
To refresh a slide, having optimized allocation of areas on a slide.
Clone of CL_SlideRefresh function. {CL_SlideRefresh}
procedure SlideDraw ()
To draw a slide from the beginning up to the end. The function can demand
essential expenses of time. Usually in this function there is no necessity
as TSliChart components takes handle of copying on itself.
Clone of CL_SlideDraw function. {CL_SlideDraw
}
procedure ChartGetZoom (var x1: double;
var y1: double; var x2: double; var y2: double)
To produce current rectangular area a graphics in real coordinates.
Clone of CL_ChartGetZoom function
procedure ChartGetMaxZoom (var x1:
double; var y1: double; var x2: double; var y2: double)
To produce maximum rectangular area a graphics in real coordinates
Clone of CL_ChartGetMaxZoom function
procedure ChartSetZoom (x1: double; y1:
double; x2: double; y2: double)
To place(install) rectangular area a graphics in real coordinates
Clone of CL_ChartSetZoom function
procedure ChartScreenToReal (x, y:
integer; var PX, PY, PZ: double)
To translate screen coordinates in real.
Clone of CL_ChartScreenToReal function. {CL_ChartScreenToReal}
procedure ChartRealToScreen (xreal,
yreal: double; var x, y: integer)
To translate real coordinates in screen.
Clone of CL_ChartRealToScreen function. {CL_ChartRealToScreen}
procedure ChartDrawPoint (var info:
TPointInfo; stage: integer)
To fulfil the given stage of plotting for the given point.
Clone of CL_ChartDrawPoint function. {CL_ChartDrawPoint}
procedure ChartSelectPoint (var info:
TPointInfo)
To select(allocate) the given point.
Clone of CL_ChartSelectPoint function. {CL_ChartSelectPoint}
procedure ChartSelectAll ()
To select(allocate) all points.
Clone of CL_ChartSelectAll function. {CL_ChartSelectAll}
procedure ChartSetActivePoint (var
info: TPointInfo; dir: integer)
To make active the given point.
Clone of CL_ChartSetActivePoint function. {CL_ChartSetActivePoint}
procedure ChartGetActivePoint (var
info: TPointInfo)
To receive info.series and info.point the point activated at present.
Clone of CL_ChartGetActivePoint function. {CL_ChartGetActivePoint}
procedure ChartGetPointInfo (var
info: TPointInfo)
To receive the information on a point.
Clone of CL_ChartGetPointInfo function. {CL_ChartGetPointInfo}
procedure ChartGetTableLine (var
info: TPointInfo)
To receive string(line) of the summary table of the selected(allocated)
points.
Clone of CL_ChartGetTableLine function. {CL_ChartGetTableLine}
procedure ChartGetXYInfo (x, y: integer;
series, expr: PChar; var buffer: PChar)
To receive the information on a point nearest to a point with screen coordinates
(x, y).
Clone of CL_ChartGetXYInfo function. {CL_ChartGetXYInfo}
procedure SaveAsEMF (const filename: string)
To save a slide as the raster map in the file of EMF format (Enhanced Windows
MetaFile) with a name filename.
procedure SaveAsBMP (const filename: string)
To save a slide as the raster map in the file of BMP format (a Windows
bitmap) with a name filename.
procedure SaveAsGIF (const filename: string)
To save a slide as the raster map in the file of CompuServe GIF format
with a name filename.
procedure CopyToClipboard ()
To copy the map of a slide in the buffer as a metafile.
procedure Print ()
To print out the map of a slide on the printer.
procedure ShowTable ()
To show the summary table of the selected(allocated) points. If property
SelectedPointsGrid
is not placed(installed), the procedure does not make any operation.
Addition of devices
of mapping
ChartLib library uses the object-oriented approach to operation with devices
of mapping of the graphics information (рисователями). All devices
are successors abstract рисователя CDrawer in which
are declared, but are not defined, base functions of drawing.
That the map looked equally on various devices, developers of classes
- successors CDrawer should adhere to uniform agreements that each function
of drawing and as various functions cooperate with each other does(makes).
These agreements are described in the given section.
For addition new рисователя with name Xyz it is necessary to fulfil
the following steps:
-
To define(determine) new CDrawXyz class by inheriting CDrawer class.
To realize in it(him) all virtual functions of drawing. To place the description
of the new class in clDrwXyz.cpp files and clDrwXyz.h. In the beginning
of heading clDrwXyz.h file to define(determine) макрос __ CL_XYZ_H __.
-
In clTypes.h file to add the code of new device CL_DRAW_XYZ in listing
enum TDrawerType.
-
In the beginning of cl.cpp file to add string(line)
-
In CL_DrawerCreate function of cl.cpp file to add call of the designer
of the new class:
*ifdef __ CL_XYZ_H __
case CL_DRAW_XYZ:
newdraw
= new CDrawXyz (ddef); break;
*endif
-
To recompile ChartLib library.
Рисователи:
Abstract рисователь CDrawer
All virtual functions of drawing have int type. If not it is stipulated
another the negative return code testifies to an error, 0 means successful
completion.
Further definition of CDrawer class from clDraw.h file is entirely resulted.
class CDrawer {
public:
// The beginning and termination
with a graphics
CDrawer
();
virtual ~CDrawer
();
virtual int Reset
(TDrawerDef* ddef);
virtual int Clear
();
virtual int Save
();
// Plotting graphics primitives
virtual int Line
(int x0, int y0, int x1, int y1) = 0;
virtual int LineTo
(int x1, int y1) = 0;
virtual int Rect
(int x0, int y0, int x1, int y1) = 0;
virtual int Ellipse
(int x0, int y0, int x1, int y1) = 0;
virtual int EllipsePie
(int x0, int y0, int x1, int y1,
double
fromangle, double toangle) = 0;
virtual int Fill
(int nPoints, int* xy) = 0;
virtual int Text
(int x0, int y0, const char* text, TFontStyle font) = 0;
// Parameter setup of drawing
virtual int SetColor
(TColor color) = 0;
virtual int SetFillColor
(TColor color) = 0;
virtual int SetLineStyle
(TLineStyle linestyle, int width) = 0;
virtual int SetFillStyle
(TFillStyle fillstyle) = 0;
virtual int SetFont
(TFontStyle font, const char* library,
const
char* family, int width, int height,
const
char* flags=0, double angle=0.0);
// The functions used in the interactive
mode
virtual int SetPixel
(int x0, int y0, const TColor *color);
virtual int GetPixel
(int x0, int y0, TColor *color);
// Functions for support OpenGL and
a three-dimensional graphics
virtual int BeginOpenGL
(TIntRect and Rwin, TIntRect and Rclip);
virtual int EndOpenGL
();
// Information functions
virtual int GetTextSizes
(const char* text,
TFontStyle
font, int* width, int* height) = 0;
virtual char GetFontEncoding
(TFontStyle font);
// Possibilities of the graphics device
int RightBottomShift;
int HasPixelOperations;
int HasInteractivity;
int HasFontBackground;
protected:
TDrawerDef DrawerDef;//
a determinant transferred(handed) Reset
FILE* open_file
(); //
to open the file in the beginning of Save operation
int close_file
(FILE* f); // to close the file at the
end of Save operation
};
Рисователи:
Characteristics of the graphics device
The herein provided variables - members of CDrawer class should be installed
in the designer рисователя.
int RightBottomShift
The variable sets offset of is right - lower corners at flood filling without
an outline. She(it) should be equal 0 if the algorithm of flood filling
of internal area in Fill function provides flood filling the line. By default
0. To be installed in the designer рисователя and from the outside does
not vary. {Fill}
int HasPixelOperations
The variable should be equal 1 if рисователь support GetPixel functions
and SetPixel, differently 0. To be installed in
the designer рисователя and from the outside does not vary. {GetPixel}
int HasInteractivity
The variable should be equal 1 if рисователь it is intended for output
in the window, differently 0. To be installed in the designer рисователя
and from the outside does not vary.
int HasFontBackground
The variable influences output of text strings(lines) in Text function.
If she(it) is equal 1 characters of the font are output with a background
if 0 without a background. The background should overwrite the previous
inscription if she(it) was output earlier on the same place. It is installed
in the designer equal 0, can vary from the outside. {Text}
Рисователи:
the Designer and деструктор
Designer CDrawXyz ()
The designer of the class output from CDrawer. should not accept any parameters.
A unique place where call of these designers - CL_DrawerCreate function
in cl.cpp file is used.
Деструктор ~CDrawXyz ()
Деструктор the class.
Рисователи:
the Beginning and the end of drawing, filing
int Reset (TDrawerDef* ddef)
To place(install) рисователя parameters and to begin drawing anew.
The function should be reassigned necessarily. The developer рисователя
should расчитывать that she(it) can be called(caused) repeatedly for reinstallation
of various рисователя parameters, for example at resizing area, a filename
or a descriptor. Once she(it) is called(caused) necessarily right after
creations рисователя.
Structure TDrawerDef is defined in clTypes.h file. She(it) unites in
herself all data which can be necessary for initialization рисователей
various types. Рисователь has the right to ignore those fields of structure
as which it(he) will count unnecessary. In future TDrawerDef it can be
enlarged by new fields.
struct TDrawerDef {
TDrawerType type;
// рисователя type
char* filename;
// a filename for GPT, GIF, WMF
FILE* fout; //
the file open outside of the library, is used if filename == 0
int fhandle; //
the descriptor of the file, is used if filename == 0 and fout == 0
TIntRect Rect;
// rectangular area of drawing
int hdc;
// a context of the device for a Windows - рисователей
};
Рисователя TDrawerType type is defined in clTypes.h. It(he) also can be
supplemented in the future:
enum TDrawerType {
CL_DRAWER_NO=0,//
the type is unknown
CL_DRAWER_BUF=1,//
the buffer in memory
CL_DRAWER_GPT=2,//
a text file of graphics primitives
CL_DRAWER_GIF=3,//
the GIF-file
CL_DRAWER_WIN=4,//
the window or others рисователи a Windows
CL_DRAWER_WMF=5,//
a Windows матафайл
CL_DRAWER_EMF=6//
Enhanced a Windows матафайл
};
The rectangular area of drawing is defined in clTypes.h as structure
struct TIntRect {
int x1, y1;
int x2, y2;
};
Hdc parameter is care of a context of the device рисователям, compatible
with a Windows 95-2000.
Fields filename, fout, fhandle set three alternate ways of a file transfer
for recording in him(it) of a graphics image. They are used only by Save
function. That it is correct to open and close the file irrespective of
a way of his(its) job(definition), use functions of the base class {Save}
FILE* CDrawer:: open_file ();//
to open the file in the beginning of Save operation
int CDrawer:: close_file (FILE* f);
// to close the file at the end of Save operation
That they correctly worked, it is necessary to call(cause) blocked CDrawer
:: Reset function, which copies structure ddef (including a filename)
in protected-member CDrawer:: DrawerDef:
int CDrawXyz:: Reset (TDrawerDef
*ddef) {
if (CDrawer:: Reset (ddef))
return
(-1);
//.........
}
int Clear ()
To clear рисователь, to release all objects selected(allocated) in a context
of отбражения peripheral. This function is for preventing memory leaks.
She(it) is called(caused) before ChartLib will give handle to the main
application. From this moment before the following call of any function
of the library the main application can delete a context of the device.
Then the objects connected to it(him) can "hang". For example, in the system
of a Windows of a paintbrush, feathers and the fonts connected to
a context hdc, are not deleted automatically at corrupting a context.
To reassign Clear function it is not necessary in the following cases:
-
If рисователь does not create the objects connected to the peripheral,
-
If the peripheral does not fail,
-
If at corrupting it deletes all objects.
int Save ()
To save the map in the file which was given at installation рисователя
by Reset function. To reassign Save function it is not necessary, if the
device of mapping is not intended for creation of the graphics file. {Reset}
That it is correct to open and close the file, it is necessary to use
functions of the base class
FILE* CDrawer:: open_file ();//
to open the file in the beginning of Save operation
int CDrawer:: close_file (FILE* f);
// to close the file at the end of Save operation
Рисователи:
Parameter setup of drawing
int SetColor (TColor color)
To set color of lines (Line, LineTo),
the text (Text), boundaries of figures (Rect,
Ellipse,
EllipsePie)
and boundaries of flood fillings
(Fill).
TColor type is defined as a triplet red - green - dark blue:
struct TColor {
short Red, Green, Blue;
};
int SetFillColor (TColor color)
To set background color of flood fillings (Fill), figures
(Rect, Ellipse, EllipsePie)
and the text (Text).
int SetLineStyle (TLineStyle linestyle,
int width)
To set style and width in pixels of lines (Line, LineTo),
boundaries of figures (Rect, Ellipse,
EllipsePie)
and boundaries of flood fillings
(Fill). TLineStyle
type is defined as whole and accepts the following values:
typedef int TLineStyle;
const TLineStyle CL_LINE_NO = 0;
const TLineStyle CL_LINE_SOLID = 1;
const TLineStyle CL_LINE_DASH = 2;
const TLineStyle CL_LINE_DOT = 3;
const TLineStyle CL_LINE_DASHDOT = 4;
const TLineStyle CL_LINE_DASHDOTDOT = 5;
const TLineStyle CL_LINE_STYLEMASK = 0x0F;
const TLineStyle CL_LINE_XOR = 0x10;
CL_LINE_XOR type can be combined with others for drawing in the mode "
eliminating OR ". In this mode repeated plotting of a line by the same
color erases her(it). The given possibility is used only in the interactive
mode for the map of dynamic objects (cursors and frameworks) atop of the
main map.
int SetFillStyle (TFillStyle fillstyle)
To set style of flood fillings (Fill), figures (Rect,
Ellipse,
EllipsePie)
and the text (Text). TFillStyle type is defined as
follows:
enum TFillStyle {
CL_FILL_NO,
CL_FILL_SOLID,
CL_FILL_LEFT,
CL_FILL_RIGHT,
CL_FILL_CROSS
CL_FILL_CROSSDIAG
};
int SetFont (TFontStyle font, const char* library,
const char* family,
int
width, int height, const char* flags=0, double angle=0.0)
To place(install) all parameters to type style font. The function returns
an error code (-1) if the given device of mapping does not support the
indicated font library; (-2 code if not удаётся to initialize the font.
In case of success comes back 0.
ChartLib library limits quantity(amount) of simultaneously used fonts.
There are 9 predetermined and 9 user's styles of fonts. All fonts are initialized
at creation рисователя, and to Text functions and GetTextSizes
transfers only number of style. {Text}
Font parameter sets type style which is defined in clTypes.h as an integer
from 0 up to 17:
enum TFontStyle {
CL_FONT_DEFAULT=0,//
the elementary font which always is
CL_FONT_TITLE=1,//
header a graphics
CL_FONT_NAME=2,//
names of axes
CL_FONT_LABEL=3,//
labels of axes
CL_FONT_INFO=4,//
the text of information fields
CL_FONT_INSIDE=5,//
text TI inside points
CL_FONT_NEAR=6,//
text TN near to points
CL_FONT_RIGHT=7,//
text TR on a right-click
CL_FONT_STATUS=8,//
text TB статусная string(line)
CL_FONT_USER_1=9,
CL_FONT_USER_2=10,
CL_FONT_USER_3=11,
CL_FONT_USER_4=12,
CL_FONT_USER_5=13,
CL_FONT_USER_6=14,
CL_FONT_USER_7=15,
CL_FONT_USER_8=16,
CL_FONT_USER_9=17,//
nine user's fonts
CL_FONTS=18
};
Library parameter sets a name of the font library. SetFont function should
ignore the calls concerning those font libraries which she(it) does not
support. However she(it) should try to process call with zero library parameter
.
Example: CDrawWin :: SetFont function starts with check
if (library ** *library ** strcmpcu
(library, "Win"))
return (-1);
Family parameter sets a name of the font family.
Width parameter sets width of characters in pixels. If the used font
library does not support disproportionate stretchings of fonts, this parameter
can be ignored. Zero value should be interpreted as the instruction(indication)
to select the proportional font.
Height parameter sets height of characters in pixels.
Flags parameter sets additional flags. It is text string(line) which
can include the following characters:
B - bold,
b - bold,
I - oblique,
U - underlined,
S - crossed.
Angle parameter sets a corner of turn of the text in degrees. Value 90
corresponds(meets) to an inscription readable from below upwards.
For all functions of drawing of coordinate are set in pixels.
int Line (int x0, int y0, int x1, int y1)
Draws a segment (x0, y0) - (x1, y1) and installs a current position in
a point (x1, y1). The first and last pixels should appear necessarily.
The current color placed(installed) SetColor, style
and the line width placed(installed) SetLineStyle
is used.
int LineTo (int x1, int y1)
Draws a segment from a current point in (x1, y1) and installs a current
position in a point (x1, y1). The first and last pixels should appear necessarily.
The current color placed(installed) SetColor, style
and the line width placed(installed) SetLineStyle
is used.
int Rect (int x0, int y0, int x1, int y1)
Draws the filled rectangle. If style of flood filling is equal CL_FILL_NO,
the rectangular outline is represented only. If style of a line is equal
CL_LINE_NO, the painted over area is represented only. The outline is drawn
by lines of current color (SetColor), style and
width (SetLineStyle). For flood filling current
color of flood filling (SetFillColor) and style
of flood filling (SetFillStyle) is used.
int Ellipse (int x0, int y0, int x1, int y1)
Draws the ellipse entered in a rectangle (x0, y0) - (x1, y1). Flood filling
and an outline are drawn by the same rules, as for Rect.
int EllipsePie (int x0, int y0, int x1,
int y1, double fromangle, double toangle)
Draws sector of the ellipse between corners fromangle and toangle, given
in radians. The ellipse is entered in a rectangle given in coordinates
(x0, y0) - (x1, y1). Counting of corners carries on from a positive
direction of a horizontal axis counter-clockwise. Flood filling and an
outline are drawn by the same rules, as for Rect.
int Fill (int nPoints, int* xy)
Draws broken, consisting of n the points given by the array of coordinates
xy in the following order: x1, y1, x2, y2..., xn, yn. Broken is not obliged
to be closed, that is it is not necessary (x1, y1) = (xn, yn). Flood filling
and an outline are drawn by the same rules, as for Rect function. {Rect}
int Text (int x0, int y0, const char* text, TFontStyle
font)
Draws text string(line) text with coordinates of the left upper corner
(x0, y0) current color (SetColor). Style of the
text sets an integer, see SetFont function. If HasFontBackground parameter
has non-zero value, the text should be output on an opaque background which
color is given by SetFillColor function. {SetFillColor}
{HasFontBackground} {SetFont}
Рисователи:
Operations with pixels
Operations with pixels are used only in the interactive mode for mapping
semipermeable transparencies. If the device of mapping is not intended
for drawing in the window, they can be not reassigned.
int SetPixel (int x0, int y0, const TColor
*color)
To place(install) color of a pixel with coordinates (x0, y0).
int GetPixel (int x0, int y0, TColor *color)
To write color of a pixel with coordinates (x0, y0) in structure color.
Рисователи:
Transition in OpenGL mode
Compatibility рисователя with the library of three-dimensional graphics
OpenGL is provided only two functions: initialization and termination with
OpenGL.
int BeginOpenGL (TIntRect and Rwin, TIntRect
and Rclip)
To create and initialize a context of playback OpenGL for drawing in rectangular
area Rclip, the prisoner in the field of a slide size Rwin.
For the job(definition) of rectangles structure TIntRect is used:
struct TIntRect {
int x1, y1;
int x2, y2;
};
int EndOpenGL ()
To complete creation of buffer OpenGL, to output it(him) and to delete
everything, that was created by BeginOpenGL function. {BeginOpenGL}
Рисователи:
Obtaining of the information
int GetTextSizes (const char* text, TFontStyle
font, int* width, int* height)
GetTextSizes function is obliged to return the real size of text string(line)
text in pixels for the given type style font. The width and height of the
rectangle containing the text, is written in variables width and height
accordingly.
char GetFontEncoding (TFontStyle font)
GetFontEncoding function returns the character designating the coding supported
by the given font:
W - the coding of Windows CP-1251,
D - the alternate coding of a DOS,
K - coding KOI-8,
I - coding ISO-8859-5.
If to fulfil code conversion of text strings(lines) it is not supposed,
the function can be not reassigned.
Interactive possibilities
At output of a slide in the window the library supports a number of interactive
possibilities.
Functions of navigating on a graphics and review
of points are supported at a level of ChartLib library.
Shortcuts are supported by component
TSliChart.
Functions of the menu are realized in the
utility of review chdView.
Interactivity:
Navigating on bidimentional a graphics
Navigating on bidimentional a graphics is carried out with the help of
the mouse and supported by the interface functions of CL_OnMouseMove library,
CL_OnMouseDown, CL_OnMouseUp.
Scaling is made at selection of rectangular area by the right
mouse button. Selection from left to right increases a scale, selection
from right to left returns the diagram to an automatic scale at which all
points a graphics are visible.
Shift a graphics is made by movement of the mouse with the pressed
right button and simultaneously pressed Shift key.
Scaling on an axis is made if to pull for an axis at the pressed
right mouse button. Movement aside a positive direction of an axis increases
a scale (expands the diagram), aside negative - reduces a scale (compresses
the diagram). The scale on the second axis does not vary. Motionless on
an axis остаётся a point from which we have started to pull.
Shift on an axis is made if to pull for an axis at the pressed
left mouse button. The direction of shift coincides with a direction of
movement along an axis. Thus the scale on the second axis does not vary.
Interactivity:
Navigating on three-dimensional a graphics
Navigating on three-dimensional a graphics is carried out only with the
help of the keyboard and supported by the interface function of CL_OnKeyPress
library. {CL_OnKeyPress}
Review of the three-dimensional scene can be made in passive or a foreground.
In the first case the spectator, being in a motionless point, spins, shifts
and scales the scene. This mode is intended for the common browse of the
scene. In the second case the spectator moves under the scene in arbitrary
directions that allows to study the scene in details. The passive mode
is by default placed(installed).
In both browse modes keys operate
|
Switching of browse mode: active / passive |
|
Return in a starting position of the scene |
|
Expansion - compression of the scene on axis X |
|
Expansion - compression of the scene on axis Y |
|
Expansion - compression of the scene synchronously on axes X and Y |
|
Expansion - compression of the scene on axis Z |
In the passive mode keys operate
|
Rotations of the scene |
|
Shift of the scene concerning centre of the window |
|
Increase of the scene |
|
Decrease of the scene |
In a foreground keys operate
|
Moving перёд-back |
|
Turn on a place to the left - to the right |
|
Moving, not turning, upwards - вниз-влево-вправо |
|
To look above (" to lift a head ") |
|
To look below (" to lower(omit) a head ") |
|
To turn back back |
Review of points a graphics is supported by the interface functions of
CL_OnMouseMove library, CL_OnMouseDown, CL_OnMouseUp
and CL_OnKeyPress.
Choice of a subset of points a graphics at selection of area
by the left mouse button. The form of selected(allocated) area can be varied
(a rectangle, the ellipse, a half-plane, a bar). Click on a point the left
mouse button selects the indicated point or a little at once if they are
overlapped. Selected points are outlined by color (by default white). The
points having a size (S > 1 and W > 0) can be selected only.
Output of the summary table on selected points. For each point
text string(line) TT is output. Moving on
table lines is clocked with activation of a point on a graphics.
Activation of any point by right button click. Activation differs
from choice by that, that one point can be active only. keys
and make
active the previous and following point in limits of the same series. keys
and allow to
move on series. The active point is highlighted (by default yellow color),
number outputs text comment TR. Right button
click outside of points removes activation.
Output of the comment near to each of selected points. The text
of the comment sets for each point property TN.
Illumination of a point, candle or column of the histogram on
which the mouse pointer (by default blue color) has stopped. Simultaneously
in статусную string(line) the text comment set by property TB
is output.
Output of current coordinates of a mouse pointer in статусную
string(line). If the mouse works in the mode of selection, shift or scaling,
in статусной the size of selected(allocated) area is informed string(line).
TSliChart components supports all functions of navigating described above
and review, and in addition defines(determines) response to shortcuts:
{TSliChart}
|
Repeated loading from the file |
|
Copying a graphics without reading from the file |
|
Copying a graphics in a clipboard |
|
Printing a graphics on the printer |
|
Output of the table of the selected(allocated) points |
|
Transition to the following slide |
|
Transition to the previous slide |
|
Cyclic switching of modes of selection of points: addition, deleting,
inversion of selection |
|
Cyclic switching of the form of selected(allocated) area: a rectangle,
the ellipse, a half-plane, a bar |
|
Selection of all points (removal, inverting - depending on the current
mode of selection) |
|
Navigating on panels of a slide |
Interactivity:
the Utility of review of diagrams chdView
ChdView utility is intended for review of diagrams of CHD format in one
or several windows. She(it) supports a complete set of the interactive
possibilities realized in ChartLib library and in TSliChart component,
and in addition gives possibility of operation with files, selections of
subsets of points, operations with slides and films. Access to these possibilities
is carried out through the menu organized as
a toolbar. {TSliChart}
By call of the utility to it(her) transfers the list of loaded files:
chdView <options> <file>...
<Options> <file> of <option>
The utility perceives the following options (between a name of an option
and value of an option there should not be blank):
-dИмяДиректории |
Name of the directory from which all subsequent files will be read
out. |
-wШиринаОкна |
Width of the window of the browser of diagrams, in pixels. |
-hВысотаОкна |
Height of the window of the browser of diagrams, in pixels. |
-xЛевоОкна |
Position of a left edge of the window of the browser of diagrams, in
pixels. |
-yВерхОкна |
Position of upper edge(territory) of the window of the browser of diagrams,
in pixels. |
-n |
To create a new slide. If the option is not indicated before a filename,
and this file does not contain own NewSlide command contents of the file
will be loaded on the previous slide. {*NewSlide} |
-s |
To use built - in статусную string(line) on each slide. |
-b |
To use double-buffer. The graphics accelerates plotting and does(makes)
by its(her) smoother, but the graphics in each open window demands additional
memory size on storage of the raster map. |
-/ |
To ignore the rest of the command line. |
At start without parameters chdView utility shows a slide with the empty
diagram. In this case the user loads the CHD-file for review with the help
of buttons of the menu.
The herein provided functions of the menu are supported only by chdView
utility. This utility is realized on base TSliChart component and included
in distribution kit ChartLib together with the initial code.
|
The main menu |
Submenu |
The menu consists of two parts. Buttons the main menu, on the right
- buttons of a submenu at the left are located. Buttons the main menu the
user switches from one submenu to another. Each submenu unites group of
functions close to destination.
Buttons the main menu
|
Loading, conversion and printing of CHD-files |
|
Parameter setup of mapping |
|
Selection of a subset of points and output of the summary table on
the selected(allocated) points |
|
Scrolling of films, deleting and moving of slides |
|
Operation with series of points on current to a graphics |
|
Windowing |
|
Manual, hints and the other information |
|
Automatically generated submenu from 12 most popular buttons |
Buttons of operation with files
|
To open the CHD-file and to load his(its) contents on a new pure(clean)
slide |
|
To open the CHD-file and to load his(its) contents instead of a current
slide |
|
To open the CHD-file and to load his(its) contents atop of a current
slide |
|
To open the CHD-file and to load his(its) contents in the new window |
|
To save a slide as the raster map in the file of BMP format |
|
To save a slide as the vector map in the file of EMF format |
|
To save a slide as the raster map in the file of GIF format |
|
To print out a slide |
|
To close all windows, to leave from the program |
Buttons of parameters of mapping
|
To cancel show тектовых comments TR near
to points |
|
To show тектовые comments TR only near
to the selected(allocated) points |
|
To show тектовые comments TR near to
all points |
|
To refresh a slide |
|
To place(install) a maximum scale of mapping for all diagrams on a
slide. A maximum scale the graphics allows to see all points. |
|
To include / disable the mode of double-buffer. At the included buffering
the slide appears faster and without flashing on the screen, but it demands
the greater memory size. |
Buttons of selection of a subset of points
|
To select(allocate) points |
|
To deselect from points |
|
To invert selection of points |
|
To select(allocate) all points a graphics |
|
The form выделителя areas - a rectangle |
|
The form выделителя areas - the ellipse |
|
The form выделителя areas - a half-plane |
|
The form выделителя areas - a bar |
|
To select / not to select(allocate) the points which are taking place
outside area visible in the window a graphics |
|
To output the summary table on the selected(allocated) points |
Buttons of operations with slides and films
|
To proceed(pass) to the first slide in film |
|
To proceed(pass) to the previous slide in film |
|
To proceed(pass) to the following slide in film |
|
To proceed(pass) to the last slide in film |
|
To start show of film. All slides are shown sequentially with the given
delay. |
|
To stop show of film |
|
To show film in cycle an infinite number of times |
|
To copy a slide in the buffer |
|
To clear a slide, having deleted with him(it) all of a graphics |
|
To delete a slide, to withdraw it(him) from film |
|
To move a current slide, having put his(its) the first in film |
|
To swap a current slide and previous |
|
To swap a current slide and the following |
|
To move a current slide, having put his(its) latter in film |
|
To produce help information about quantity(amount) and names of slides |
Buttons for operation with series of points on a graphics
|
To include / disable mapping a selected series of points |
|
To draw a selected series of points atop of other units a graphics |
Buttons for windowing
|
To attach the information table to the window a graphics |
Buttons of hints and documentation
|
Manual on CHD format |
|
The instruction of using chdView utility |
|
To include / disable pop-up hints on buttons of the menu |
|
Home page of the developer in Internet |
|
Briefly about the program |
ChartLive
--- © K.Vorontsov ---
1999-2001