Using graphs – PB Docs 90

Using graphs

In PowerBuilder, there are two ways to display graphs:

  • In a DataWindow, using data retrieved from the DataWindow
    data source
  • In a graph control in a window or user object, using
    data supplied by your application code

This chapter discusses the graph control and describes how
your application code can supply data for the graph and manipulate
its appearance.

For information about graphs in DataWindows, see the DataWindow Programmer’s
Guide

and the DataWindow Reference
.

To learn about designing graphs and setting
graph properties in the painters, see the PowerBuilder User’s
Guide

.

Working with graph controls in code

Graph controls in a window can be enabled or disabled, visible
or invisible, and can be used in drag and drop. You can also write
code that uses events of graph controls and additional graph functions.

Properties of graph controls

You can access (and optionally modify) a graph by addressing
its properties in code at runtime. There are two kinds of graph
properties:

  • Properties
    of the graph definition itself
    These properties are initially set in the painter when you
    create a graph. They include a graph’s type, title, axis
    labels, whether axes have major divisions, and so on.
  • Properties of the data These properties are relevant only at runtime, when data has
    been loaded into the graph. They include the number of series in
    a graph (series are created at runtime), colors of bars or columns for
    a series, whether the series is an overlay, text that identifies
    the categories (categories are created at runtime), and so on.

Events of graph controls

Graph controls have the events listed in Table 14-1.

Table 14-1: Graph control events
Clicked DragLeave
Constructor DragWithin
Destructor GetFocus
DoubleClicked LoseFocus
DragDrop Other
DragEnter RButtonDown

So, for example, you can write a script that is invoked when
a user clicks a graph or drags an object on a graph (as long as
the graph is enabled).

Functions for graph controls

You use the PowerScript graph functions in Table 14-2 to manipulate data
in a graph.

Table 14-2: PowerScript graph functions
Function Action
AddCategory Adds a category
AddData Adds a data point
AddSeries Adds a series
DeleteCategory Deletes a category
DeleteData Deletes a data point
DeleteSeries Deletes a series
ImportClipboard Copies data from the clipboard to a graph
ImportFile Copies the data in a text file to a graph
ImportString Copies the contents of a string to a
graph
InsertCategory Inserts a category before another category
InsertData Inserts a data point before another data
point in a series
InsertSeries Inserts a series before another series
ModifyData Changes the value of a data point
Reset Resets the graph’s data

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