
May 28, 2006
Pragma 6 can display charts in a Pragma 6 form.
An empty, default report is automatically created by running the standard verb DISPLAY CHART (DSCH). Of course an empty chart is of no use to anybody, so you must tell Pragma 6 what you want to show and how you want to show it. To do this you must create a chart text file with all the chart parameters. The first parameter of the verb must contain the path-filename of the textfile. You can put the text file wherever you want, as long as your computer can see it. The second parameter of the verb determines the style of the dialog box (not yet supported).
The chart text file can have any suffix you want and you must specify it in the path-filename. We strongly suggest that you call all yout report text files with the same suffix so that you can easily find them.
The most important parameter in the chart text file is the ChartStyle parameter. It determines what kind of chart will be displayed, for instance a line chart or a pie chart.
A line chart can display a maximum of four different lines in the same chart.
An explanation of all the parameters is listed below. Wherever it makes sense a parameter has a default value. If the default value seems right for you, you can omit that parameter. There are no checks for the parameters and you can write nonsense values and more than likely there will be a nonsense report or response.
A Pragma 6 program can contain as many charts as you desire, as long as every chart has its own chart text file.
Please note that the charts program was developed on a screen with a resolution of 1024 x 768. The results on other resolutions have not been tested.
The tutorial vocab contains a form, FORM TEST CHARTS, that displays various charts. With the tutorial vocab there are also some chart text files. They all have the suffix .p6c.
The chart text file is a regular text file that lists all the compulsory and optional parameters that will be used to draw the chart.
You must create the chart text file with any text editor that creates a text file, without control characters besides carriage return - new line (_M_J).
Another way of course is to create the chart text file from within a Pragma program. This option is left to your ingenuity. In the future there may also be a chart text file editor, to facilitate your task.
All parameters start with the parameter name, followed by an equal (=) sign and then the parameter itself, followed by a carriage return. A space before and or after the equal sign is optional. The parameter name is shown with some caps, to facilitate the reading of the parameter. These caps are optional, since the program converts all the parameter names to lower case letters.
There are various types of parameters, each with his own syntax.
Line Charts
| The maximum number of XAxisValues and XAxisValuesNames is 20. |
Pie Charts
| The maximum number of pie slices that can be displayed is 20. |
Line Charts
Data Parameters are entered in the sequence in which they will be displayed. Data parameters for the second line are preceeded by Data2, for a third line Data3 and for a fourth line Data4
| Example: | Data = 0, 1.4 |
| Data = 1.5, 2.5 |
| Data = 3, 3.25 | ||
| etc. | ||
| Data2 = 2, 1.25 | ||
| Data2 = 4, 3.75 | ||
| etc. |
Pie Charts
Data Parameters are entered in the sequence in which they will be displayed.
| Example: | Data = 0, 38 |
| Data = 2, 49 |
| Data = 3, 25 | ||
| etc. |
You are not allowed to enter zero for a data value. You may get unpredictable results. In a pie chart you either have a slice of pie or you go hungry.
A text parameter contains a text string. What you see is
what you get.
Do
not use quotes (") unless you want them also displayed. If you don't
want anything displayed, not even the defaults, leave the entry after the equal
sign blank.
Don't forget the carriage return, if you are at the end of the file.
The text on the caption bar of the form that contains the chart. If this parameter is omitted the default will display the chart text file name.
| Default: | DialogCaptionbarText = Pragma 6 Chart + textfile name |
The text on the status line of the form with the chart.
| Default: | StatuslineMessage = Welcome to the Pragma 6 chart |
The text above a chart used to describe the chart
| Default: | ChartHeadingText = Chart Heading |
Color parameters, in the RGB (red, green, blue) format. The letters RGB are optional, but you must enclose the three color numbers in parenthesis and divide them with a comma. The color numbers go from 0 to 255. But you should know that by now.
| Example: | RGB (0, 0, 0) | Black |
| Example: | RGB (255, 255, 255) | White |
| Example: | RGB (255, 0, 0) | Red |
The background color of the form (The client area).
| Default: | RGB (255, 255, 255) | White |
The color of the chart heading text. The chart heading is the text above the chart, in the form.
| Default: | RGB (0, 0, 0) | Black |
The background color of the area around the chart. It gives a frame to the actual chart.
| Default: | 0,150,240 | A kind of blue |
The color of the pen that draws the rectangle around the chart area.
| Default: | RGB (0, 0, 0) | Black |
The background color of the chart area.
| Default: | RGB (240, 240, 240) | Pale Gray |
The color of the axis.
| Default: | RGB (0, 0, 255) | Blue |
The color of the text besides the axis.
| Default: | RGB (255, 0, 0) | Red |
The color of the chart lines. A maximum of four lines per chart is supported. The colors of the other lines are defined ChartPenColor2, ChartPenColor3 and ChartPenColor4.
| ChartPenColor1 | Default: | RGB (0, 0, 0) | Black |
| ChartPenColor2 | Default | RGB (255, 0, 0) | Red |
| ChartPenColor3 | Default | RGB (0, 255, 0) | Green |
| ChartPenColor4 | Default | RGB (0, 0,255) | Blue |
The color of the various slices of the pie chart. A maximum of 20 pie slices per chart is supported.
| ChartBrushColor1 | Default: | RGB (0, 0, 0) | Black |
| ChartBrushColor2 | Default | RGB (255, 0, 0) | Red |
| ChartBrushColor3 | Default | RGB (0, 255, 0) | Green |
| ChartBrushColor4 |
etc.
The width of the pen that draws the axis.
| Default: | AxisPenWidth = 3 |
The width of the pen that draws the rectangle around the chart area.
| Default: | ChartAreaPenWidth = 1 |
Default 5
The width of the pen that draws the chart. The widths of the other lines are defined ChartPenWidth2, ChartPenWidth3 and ChartPenWidth4.
| Default: | ChartPenWidth1 = 1 | |
| Default: | ChartPenWidth2 = 2 | |
| Default: | ChartPenWidth3 = 3 | |
| Default: | ChartPenWidth4 = 4 |
The rectangle parameters define the size of rectangles that surround the chart.
Do not think of the numbers as real rectangles but of the position of the rectangle sides.
Determines the outermost rectangle in the client area.
Default 30, 40, 200, 50
30 is the distance from the left side of
the client area.
40 is the distance from the top of the
client area.
200 is the distance from the right side of
the client area.
50 is the distance from the bottom of the
client area.
In effect this parameters determines the size of the complete chart .
There are no checks for these numbers, so you can add anything, sometimes resulting in something that you did not want.
Determines the outermost rectangle in the client area.
Default 40,40,40,40
First number is the distance from the left
side of the chart area.
Second number is the distance from the top
of the chart area.
Third number is the distance from the right
side of the chart area.
Fourth number is the distance from the bottom
of the chart area.
For instance a sequence of numbers in the following format:
XAxisValues = 0, 10, 20, 30, 40, 50, 60
The numbers, if more than one, must be separated by commas. Blank spaces are ignored.
The style of the chart that will be displayed
10 is a line chart
20 is a pie chart
| Example: | ChartStyle = 20 | Pie chart |
| Default: | ChartStyle = 10 | Line chart |
The values that will appear on the X axis, not necessarily printed out as numbers but as subdivision of the X axis.
They must be
evenly spaced, like for instance -10, 0, 10, 20 etc not 0, 10, 15, 30 etc.
The limit is 20 values, as long as
they are separated by commas and fit on the chart.. Blank spaces are before the number are
ignored. No default.
| Example: | XAxisValues = 0, 500, 1000, 1500, 2000, 2500 |
The values that will appear on the Y axis, as subdivision of the Y axis.
They must be evenly spaced, like for instance -20 0, 20, 40 etc not -5, 0, 10, 15, 30 etc. The limit is 20 values, as long as they are separated by commas and fit on the chart.. Blank spaces are before the number are ignored. No default.
| Example: | YAxisValues = -50, -25, 0, 25, 50, 75, 100 |
For instance, a string sequence in the following format:
XAxis ValuesNames = mon, tue, wed, thu, fri, sat, sun
Line Charts
The strings that will appear on the X axis instead of the XAxisValues.
The XAxisValues must start from 0 and proceed with subsequent numbers.
For instance, for
XAxisValuesNames = mon, tue, wed, thu, fri, sat, sun
you must enter
XAxisValues = 0, 1, 2, 3, 4, 5, 6
if you want your data to start at 0.
The limit of value names is 20, as long as they are separated by commas and fit on the chart.. Blank spaces before the strings are ignored.
Pie Charts
The strings (names) that will appear besides each slice identification. If you omit this parameter numbers from 1 to the number of data entries will be displayed.
If you want to show a slice for each month, the XAxisValuesNames must be like this:
| Example: | YAxisValuesNames = Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec |
The data for each month must look like this:
| Data = 1, 80 | |
| Data = 2, 65 | |
| Data = 3, 120 | |
| etc. |
Can either be true or false.
Line Charts
Whether to show the complete grid (true) or only short lines on the axis (false).
| Default: | ShowGrid = true |
Whether to show the exit button (true) or not (false).
| Default: | ShowExitButton = false |
A line chart with positive and negative data on both axis and everything else using the default values looks like this:
XAxisValues = 0,1, 2, 3, 4, 5, 6, 7, 8
YAxisValues = -2, -1, 0, 1, 2, 3, 4
Data = 0, 1.4
Data = 1.5, 2.5
Data = 2, 0.45
Data = 3, -1.5
Data = 4, 3.9
Data = 5, 1.9
Data = 6, 1.8
Data = 7, 3.9
Data = 8, 1.5
Besides a small description of what is wrong, please always send me the chart text file that is the culprit. A printout of the chart text file is also acceptable.
I welcome suggestions, as long as you don't consider them orders. Here is a list of future possibilities. Let me know on a scale from 1 to 10 (1 = absolutely not necessary, save your efforts, 10 = would like this featre for yesterday) what you consider important or not.
Chart Text File editor. A Pragma 6 utility that lets you create a chart text file.
Printing of a chart.
Choice of various forms that host the charts (Borders, various sizes and positions).
Bar charts.