Specifies the appearance of a data point in a graph. The data point's series has appearance settings that you can override with SetDataStyle.
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:
|
color |
A long whose value is the new color for colortype. |
Return value
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 PowerBuilder 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.
Using SetDataStyle with DirectX 3D Graphs
You can only set the color for the foreground. Background, line color, and shade are not supported.
Examples
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)
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
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. |
Return value
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 PowerBuilder 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
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
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! |
Return value
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 PowerBuilder 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.
Using SetDataStyle with DirectX 3D Graphs
You cannot use a fill pattern or specify specific symbols for the data point.
Examples
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