Syntax 1 For setting a series' colors

Description

Specifies the colors of a series in a graph.

Applies to

PowerBuilder DataWindow

DataWindow control

Syntax

PowerBuilder

integer dwcontrol.SetSeriesStyle ( string graphcontrol, string seriesname, grColorType colortype, long color )

Argument

Description

dwcontrol

A reference to the DataWindow control containing the graph.

graphcontrol

A string whose value is the name of the graph in the DataWindow control.

seriesname

A string whose value is the name of the series for which you want to set the color.

colortype

A value of the grColorType enumerated datatype specifying the item for which you want to set the color.

For a list of values, see grColorType.

color

A long specifying an RGB value for the new color.


Return value

Returns 1 if it succeeds and -1 if an error occurs. If any argument's value is null, SetSeriesStyle returns null.

Usage

Data points in a series can have their own style settings. Settings made with SetDataStyle set the style of individual data points and override series settings.

The graph stores style information for properties that do not apply to the current graph type. For example, you can set the fill pattern in a two-dimensional line graph or the line style in a bar graph, but that fill pattern or line style will not be visible.

You can specify the appearance of a series in the graph before the application draws the graph. To do so, define a user event for pbm_dwngraphcreate and call SetSeriesStyle in the script for that event. The event pbm_dwngraphcreate is triggered just before a graph is created in a DataWindow object.

Using SetSeriesStyle with DirectX 3D Graphs

You can only set the color for the foreground. Background, line color, and shade are not supported.

Examples

PowerBuilder

This statement sets the background color of the series named Salary in the graph gr_depts in the DataWindow control dw_employees to black:

dw_employees.SetSeriesStyle("gr_depts", &
      "Salary", Background!, 0)

These statements in the Clicked event of the graph control gr_product_data coordinate line color between it and the graph gr_sales_data. The script stores the line color for the series under the mouse pointer in the graph gr_product_data in the variable line_color. Then it sets the line color for the series Northeast in the graph gr_sales_data within the DataWindowcontrol dw_sales to that color:

string SeriesName
integer SeriesNbr, Series_Point
long line_color
grObjectType MouseHit
MouseHit = This.ObjectAtPointer( &
      SeriesNbr,Series_Point)
 
IF MouseHit = TypeSeries! THEN
      SeriesName = &
         gr_product_data.SeriesName(SeriesNbr)
 
      gr_product_data.GetSeriesStyle(SeriesName, &
         LineColor!, line_color)
 
      dw_sales.SetSeriesStyle("gr_sales_data", &
         "Northeast", LineColor!, line_color)
END IF

See also

GetDataStyle

GetSeriesStyle

SetSeriesStyle