SetSeriesStyle

Specifies the appearance of a series in a graph. There are several syntaxes, depending on what settings you want to change.

To

Use

Set the series’ colors

Syntax 1 For setting a series’ colors

Set the line style and width

Syntax 2 For lines in a graph

Set the fill pattern or symbol for the series

Syntax 3 For the fill pattern and symbols in a graph

Specify that the series is an overlay

Syntax 4 For creating an overlay in a graph


Syntax 1 For setting a series’ colors

Description

Specifies the colors of a series in a graph.

Applies to

Graph controls in windows and user objects, and graphs in DataWindow controls

Syntax

controlname.SetSeriesStyle ( { graphcontrol, } seriesname, colortype, color )

Argument

Description

controlname

The name of the graph in which you want to set the color of a series, or the name of the DataWindow control containing the graph.

graphcontrol (DataWindow control only) (optional)

A string whose value is the name of the graph in the DataWindow control for which you want to set the color of a series.

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. Values are:

  • Foreground! – Text color

  • Background! – Background color

  • LineColor! – Line color

  • Shade! – Shade (for graphics that are three-dimensional or have solid objects)

color

A long specifying the new color for colortype.

Returns

Integer. 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.

For a graph in a DataWindow, you can specify the appearance of a series in the graph before PowerBuilder 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.

NoteUsing SetSeriesStyle with DirectX 3D Graphs You can only set the color for the foreground. Background, line color, and shade are not supported.

Examples

Example 1

This statement sets the text (foreground) color of the series named Salary in the graph gr_emp_data to black:

gr_emp_data.SetSeriesStyle("Salary", &

		Foreground!, 0)

Example 2

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)

Example 3

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 to that color:

string SeriesName

integer SeriesNbr, Series_Point

long line_color

grObjectType MouseHit


MouseHit = ObjectAtPointer(SeriesNbr,Series_Point)


IF MouseHit = TypeSeries! THEN

		SeriesName = &

			gr_product_data.SeriesName(SeriesNbr)


		gr_product_data.GetSeriesStyle(SeriesName, &

			LineColor!, line_color)


		gr_sales_data.SetSeriesStyle("Northeast", &

			LineColor!, line_color)

END IF

See also


Syntax 2 For lines in a graph

Description

Specifies the style and width of a series’ lines in a graph.

Applies to

Graph controls in windows and user objects, and graphs in DataWindow controls objects

Syntax

controlname.SetSeriesStyle ( { graphcontrol, } seriesname, linestyle,
	linewidth )

Argument

Description

controlname

The name of the graph in which you want to set the line style and width of a series, or the name of the DataWindow control containing the graph.

graphcontrol (DataWindow control only) (optional)

A string whose value is the name of the graph in the DataWindow control in which you want to set the line style and width.

seriesname

A string whose value is the name of the series for which you want to set the line style and width.

linestyle

A value of the LineStyle enumerated datatype. Values are:

  • Continuous!

  • Dash!

  • DashDot!

  • DashDotDot!

  • Dot!

  • Transparent!

linewidth

An integer specifying the width of the line in pixels.

Returns

Integer. 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.

For a graph in a DataWindow, you can specify the appearance of a series in the graph before PowerBuilder 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.

Examples

Example 4

This statement sets the line style and width for the series named Costs in the graph gr_product_data:

gr_product_data.SetSeriesStyle("Costs", &

		Dot!, 5)

See also


Syntax 3 For the fill pattern and symbols in a graph

Description

Specifies the fill pattern and symbol for data markers in a series.

Applies to

Graph controls in windows and user objects, and graphs in DataWindow controls

Syntax

controlname.SetSeriesStyle ( { graphcontrol, } seriesname, enumvalue )

Argument

Description

controlname

The name of the graph in which you want to set the appearance of a series, or the name of the DataWindow control containing the graph.

graphcontrol (DataWindow control only) (optional)

A string whose value is the name of the graph in the DataWindow control in which you want to set the appearance.

seriesname

A string whose value is the name of the series in which you want to set the appearance.

enumvalue

A value of an enumerated datatype specifying an appearance setting for the series. Values for the FillPattern or grSymbolType enumerated datatypes follow.

To change the fill pattern, use a FillPattern value:

  • Bdiagonal! (Lines from lower left to upper right)

  • Diamond!

  • Fdiagonal! (Lines from upper left to lower right)

  • Horizontal!

  • Solid!

  • Square!

  • Vertical!

To change the symbol type, use a grSymbolType value:

  • NoSymbol!

  • SymbolHollowBox!

  • SymbolX!

  • SymbolStar!

  • SymbolHollowUpArrow!

  • SymbolHollowCircle!

  • SymbolHollowDiamond!

  • SymbolSolidDownArrow!

  • SymbolSolidUpArrow!

  • SymbolSolidCircle!

  • SymbolSolidDiamond!

  • SymbolPlus!

  • SymbolHollowDownArrow!

  • SymbolSolidBox!

Returns

Integer. 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.

For a graph in a DataWindow, you can specify the appearance of a series in the graph before PowerBuilder 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.

NoteUsing SetSeriesStyle with DirectX 3D Graphs You cannot use a fill pattern or specify specific symbols for a series.

Examples

Example 5

This statement sets the symbol used for the series named Costs in the graph gr_product_data to a plus sign:

gr_product_data.SetSeriesStyle("Costs", &

		SymbolPlus!)

Example 6

This statement sets the symbol used for the series named Costs in the graph gr_computers in the DataWindow control dw_equipment to X:

dw_equipment.SetSeriesStyle("gr_computers", &

		"Costs", SymbolX!)

See also


Syntax 4 For creating an overlay in a graph

Description

Specifies whether a series is an overlay, meaning that the series is represented by a line on top of another graph type.

Applies to

Graph controls in windows and user objects, and graphs in DataWindow controls

Syntax

controlname.SetSeriesStyle ( { graphcontrol, } seriesname, overlaystyle )

Argument

Description

controlname

The name of the graph in which you want to set the overlay status of a series, or the name of the DataWindow control containing the graph.

graphcontrol (DataWindow control only) (optional)

A string whose value is the name of the graph in the DataWindow control in which you want to set the overlay status.

seriesname

A string whose value is the name of the series whose overlay status you want to change.

overlaystyle

A boolean value indicating whether you want the series to be an overlay, meaning that the series is shown in front as a line. Set overlaystyle to true to make the specified series an overlay. Set it to false to remove the overlay setting.

Returns

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

Usage

For a graph in a DataWindow, you can specify the appearance of a series in the graph before PowerBuilder 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.

NoteUsing SetSeriesStyle with DirectX 3D Graphs You cannot use the overlay style for a series.

Examples

Example 7

This statement sets the style of the series named Costs in the graph gr_product_data to overlay:

gr_product_data.SetSeriesStyle("Costs", TRUE)

Example 8

These statements in the Clicked event of the DataWindow control dw_employees store the style of the series under the pointer in the graph gr_depts in the variable style_type. If the style of the series is overlay (true), the script changes the style to normal (false):

string SeriesName

integer SeriesNbr, Data_Point

boolean overlay_style

grObjectType MouseHit


MouseHit = dw_employees.ObjectAtPointer( &

		"gr_depts", SeriesNbr, Data_Point)


IF MouseHit = TypeSeries! THEN

		SeriesName = &

			dw_employees.SeriesName("gr_depts",SeriesNbr)


		dw_employees.GetSeriesStyle("gr_depts", &

			SeriesName, overlay_style)


		IF overlay_style THEN &

			dw_employees.SetSeriesStyle("gr_depts", &

				SeriesName, FALSE)

END IF

See also