[ Home ] [ Features ] [ Products ] [ FAQ's ] [ Screens ] [ Support ] [ Downloads ] [ About ] [ Discussion ]


the software that grows with you

 

V32Graphs()

Presents a graphical display of given data in a window which can be sent for the printing.

Syntax

V32Graphs(  <aData>, <aLabels>, <aLegends>, [aColors], [nType], [cTitleTop], [cTitleLeft], [cTitleBottom], [cBkGdBitmap],  [l3D], [lSpace], [lStacked], [lGridX], [lGridY], [lLegends], [lLabelsX], [lLabelsY], [lOutLines], [lData], [nPxlLeft], [nPxlTop], [nPxlWidth], [nPxlHeight], [nBGColor] )

Arguments

aData A two dimentional array of numeric data representing rows and columns. Len( aData ) will represent Labels and Len( aData[ 1 ] ) will represent Legends.
aLabels Array of character strings which will be displayed at the x-axis. This must match the rows in the <aData> or Len( <aData> ) otherwise graphics may not work properly.
aLegends Array of character strings representing columns in <aData> which will be displayed at the right side of the graph. Len( <aLegends> ) must match the Len( <aData>[ 1 ] ) otherwise graphics will not work properly.
aColors Array of RGB values matching the Len( <aLegends> ) used to draw the bars etc. The number of elements in <aColors> must be equal to elements in <aLegends>. Alternatively, you can avoid colors to let the graphics engine decide at its own the colors of bars etc.
nType One of the following values, default is TYP_BARS
TYP_LINE 1
TYP_BARS 2
TYP_AREA 3
TYP_PIE 4
cTitleTop Character string representing the title to be displayed at the top of graph window. The title will be displayed centered over the plotting area. Make it sure that <cTitleTop> must fit the plotting area otherwise excess portion from the right will be truncated to fit. It should be noted that <cTitleTop> is displayed in bold face Ariel font.
cTitleLeft Character string to be displayed verically at the left plane of the graphics window. It will be displayed centered at the left plane of the plotting area. Any exccess charcters will be truncated.
cTitleBottom Character string to be dispayed below the x-axis. It will be displaed centered along the x-axis plotting area. Any excess characters will be truncated from the right side.
cBkGdBitmap Fully qualified .BMP file name with drive, directory and extension information. If a valid BMP file, will be displayed within the boundries of back interior of plotting area. Please note that bitmap will not be displayed when graph is invoked. Instead it can be painted with clicking the right button anywhere within the graph window and selection appropriate option.
l3D Logical to specify whether chart is to be displayed as 3D. Default is TRUE.
lSpace Logical to specify whether chart is to be displayed as spaced. Default is FALSE.
lStacked Logical to specify whether chart is to be displayed as stacked. Default is FALSE. <lSpace> and <lStacked> are mustually exclusive options. If <lSpace> is set to TRUE, <lStacked> will be ignored and treated as FALSE.
lGridX Logical to specify whether chart is to be displayed with x-grids drawn. Default is TRUE.
lGridY Logical to specify whether chart is to be displayed with y-grids drawn. Default is TRUE.
lLegends Logical to specify whether chart is to be displayed with legends drawn. Default is TRUE.
lLabelsX Logical to specify whether chart is to be displayed with x-labels drawn. Default is TRUE.
lLabelsY Logical to specify whether chart is to be displayed with y-labels drawn. Default is TRUE.
lOutLines Logical to specify whether chart is to be displayed with outlines of bars drawn. Default is TRUE.
lData Logical to specify whether chart is to be displayed with data values drawn. Default is FALSE.
nPxlLeft Numeric to specify the left location on the desktop in terms of pixels. Default is 30.
nPxlTop Numeric to specify the top location on the desktop in terms of pixels. Default is 30.
nPxlWidth Numeric to specify the width of the chart window in terms of pixels. Default is 400.
nPxlHeight Numeric to specify the height of the chart window in terms of pixels. Default is 230.
nBgColor RGB color index as the background color of the chart window. Default is value returned by RGB( 255, 255, 255 ) that is white.

Returns

NIL

Description

V32Graphs() presents a dialog window displaying graphical representation of data forwarded. The window contains a toolbar to activate various properties to view the charts as per desired specification. Please see the section <Look> below to have a glimpse of default chart, if no parameters are passed. The window also activates a context menu on right click. All of the toolbar options plus a lot of others can be activated through context menu. 
Line Chart Converts the current display of chart to type LINE.
Bar Chart Converts the current display of chart to type BAE
Area Chart Converts the current display of chart to type AREA.
Pie Chart Converts the current display of chart to type PIE
3D View Toggles between the 3D ( Default ) and 2D view of the chart.
Stacked View Present the stacked view of current chart.
Clustered View Presents the clustered view of current chart.
Vertical Grid Toggles between whether vertical grid is to be displaying or not.
Horizontal Grid Toggles between whether horizontal grid is to be displaying or not.
Tools Dialog Will ( in some next release ) present a separate dialog to adjust the different parameters of available graph types. At present it swaps the axis, means, matrix of data is reversed where legends become labels and vice versa. Very handy to view same data from both angles.
Print Open up Print Setup Dialog to adjust the properties of printed output. The graph is then sent to the selected printer.
Context Menu activated through Right-Click anywhere on the Graphic Window

Reverse Side wall of plotting area is toggled from right to left or left to right.
Legends Toggles between wether legends are to be displayed at the right hand side of the Graph Window or not. If switched OFF, the plotting area will expand to consume the space used by them.
Outlines Toggles between where bars etc. are surrounded with black lines or not.
Data If activated data pertaining to the bars etc. will be displayed cenetered over its front panel, otherwise, data will not be displayed. 
Trend Line If switched on, the trend line will be drawn behind the bars etc. 
Bitmap If <cBitmap> is provided and file( <cBitmap> ) return TRUE, then it will be displayed behind the bars etc. spread over the back panel of plotting area. Please note that when graph display appears first time, the bitmap display is not activated by default, user has to switch it on through context menu.
X-Labels Toggles between whether <aLabels> are displayed on the X-Axis or not. By default it is turned ON. If the chart is of type PIE, these always remain turned OFF.
Y-Labels Toggles between whether numeric labels are displayed on the Y-Axis or not. By default it is turned ON. 
Cage Toggles between whether cage around the plotting area is displayed or not. Cage is comprised of back wall, left wall and base of plotting area. In a PIE chart cage is always turned OFF.
Titles Toggles between whether <cTitleTop>, <cTitleLeft> and <cTitleBottom> has to be displayed or not. If switched to OFF, the plotting area will expand to consume the space used by them.
Explode If graph is set to type PIE, indivisual slices can be set to explode by 10 degree. Every time user click on <Explode> option of context menu, another slice is set to explode. The counter goes on increasing till last slice and then restored back to zero.
Next Series If graph is set to type PIE, at one time only one series is available for plotting due to the inherent way a pie chart is viewd. Other series can be selected via this option. Note that always next to previous series is brought to display. At this stage you do not have the option to select one of your choice. It will be covered in some future version.

Usage

function DispGraph()

local aData := {}
local aLabels := {}
local aLegends := {}
local aColors := {}
local nType := 2 // Bars
local cTitleTop := "Sales Results '000 $"
local cTitleLeft := "Western Zone"
local cTitleBottom := "Himalayan Valley Products Only"
local cBitmap := "MyCompny.bmp"

aadd( aData, { 3, 15, 23 } )
aadd( aData, { 12, 7, 17 } )
aadd( aData, { 19, 11, 4 } )
aadd( aData, { 9, 21, 11 } )
aadd( aData, { 7, 5, 9 } )
aadd( aData, { 18, 1, 21 } )

aLabels := { 'January','February','March','April','May','June' }

aLegends := { 'Apple','Banana','Mango' }

aColors := { V32Rgb( 128,0,0 ), V32Rgb( 0,0,128 ), V32Rgb( 0, 128, 0 ) }

V32Graphs( aData, aLabels, aLegends, aColors, nType, cTitleTop, cTitleLeft, cTitleBottom, cBitmap )

Return ( nil )

Credits

The basic code is donated by Andrew Wos of Australia and August Infante of Argentina. I have added some bells and whisles and have made it available to Clipper and XBase++ developers. 

Tips

Look and Feel

[ Home ][ Features ] [ Products ][ About Us ][ FAQ's ][ Screen Shots ][ Downloads ][ Support ][ Discussion ]
.

Vouch is a Trademark of Pritpal Bedi
All other Trade Marks are the property of their respective owners.
Copyright 1993-2011 Pritpal Bedi. All rights reserved.
Hit Counter  
You are Visitor # since 14 May 2002