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

Accessing data properties – PB Docs 80 – PowerBuilder Library

Accessing data properties – PB Docs 80

Accessing data properties

To access properties related to a graph’s data during
execution, you use DataWindow methods for graphs. There are three categories
of these methods related to data:

  • Methods that provide information about a graph’s
    data
  • Methods that save data from a graph
  • Methods that change the color, fill patterns, and
    other visual properties of data

How to use the methods

To call the methods for a graph in a DataWindow control, use
the following syntax:

For example, there is a method CategoryCount, which returns
the number of categories in a graph. So to get the category count
in the graph gr_printer (which is in the DataWindow control
dw_sales), write:

Getting information about the data

There are quite a few methods for getting information about
data in a graph in a DataWindow control at execution time. For all
methods, you provide the name of the graph within the DataWindow
as the first argument. You can provide your own name for graph controls
when you insert them in the DataWindow painter. If the presentation
style is Graph, you do not need to name the graph.

PowerBuilder These methods get information about the data and its display. For
several of them, an argument is passed by reference to hold the
requested information:

Method Information provided
CategoryCount The number of categories in a graph
CategoryName The name of a category, given its number
DataCount The number of data points in a series
FindCategory The number of a category, given its name
FindSeries The number of a series, given its name
GetData The value of a data point, given its
series and position (superseded by GetDataValue, which is more flexible)
GetDataPieExplode The percentage at which a pie slice is
exploded
GetDataStyle The color, fill pattern, or other visual
property of a specified data point
GetDataValue The value of a data point, given its
series and position
GetSeriesStyle The color, fill pattern, or other visual
property of a specified series
ObjectAtPointer The graph element the mouse was positioned
over when it was clicked
SeriesCount The number of series in a graph
SeriesName The name of a series, given its number

Web ActiveX These methods get information about the data and its display. There
are additional helper methods available whenever the equivalent PowerBuilder
method uses an argument passed by reference. These helper methods
are identified in the second column of the following table (and
are described in the DataWindow Reference
):

Method Information provided
CategoryCount The number of categories in a graph
CategoryName The name of a category, given its number
DataCount The number of data points in a series
FindCategory The number of a category, given its name
FindSeries The number of a series, given its name
ObjectAtPointer The graph element the mouse was positioned
over when it was clickedCall ObjectAtPointerSeries and ObjectAtPointerDataPoint to
get additional information
SeriesCount The number of series in a graph
SeriesName The name of a series, given its number
Getting information
about a data point’s appearance
 
GetDataPieExplode The percentage at which a pie slice is
explodedCall GetDataPieExplodePercentage to retrieve the requested
value
GetDataStyleColor The color of a specified data pointCall GetDataStyleColorValue to retrieve the requested value
GetDataStyleFill The fill pattern of a specified data
pointCall GetDataStyleFillPattern to retrieve the requested value
GetDataStyleLine The line style and width of a specified
data pointCall GetDataStyleLineWidth and GetDataStyleLineStyle to retrieve
the requested values
GetDataStyleSymbol The symbol of a specified data pointCall GetDataStyleSymbolValue to retrieve the requested value
Getting a data
point’s value
 
GetDataDate The value of a data point that contains
a date, given its series and positionCall GetDataDateVariable to retrieve the requested value
GetDataNumber The value of a numeric data point, given
its series and positionCall GetDataNumberVariable to retrieve the requested value
GetDataString The value of a string data point, given
its series and positionCall GetDataStringVariable to retrieve the requested value
Getting information
about a series’ appearance
 
GetSeriesStyleColor The color of a specified seriesCall GetSeriesStyleColorValue to retrieve the requested value
GetSeriesStyleFill The fill pattern of a specified seriesCall GetSeriesStyleFillPattern to retrieve the requested value
GetSeriesStyleLine The line style and width used by a specified
seriesCall GetSeriesStyleLineWidth and GetSeriesStyleLineStyle to
retrieve the requested values
GetSeriesStyleOverlay Indication whether a series in a graph
is an overlay (that is, whether it is shown as a line on top of
another graph type)Call GetSeriesStyleOverlayValue to retrieve the requested value
GetSeriesStyleSymbol The symbol of a specified seriesCall GetSeriesStyleSymbolValue to retrieve the requested value

Saving graph data

