GetSeriesStyle

Finds out the appearance of a series in a graph. The appearance settings for individual data points can override the series settings, so the values obtained from GetSeriesStyle may not reflect the current state of the graph. There are several syntaxes, depending on what settings you want.

To

Use

Get the series' colors

Syntax 1

Get the line style and width used by the series

Syntax 2

Get the fill pattern or symbol for the series

Syntax 3

Find out if the series is an overlay (a series shown as a line on top of another graph type)

Syntax 4


GetSeriesStyle provides information about a series. The data points in the series can have their own style settings. Use SetSeriesStyle to change the style values for a series. Use GetDataStyle to get style information for a data point and SetDataStyle to override series settings and set style information for individual data points.

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

Syntax 1: For the colors of a series

Description

Obtains the colors associated with a series in a graph.

Applies to

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

Syntax

controlname.GetSeriesStyle ( { graphcontrol, } seriesname, colortype, colorvariable )

Argument

Description

controlname

The name of the graph in which you want to obtain 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 the color of a series.

seriesname

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

colortype

A value of the grColorType enumerated datatype specifying the aspect of the series for which you want the color:

  • Foreground! -- Text color

  • Background! -- Background color

  • LineColor! -- Line color

  • Shade! -- Shade (for graphs that are 3-dimensional or have solid data markers)

colorvariable

A long variable in which you want to store the color's RGB value.


Return value

Integer.

Returns 1 if it succeeds and -1 if an error occurs. Stores in colorvariable the RGB value of the specified series and item. If any argument's value is null, GetSeriesStyle returns null.

Examples

These statements store in the variable color_nbr the text (foreground) color used for a series in the graph gr_emp_data. The series name is the text in the SingleLineEdit sle_series:

long color_nbr
gr_emp_data.GetSeriesStyle(sle_series.Text, &
   Foreground!, color_nbr)

These statements store in the variable color_nbr the background color used for the series PCs in the graph gr_computers in the DataWindow control dw_equipment:

long color_nbr
// Get the color.
dw_equipment.GetSeriesStyle("gr_computers", &
   "PCs", Background!, color_nbr)

These statements store the color for the series under the mouse pointer in the graph gr_product_data in line_color:

string SeriesName
integer SeriesNbr, Data_Point
long line_color
grObjectType MouseHit
 
MouseHit = ObjectAtPointer(SeriesNbr, Data_Point)
 
IF MouseHit = TypeSeries! THEN
   SeriesName = &
      gr_product_data.SeriesName(SeriesNbr)
 
   gr_product_data.GetSeriesStyle(SeriesName, &
      LineColor!, line_color)
END IF

See also

AddSeries

GetDataStyle

FindSeries

SetDataStyle

SetSeriesStyle

Syntax 2: For the line style and width used by a series

Description

Obtains the line style and width for a series in a graph.

Applies to

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

Syntax

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

Argument

Description

controlname

The name of the graph for which you want the line style and width for a series in a graph, 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 the line style information.

seriesname

A string whose value is the name of the series for which you want the line style information.

linestyle

A variable of type LineStyle in which you want to store the line style of seriesname.

linewidth

An integer variable in which you want to store the line width for seriesname. The width is measured in pixels.


Return value

Integer.

Returns 1 if it succeeds and -1 if an error occurs. Stores in linestyle a value of the LineStyle enumerated datatype and in linewidth the width of the line used for the specified series. If any argument's value is null, GetSeriesStyle returns null.

Examples

These statements store in the variables line_style and line_width the line style and width for the series under the mouse pointer in the graph gr_product_data:

string SeriesName
integer SeriesNbr, Data_Point, line_width
LineStyle line_style
grObjectType MouseHit
 
MouseHit = ObjectAtPointer(SeriesNbr, Data_Point)
 
IF MouseHit = TypeSeries! THEN
   SeriesName = &
      gr_product_data.SeriesName(SeriesNbr)
 
   gr_product_data.GetSeriesStyle(SeriesName, &
      line_style, line_width)
END IF

See also

AddSeries

GetDataStyle

FindSeries

SetDataStyle

SetSeriesStyle

Syntax 3: For the fill pattern or symbol of a series

Description

Obtains the fill pattern or symbol of a series in a graph.

Applies to

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

Syntax

controlname.GetSeriesStyle ( { graphcontrol, } seriesname, enumvariable )

Argument

Description

controlname

The name of the graph for which you want the style information for a series in a graph, 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 the style information.

seriesname

A string whose value is the name of the series for which you want the style information.

enumvariable

The variable in which you want to store the style information. You can specify a FillPattern or grSymbolType variable. The style information that GetSeriesStyle stores depends on the variable type.


Return value

Integer.

Returns 1 if it succeeds and -1 if an error occurs. Stores in enumvariable a value of the appropriate enumerated datatype for the fill pattern or symbol used for the specified series. If any argument's value is null, GetSeriesStyle returns null.

Usage

See SetSeriesStyle for a list of the enumerated datatype values that GetSeriesStyle stores in enumvariable.

Examples

These statements store in the variable data_pattern the fill pattern for the series under the mouse pointer in the graph gr_product_data:

string SeriesName
integer SeriesNbr, Data_Point
FillPattern data_pattern
grObjectType MouseHit
 
MouseHit = ObjectAtPointer(SeriesNbr, Data_Point)
 
IF MouseHit = TypeSeries! THEN
   SeriesName = &
      gr_product_data.SeriesName(SeriesNbr)
 
   gr_product_data.GetSeriesStyle(SeriesName, &
      data_pattern)
END IF

This example stores in the variable data_pattern the fill pattern for the series under the pointer in the graph gr_depts in the DataWindow control dw_employees. It then sets the fill pattern for the series Total Salary in the graph gr_dept_data to that pattern:

string SeriesName
integer SeriesNbr, Data_Point
FillPattern data_pattern
grObjectType MouseHit
 
MouseHit = &
   ObjectAtPointer("gr_depts" , SeriesNbr, &
      Data_Point)
 
IF MouseHit = TypeSeries! THEN
   SeriesName = &
       dw_employees.SeriesName("gr_depts" , SeriesNbr)
 
   dw_employees.GetSeriesStyle("gr_depts" , &
      SeriesName, data_pattern)
 
   gr_dept_data.SetSeriesStyle("Total Salary", &
      data_pattern)
END IF

In these examples, you can change the datatype of data_pattern (the variable specified as the last argument) to find out the symbol type.

See also

AddSeries

GetDataStyle

FindSeries

SetDataStyle

SetSeriesStyle

Syntax 4: For determining whether a series is an overlay

Description

Reports whether a series in a graph is an overlay -- whether it is shown as a line on top of another graph type.

Applies to

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

Syntax

controlname.GetSeriesStyle ( { graphcontrol, } seriesname,overlayindicator )

Argument

Description

controlname

The name of the graph for which you want the overlay status of a series in a graph, 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 the overlay status.

seriesname

A string whose value is the name of the series for which you want the overlay status.

overlayindicator

A boolean variable in which you want to store a value indicating whether the series is an overlay. GetSeriesStyle sets overlayindicator to true if the series is an overlay and false if it is not.


Return value

Integer.

Returns 1 if it succeeds and -1 if an error occurs. Stores in overlayindicator true if the specified series is an overlay and false if it is not. If any argument's value is null, GetSeriesStyle returns null.

Examples

These statements find out whether a series in the graph gr_emp_data is an overlay. The series name is the text in the SingleLineEdit sle_series:

boolean is_overlay
gr_emp_data.GetSeriesStyle(sle_series.Text, &
   is_overlay)