Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Defining a graph’s properties – PB Docs 80 – PowerBuilder Library

Defining a graph’s properties – PB Docs 80

Defining a graph’s properties

This section describes properties of a graph that are used
regardless of whether the graph is in a DataWindow object or in a window.

To define the properties of a graph, you use the graph’s
Properties view.

For general information about the property
pages, see “Using the graph’s
Properties view”
.

Using the General property page in the graph’s Properties view

One of the first things you will probably do with a graph
is name it and define its basic properties. You can do that on the
General property page in the graph’s Properties view.

proc.gif To specify the basic properties of a graph:

  1. Select Properties from the graph’s
    popup menu and then select the General page in the Properties view:

    graph36.gif

About the model graph in the Design view

As you modify your graph’s properties, PowerBuilder updates
the model graph shown in the Design view so you can get an idea
of the graph’s basic layout:

  • PowerBuilder uses the graph title and axis labels you specify.
  • PowerBuilder uses sample data (not data from your DataWindow object) to
    illustrate series, categories, and values.

In Preview view, PowerBuilder displays the graph with data.

Naming a graph

You can modify graphs in scripts during execution. To reference
a graph during execution, you use its name.

proc.gif To name a graph:

  1. On the General properties page for the
    graph, assign a meaningful name to the graph in the Name box.

Defining a graph’s title

The title displays at the top of the graph.

proc.gif To specify a graph’s title:

  1. On the General properties page for the
    graph, enter a title in the Title box.

note.gif Multiline titles You can force a new line in a title by embedding ~n.

For information about specifying properties
for the title text, see “Specifying text properties
for titles, labels, axes, and legends”
.

Specifying the type of graph

You can change the graph type anytime in the development
environment. (To change the type during execution, modify a graph’s
GraphType property.)

proc.gif To specify the graph type:

  1. On the General properties page for the
    graph, select a graph type from the Graph Type dropdown listbox.

Using legends

A legend provides a key to your graph’s series.

proc.gif To include a legend for a series in a graph:

  1. On the General properties page for the
    graph, specify where you want the legend to appear by selecting
    a value in the Legend dropdown listbox.

For information on specifying text properties
for the legend, see “Specifying text properties
for titles, labels, axes, and legends”
.

Specifying a border

You can specify the border that PowerBuilder places around a
graph.

proc.gif To specify a border for a graph:

  1. On the General properties page for the
    graph, select the type of border to use from the Border dropdown
    listbox.

Specifying point of view in 3D graphs

If you are defining a 3D graph, you can specify the point
of view that PowerBuilder uses when displaying the graph.

proc.gif To specify a 3D graph’s point of view:

  1. On the General properties page for the
    graph, adjust the point of view along the three dimensions of the
    graph:

    • To change the perspective,
      move the Perspective slider.
    • To rotate the graph, move the Rotation slider.
    • To change the elevation, move the Elevation slider.
  2. Define the depth of the graph (the percent the
    depth is of the width of the graph) by using the Depth slider.

Sorting data for series and categories

You can specify how to sort the data for series and categories.
By default, the data is sorted in ascending order.

proc.gif To specify how to sort the data for series and
categories in a graph:

  1. Select Properties from the graph’s
    popup menu and then select the Axis

    page in the Properties view.

  2. Select the axis for which you want to specify
    sorting.

  3. Scroll to Sort, the last option on the Axis page,
    and select Ascending (order), Descending (order), or Unsorted.

Specifying text properties for titles, labels, axes, and legends

A graph can have four text elements:

  • Title
  • Labels for the axes
  • Text that shows the values along the axes
  • Legend

graph38.gif

You can specify properties for each text element.

proc.gif To specify text properties for the title, labels,
axes values, and legend of a graph:

  1. Select Properties from the graph’s
    popup menu and then select the Text page in the Properties view.

  2. Select a text element from the list in the Text
    Object dropdown listbox:

    graph40.gif

  3. Specify the font and its characteristics.

Using Auto Size

With Auto Size in effect, PowerBuilder resizes the text appropriately
whenever the graph is resized. With Auto Size disabled, you specify
the font size of a text element explicitly.

proc.gif To have PowerBuilder automatically size a text element
in a graph:

  1. On the Text properties page for the graph,
    select a text element from the list in the Text Object dropdown
    listbox.

  2. Select the Autosize checkbox (this is the default).

proc.gif To specify a font size for a text element in a
graph:

  1. On the Text properties page for the graph,
    select a text element from the list in the Text Object dropdown
    listbox.

  2. Deselect the Autosize checkbox.

  3. Select the Font size in the Size dropdown listbox.

Rotating text

For all the text elements, you can specify the number of degrees
by which you want to rotate the text.

proc.gif To specify rotation for a text element in a graph:

  1. On the Text properties page for the graph,
    select a text element from the list in the Text Object dropdown
    listbox.

  2. Specify the rotation you want in the Escapement
    box using tenths of a degree (450 means 45 degrees)

Changes you make here are shown in the model graph in the
Design view and in the Preview view.

Using display formats

proc.gif To use a display format for a text element in
a graph:

  1. On the Text properties page for the graph,
    select a text element from the list in the Text Object dropdown
    listbox.

  2. Type a display format in the Format box or choose
    one from the popup menu. To display the popup menu, click the button
    to the right of the Format box.

Modifying display expressions

You can specify an expression for the text that is used for
each graph element. The expression is evaluated at execution time.

proc.gif To specify an expression for a text element in
a graph:

  1. On the Text properties page for the graph,
    select a text element from the list in the Text Object dropdown
    listbox.

  2. Click the button next to the Display Expression
    box.

    The Modify Expression dialog box displays:

    graph44.gif

  3. Specify the expression.

    You can paste functions, column names, and operators. Included
    with column names in the Columns box are statistics about the columns,
    such as counts and sums.

  4. Click OK to return to the graph’s Properties
    view.

