分享

PowerBuilder Online Training Courses

 quasiceo 2013-11-12
FREE PowerBuilder Training

Introduction to PowerBuilder

HomePrevious Lesson: Graph Control
Next Lesson: DataWindow Control

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. Lines connect the data points. Graph properties such as overlap %, spacing % do not apply for this type of graph since a continuous line connects the datapoints.

Area Graph:

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

Stacked Graph:

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 SeriesSort and CategoriesSort options. Using the Legend you can specify the location of the legend; it can be at the bottom, top, left or right. The Spacing specifies the space between each category. Unless you have too many categories, you don't need to adjust this property. The OverlapPercent 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 property specifies the depth of each item in the category and can be set only for the 3D graphs such as 3D pie chart, 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.

In fact, the AutoSize 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 every time 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 RoundTo/RoundToUnit 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.

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约