SetDataStyle

Specifies the appearance of a data point in a graph. The data point’s series has appearance settings that you can override with SetDataStyle.

To

Use

Set the data point’s colors

Syntax 1 For setting a data point’s colors

Set the line style and width for the data point

Syntax 2 For the line associated with a data point

Set the fill pattern or symbol for the data point

Syntax 3 For the fill pattern and symbol of a data point


Syntax 1 For setting a data point’s colors

Description

Specifies the colors of a data point in a graph.

Applies to

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

Syntax

controlname.SetDataStyle ( { graphcontrol, } seriesnumber, 
	datapointnumber, colortype, color )

Argument

Description

controlname

The name of the graph in which you want to set the color of a data point, or the DataWindow 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 color of a data point.

seriesnumber

The number of the series in which you want to set the color of a data point.

datapointnumber

The number of the data point for which you want to set the color.

colortype

A value of the grColorType enumerated datatype specifying the aspect of the data point 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 whose value is 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, SetDataStyle returns null.

Usage

To change the appearance of a series, use SetSeriesStyle. The settings you make for the series are the defaults for all data points in the series.

To reset the color of individual points back to the series color, call ResetDataColors.

For a graph in a DataWindow, you can specify the appearance of a data point in the graph before PocketBuilder draws the graph. To do so, define a user event for pbm_dwngraphcreate and call SetDataStyle in the script for that event. The event pbm_dwngraphcreate is triggered just before a graph is created in a DataWindow object.

Examples

Example 1

This example checks the background color for data point 6 in the series named Salary in the graph gr_emp_data. If it is red, SetDataStyle sets it to black:

long color_nbr

integer SeriesNbr

// Get the number of the series

SeriesNbr = gr_emp_data.FindSeries("Salary")

// Get the background color

gr_emp_data.GetDataStyle(SeriesNbr, 6, &

		Background!, color_nbr)

// If color is red, change it to black

IF color_nbr = 255 THEN &

		gr_emp_data.SetDataStyle(SeriesNbr, 6, &

			Background!, 0)

Example 2

These statements set the text (foreground) color to black for data point 6 in the series named Salary in the graph gr_depts in the DataWindow control dw_employees:

integer SeriesNbr

// Get the number of the series

SeriesNbr = &

		dw_employees.FindSeries("gr_depts" , "Salary")

// Set the background color

dw_employees.SetDataStyle("gr_depts" , SeriesNbr, &

		6, Background!, 0)

See also


Syntax 2 For the line associated with a data point

Description

Specifies the style and width of a data point’s line in a graph.

Applies to

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

Syntax

controlname.SetDataStyle ( { graphcontrol, } seriesnumber, 
	datapointnumber, linestyle, linewidth )

Argument

Description

controlname

The name of the graph in which you want to set the line style and width of a data point, or the name of the DataWindow 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.

seriesnumber

The number of the series in which you want to set the line style and width of a data point.

datapointnumber

The number of the data point 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 whose value is 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, SetDataStyle returns null.

Usage

To change the appearance of a series, use SetSeriesStyle. The settings you make for the series are the defaults for all data points in the series.

For a graph in a DataWindow, you can specify the appearance of a data point in the graph before PocketBuilder draws the graph. To do so, define a user event for pbm_dwngraphcreate and call SetDataStyle in the script for that event. The event pbm_dwngraphcreate is triggered just before a graph is created in a DataWindow object.

Examples

Example 3

This example checks the line style used for data point 10 in the series named Costs in the graph gr_computers in the DataWindow control dw_equipment. If it is dash-dot, the SetDataStyle sets it to continuous. The line width stays the same:

integer SeriesNbr, line_width

LineStyle line_style


// Get the number of the series

SeriesNbr = dw_equipment.FindSeries( &

		"gr_computers", "Costs")


// Get the current line style

dw_equipment.GetDataStyle("gr_computers", &

		SeriesNbr, 10, line_style, line_width)


// If the pattern is dash-dot, change to continuous

IF line_style = DashDot! THEN &

		dw_equipment.SetDataStyle("gr_computers", &

			SeriesNbr, 10, Continuous!, line_width)

See also


Syntax 3 For the fill pattern and symbol of a data point

Description

Specifies the fill pattern and symbol for a data point in a graph.

Applies to

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

Syntax

controlname.SetDataStyle ( { graphcontrol, } seriesnumber,  
	datapointnumber, enumvalue )

Argument

Description

controlname

The name of the graph in which you want to set the appearance of a data point, or the name of the DataWindow 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.

seriesnumber

The number of the series in which you want to set the appearance of a data point.

datapointnumber

The number of the data point for which you want to set the appearance.

enumvalue

An enumerated datatype specifying the appearance setting for the data point. You can specify a FillPattern or grSymbolType value.

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, SetDataStyle returns null.

Usage

To change the appearance of a series, use SetSeriesStyle. The settings you make for the series are the defaults for all data points in the series.

For a graph in a DataWindow, you can specify the appearance of a data point in the graph before PocketBuilder draws the graph. To do so, define a user event for pbm_dwngraphcreate and call SetDataStyle 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 example checks the fill pattern used for data point 10 in the series named Costs in the graph gr_product_data. If it is diamond, then SetDataStyle changes it to solid:

integer SeriesNbr

FillPattern data_pattern


// Get the number of the series

SeriesNbr = gr_product_data.FindSeries("Costs")


// Get the current fill pattern

gr_product_data.GetDataStyle(SeriesNbr, 10, &

		data_pattern)


// If the pattern is diamond, change it to solid

IF data_pattern = Diamond! THEN &

		gr_product_data.SetDataStyle(SeriesNbr, &

			10, Solid!)

See also