Hyderabad Jobs Book Website FREE PowerBuilder Training I Love Hyderabad Hyderabad Colleges
Home Business Emails Hyderabad Classifieds Contact Us
7 Wonders of Hyderabad Web Hosting Yellow Pages Our Network

 
Webpowerbuilder.hyderabad-colleges.com

Introduction to PowerBuilder

HomePrevious Lesson: OLE 2.0 Control
Next Lesson: DataWindow Control

Graph Control

PowerBuilder allows you to add a Graph to your window with the help of this control, in any of the common graphical formats to present the numerical data.

There are numerous options for the properties of this control relating to titles, legends and axes, as well as the type of graph.

We won't go into details about it here.  In comparison with "Graph DataWindow", usage of a graph control in a Window is rare.  So it is better to learn about Graph control once you complete DataWindow session.

PowerBuilder Graph Terminology

Category: Categories are the major divisions of data. For example, we can divide all transactions into three major divisions (types) like 'Receipts', 'Issues', 'Returns'. In the above graph, there are three categories.

Series: Suppose, say you are comparing transactions for two products then, you will find receipts for each product, issues for each product and so on. In this example, each product is a series. Series are a set of data points. Let's take another example, say you are comparing transactions of a product for each month. Here you have 12 series, which means that you are comparing receipts for each month, issues for each month as well as returns for each month.

Values: This is the value of each series or category ( if no series are present ). The total number of receipts, total number of issues and total number of returns are values. Display of 'value' varies between graph types.

Title: The title of the graph. By default it appears at the top of the graph.

Category Axis: Category axis is the axis where the categories (major divisions of data) are plotted. Typically it is on the x-axis.

Series Axis: Series axis is the axis where the series (set of data points in a category) are plotted. In two-dimensional graphs this is on the same axis as the category axis. In three dimensional graphs it is different from the category axis. You can see this in the graph above.

Value Axis: Value axis is the axis where the values are plotted. Typically it is on the Y axis and varies in different graph types.

Legend: Legend displays how the series are represented. For example, you may have different colors for receipts, issues and returns. You can see the legend at the bottom of the above graphs. You can display legend at different places on the graph such as bottom, top, left, right, etc..

Ticks: Ticks displays the starting of another value on the value axis and represents categories on the category axis. You can display these ticks inside, outside or straddle (half on inside and half on outside) the axis. You can display ticks for major divisions as well as minor divisions. For example, the major division is 500 and if you want to display 4 minor divisions then PowerBuilder will display a minor division tick 4 times (after every 125) between each major division. The ticks for minor division can't be a straddle. Similarly, you can display label for each major division, but not for minor division.

Graph Types:
Column Graph:

In this graph the values are plotted along the Y axis and categories are plotted along the X axis. This type of graph is good for noncontiguous data.

Bar Graph:

It is similar to column graph except for the graph orientation. In this graph, values are plotted along the X axis and categories are plotted along the Y axis.

Line Graph: This graph is good for displaying continuous data, for example time and temperature. The data points are connected by lines. Graph properties such as overlap %, spacing % do not apply for this type of graph since the datapoints are connected by a continuous line.

Area Graph: It is similar to line graph except that the area under the lines are filled with color. When this graph has a series, each series is filled with a different color.
Stacked Graphs:

In stacked bar/column graphs, each category is displayed as one bar or column instead of a separate bar/column for each series in the category. You can choose between stacked, solid stacked, 3D stacked bar/column graphs.

Pie Chart Graph:

This graph displays the data as percentage of all the data. PowerBuilder automatically calculates the percentage. If you choose to have series in this graph, they are displayed as concentric circles.

Scatter Graph: This graph is different from all the graphs explained earlier. This graph does not use categories, instead it plots data values on both X and Y axis. This graph is used to display the relation between two data points. For example, speed & mileage, speed & production, project team size & time taken to complete the project, etc..
Three Dimensional Graphs:

All the above mentioned graphs have 3D graph versions except for scatter graph. The picture on the side is a three dimensional pie chart.

Graph Control Properties

You can specify the sorting order for the series as well as categories in the 'Series Sort' and 'Categories Sort' options. Using the 'Legend Location' you can specify the location of the legend, it can be bottom, top, left or right.

The 'Spacing (% of Width)' specifies the space between each category. Unless you have too many categories, you don't need to adjust this property. The 'Overlap (% of width)' specifies the percentage that each item in the category that should overlap. This property is more useful when you use bar or line graphs. The 'Depth (% of width)' property specifies the depth of each item in the category and can be set only for the 3D graphs such as 3D piechart, 3D column, 3D bar, etc..

In the 'Text' tab you can specify properties for text such as title, value axis, category axis and so on. Select the text object for which you want to set properties from the 'Text Object' ListBox and set properties for that text object. Other than the regular font properties, you can rotate the text either left or right in 450 or 900. This option is not available for title and legend.

Infact, the 'AutoResize' feature is the best option that you may always want to turn on. Turning on this property will adjust the text size automatically when the graph control is resized. This can be the case when you may want to resize the graph control in the window everytime the window is resized at run-time. You can't specify the font size when this option is turned on, which makes sense.

You can make the background color transparent in the graph control; this option is not available in most of the other window controls. For each text object, you can specify the display expression. For example if you want to display the date in the title,

title + "as of " + today()

In the above expression, title is the property of the graph control. This value, i.e. title can be specified in the 'Title' property on the 'Graph' tab page. Such as, if you are creating this graph to display inventory then you may want to set the title as 'Stock'. At run time the title for Jan 1st 1997 would be:

Stock as of 01-01-1997

If you don't specify any expression, PowerBuilder takes the value of the category/value and uses it.

On the value axis you can specify the minimum and the maximum values to use or you can choose 'AutoScale'. In the later option, PowerBuilder takes the maximum value in the data and adjusts the value points automatically for you. Depending on the Data value you can specify 'Round to Maximum' property. For example, if the value axis data type is numeric, then specifying 1 will round the fraction to the next integer value. If the value axis is of date data type then the value is rounded to the next highest year.

On the value axis you can divide the axis into some major divisions. For example, to display 5 data points each incremented by 100 you specify 5 for the 'Number' under the major divisions. If left to the default zero, PowerBuilder takes care of creating major divisions. PowerBuilder displays one tick at each major division. You can choose the tick type as 'inside', 'outside' or straddle. Similarly, you can choose to display grid line for major division.

You can divide each major division into few minor divisions and ask PowerBuilder to display ticks and grid lines for each minor division. However, you can't display labels for minor divisions.

If you are creating a Graph presentation style DataWindow, you find one more tab named 'Data'. In this tab you can specify the column that can be taken as value, category and series axis. However, in the graph control, you need to add data to the graph control at run-time through scripting.

Unlike the RTE control ( where it can share data with a DataWindow/ DataStore ), graph control can't share data with a DataWindow control/ DataStore object.

In case of three dimensional graphs you can specify rotation, elevation and perspective percentages. Otherwise this option is disabled.
HomePrevious Lesson: OLE 2.0 Control
Next Lesson: DataWindow Control

Copyright © 1996 - 2006 HamaraShehar.com Pvt. Ltd. All Rights Reserved.
Domain Registration, Website Design, Website Hosting by HamaraShehar.com