PowerBuilder The following methods allow you to save data from the graph:

Method Action
Clipboard Copies a bitmap image of the specified
graph to the clipboard
SaveAs Saves the data in the underlying graph
to the clipboard or to a file in one of a number of formats

Web ActiveX You can save an image of the graph on the clipboard, but you cannot
save data in a file. Writing to the file system is a security violation
for an ActiveX control:

Method Action
Clipboard Copies a bitmap image of the specified
graph to the clipboard

Modifying colors, fill patterns, and other data

PowerBuilder The following methods allow you to modify the appearance of data
in a graph:

Method Action
ResetDataColors Resets the color for a specific data
point
SetDataStyle Sets the color, fill pattern, or other
visual property for a specific data point
SetSeriesStyle Sets the color, fill pattern, or other
visual property for a series

Web ActiveX These methods modify the appearance of data in a graph:

Method Action
ResetDataColors Resets the color for a specific data
point
SetDataColor Sets the color of a specified data point
SetDataFill Sets the fill pattern of a specified
data point
SetDataLine Sets the line style and width of a specified
data point
SetDataPieExplode Explodes a slice in a pie graph
SetDataSymbol Sets the symbol of a specified data point
SetSeriesColor Sets the color of a specified series
SetSeriesFill Sets the fill pattern of a specified
series
SetSeriesLine Sets the line style and width used by
a specified series
SetSeriesOverlay Specifies whether a series in a graph
is an overlay (that is, whether it is shown as a line on top of
another graph type)
SetSeriesSymbol Sets the symbol of a specified series

Using graph methods

You call the data-access methods after a graph has been created
and populated with data. Some graphs, such as graphs that display
data for a page or group of data, are destroyed and re-created internally
as the user pages through the data. Any changes you made to the
display of a graph, such as changing the color of a series, are
lost when the graph is re-created.

Event for graph creation

To be assured that data-access methods are called whenever
a graph has been created and populated with data, you can call the
methods in the code for an event that is triggered when a graph
is created. The
event is:

  • PowerBuilder Event ID pbm_dwngraphcreate, which you can assign
    to a user event for a DataWindow control (described below)
  • Web ActiveX The onGraphCreate event

The graph-creation event is triggered by the DataWindow control
after it has created a graph and populated it with data, but before
it has displayed the graph. By accessing the data in the graph in
this event, you are assured that you are accessing the current data
and that the data displays the way you want it.

Setting up the PowerBuilder user event

PowerBuilder provides an event ID, pbm_dwngraphcreate,
that you can assign to a user event for a DataWindow control.

proc.gif To access data properties of a graph in a DataWindow
control:

  1. Place the DataWindow control in a window
    or user object and associate it with the DataWindow object containing
    the graph.

    Next you create a user event for the DataWindow control that
    is triggered whenever a graph in the control is created or changed.

  2. Select the DataWindow control.

  3. Select Declare>User Events from the menu
    bar.

    The Events dialog box displays all the events defined for
    the DataWindow control.

  4. Name the user event you are creating. You might
    call it GraphCreate.

  5. Assign it the event ID pbm_dwngraphcreate
    by double-clicking pbm_dwngraphcreate in the Paste Event
    ID box:

    dagr01.gif

  6. Click OK to save the new user event.

  7. Write a script for the new GraphCreate event that
    accesses the data in the graph. Use the data-access methods listed
    above.

    Calling these methods in the GraphCreate event assures you
    that the data access happens each time the graph has been created
    or changed in the DataWindow.

Examples

PowerBuilder The following statement sets to black the foreground (fill) color
of the Q1 series in the graph gr_quarter, which is in the
DataWindow control dw_report. The statement is in the GraphCreate
event, which is associated with the event ID pbm_dwngraphcreate
in PowerBuilder:

The following statement changes the foreground (fill) color
to red of the second data point in the Stellar series in the graph
gr_sale in a window. The statement can be in a script for
any event:

Web ActiveX The following statement sets the foreground (fill) color to black
in one of the series in the graph gr_quarter, which is
in the DataWindow control dw_report. The statement is in
the onGraphCreate event:

For more information

For complete information about the data-access graph methods,
see the DataWindow Reference
.

For more about PowerBuilder user events, see the PowerBuilder
User’s Guide

.


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