Example

Here’s an example of using expressions to enhance
a graph.

By default, when you generate a pie graph, PowerBuilder puts
the title at the top and labels each slice of the pie with the percentage
each slice is of the whole. Percentages are accurate to two decimal
places.

The following graph has been enhanced as follows:

  • The current date displays
    in the title
  • The percentages are rounded to integers
  • The raw data for each slice is shown in addition
    to the percentages

graph46.gif

To accomplish this, the display expressions were modified
for the title and pie graph labels:

Text element Original expression Modified expression
Title title title + ” as of ” + date(today())
Pie graph labels if(seriescount > 1, series, string(percentofseries, “0.00%”)) if(seriescount > 1, series, string(percentofseries,”0%”) + ”
(” + value + “)” )

Specifying overlap and spacing

With bar and column charts, you can specify the following
properties:

Property Meaning
Overlap The percentage by which bars or columns
overlap each other. The default is 0 percent, meaning no overlap
Spacing The amount of space to leave between
bars or columns. The default is 100 percent, which leaves a space
equal to the width of a bar or column

proc.gif To specify overlap and spacing for the bars or
columns in a graph:

  1. Select Properties from the graph’s
    popup menu and then select the Graph tab.

  2. Specify a percentage for Overlap (% of
    width) and Spacing (% of width).

Specifying axis properties

Graphs have two or three axes. You specify the axes’ properties
in the Axis page in the graph’s Properties view.

proc.gif To specify properties for an axis of a graph:

  1. Select Properties from the graph’s
    popup menu and then select the Axis page in the Properties view.

  2. Select the Category, the Value, or the Series
    axis from the Axis dropdown listbox.

    If you are not working with a 3D graph, the Series Axis options
    are disabled.

  3. Specify the properties as described next.

Specifying text properties

You can specify the characteristics of text that displays
for each axis. There are two kinds of text associated with an axis:

Type of text Meaning
Text Text that identifies the values for an
axis
Label Text that describes the axis. You specify
the label text in a painter. You can use ~n to embed a new line
within a label

For information on specifying properties for
the text, see “Specifying text properties
for titles, labels, axes, and legends”
.

Specifying data types

The data graphed along the Value, Category, and Series axes
has an assigned data type. The Series axis always has the data type
String. The Value and Category axes can have the following data
types:

Axis Possible data types
Both axes (for scatter graph) Number, Date, Time
Value (other graph types) Number, Date, DateTime, Time
Category (other graph types) String, Number, Date, DateTime, Time

For graphs in DataWindow objects, PowerBuilder automatically assigns
the data types based on the data type of the corresponding column;
you do not specify them.

For graphs in windows, you specify the data types yourself.
Be sure you specify the appropriate data types, so when you populate
the graph (using the AddData function), the data matches the data
type.

Scaling axes

You can specify several properties that define the scaling
used along numeric axes:

Property Meaning
Autoscale If selected (the default), PowerBuilder automatically
assigns a scaling for the numbers along the axis
Round To, Round To Unit Specifies how to round the end points
of the axis (note that this just rounds the range displayed along
the axis; it doesn’t round the data itself)You can specify a number and a unit. The unit is based on
the data type; you can specify Default as the unit to have PowerBuilder decide
for youFor example, if the Value axis is a Date column, you can specify that
you want to round the end points of the axis to the nearest five
years. In this case, if the largest data value is the year 1993, the
axis will extend up to 1995, which is 1993 rounded to the next highest
five-year interval
Minimum Value, Maximum Value The smallest and largest numbers to appear
on the axis (disabled if you have selected Autoscale)
Scale Type Specifies linear or logarithmic scaling
(common or natural)

Using major and minor divisions

You can divide axes into divisions. Each division is identified
by a tick mark, which is a short line that intersects an axis. The
following graph’s Value axis is divided into two major
divisions. One goes from 0 to 100. The other goes from 100 to 200:

graph52.gif

By default, PowerBuilder divides the axes automatically into
major divisions.

proc.gif To define divisions for an axis of a graph:

  1. To divide an axis into a specific number
    of major divisions, type the number of divisions you want in the
    MajorDivisions box.

    Leave the number 0 to have PowerBuilder automatically create
    divisions.

    graph53.gif

    By default, PowerBuilder labels each tick mark in major divisions.
    If you don’t want each tick mark labeled, enter a value
    in the DisplayEveryNLabels box. For example, if you enter 2, PowerBuilder will label
    every second tick mark for the major divisions.

  2. To use minor divisions, which are divisions within
    each major division, type the appropriate number in the MinorDivisions
    box. To not use minor divisions, leave the number 0:

    graph54.gif

    note.gif When using logarithmic axes If you want minor divisions, specify 1; otherwise, specify
    0.

Specifying division lines You can specify lines to represent the divisions:

Line Meaning
Grid line A line that extends from a tick mark
across the graph. Grid lines make graphs easier to read
Drop line A line that extends vertically from a
data point to its axis (not available for all graph types)

graph55.gif

Using line styles

You can define line styles for the following components of
an axis:

Component Meaning
PrimaryLine The axis itself
SecondaryLine The axis parallel to and opposite the
primary axis
OriginLine A grid line that represents the value
zero
Frame The frame for the axis in 3D graphs (disabled
for 2D graphs)

Specifying a pointer

You can specify a pointer to use when the mouse is over a
graph during execution.

proc.gif To specify a pointer for a graph:

  1. Select Properties from the graph’s
    popup menu and then select the Pointer page in the Properties view.

  2. Select a stock pointer from the list, or select
    a CUR file containing a pointer.


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x