Syntax 1 For setting a series’ colors
Description
Specifies the colors of a series in a graph.
Controls
Graph controls in windows and user objects, and graphs in
DataWindow controls
Syntax
|
1 |
<span>controlname</span>.<span>SetSeriesStyle</span> ( { <span>graphcontrol</span>, } <span>seriesname</span>, <span>colortype</span>, <span>color</span> ) |
|
Argument |
Description |
|---|---|
|
controlname |
The name of the graph in which you want |
|
graphcontrol (DataWindow control |
A string whose value is the name of the |
|
seriesname |
A string whose value is the name of the |
|
colortype |
A value of the grColorType enumerated
|
|
color |
A long specifying the new color for colortype. |
Return Values
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.
Using SetSeriesStyle with DirectX 3D Graphs
You can only set the color for the foreground. Background,
line color, and shade are not supported.
Examples
This statement sets the text (foreground) color of
the series named Salary in the graph gr_emp_data to
black:
|
1 |
gr_emp_data.<span>SetSeriesStyle</span>("Salary", & |
|
1 |
Foreground!, 0) |
This statement sets the background color of the series
named Salary in the graph gr_depts in
the DataWindow control dw_employees to
black:
|
1 |
dw_employees.<span>SetSeriesStyle</span>("gr_depts", & |
|
1 |
"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 to
that color:
|
1 |
string SeriesName |
|
1 |
integer SeriesNbr, Series_Point |
|
1 |
long line_color |
|
1 |
grObjectType MouseHit |
|
1 |
|
1 |
MouseHit = ObjectAtPointer(SeriesNbr,Series_Point) |
|
1 |
|
1 |
IF MouseHit = TypeSeries! THEN |
|
1 |
SeriesName = & |
|
1 |
gr_product_data.SeriesName(SeriesNbr) |
|
1 |
|
1 |
gr_product_data.GetSeriesStyle(SeriesName, & |
|
1 |
LineColor!, line_color) |
|
1 |
|
1 |
gr_sales_data.<span>SetSeriesStyle</span>("Northeast", & |
|
1 |
LineColor!, line_color) |
|
1 |
END IF |