PtBarGraph

A bar graph

Class hierarchy:

PtWidgetPtBasicPtBarGraph

For more information, see the diagram of the widget hierarchy.

PhAB icon:

PtBarGraph button in PhAB

Public header:

<photon/PtBarGraph.h>

Description:

PtBarGraph draws a horizontal or vertical bar graph, with or without a grid.


PtBarGraph


A PtBarGraph widget.

You specify the bars by setting Pt_ARG_BARGRAPH_DATA to an array of values. The colors of the bars depends on how you set the widget's resources:

The Pt_ARG_BARGRAPH_FLAGS resource controls the direction of the graph and whether or not the grid is displayed.

If you set Pt_ARG_BARGRAPH_DEPTH to a positive value, the bars are drawn with a bevel.

New resources:

Resource C type Pt type Default
Pt_ARG_BARGRAPH_BASE short Scalar 0
Pt_ARG_BARGRAPH_COLOR PgColor_t, short Array NULL
Pt_ARG_BARGRAPH_DATA short, short Array NULL
Pt_ARG_BARGRAPH_DEPTH short Scalar 0
Pt_ARG_BARGRAPH_FLAGS long Flag Pt_BARGRAPH_VERTICAL
Pt_ARG_BARGRAPH_GRID_COLOR PgColor_t Scalar Pg_DGREY
Pt_ARG_BARGRAPH_GRID_HORIZ short Scalar 6
Pt_ARG_BARGRAPH_GRID_VERT short Scalar 6
Pt_ARG_BARGRAPH_MAX short Scalar SHRT_MAX
Pt_ARG_BARGRAPH_MIN short Scalar SHRT_MIN

Pt_ARG_BARGRAPH_BASE

C type Pt type Default
short Scalar 0

The value that's used as the base line for the bars. If the data for a bar is greater than this value, the bar is displayed above the base line (for a vertical bar graph) or to the right (for a horizontal graph).

Pt_ARG_BARGRAPH_COLOR

C type Pt type Default
PgColor_t, short Array NULL

An array of colors to use for the bars. If this resource is NULL, the widget uses the value of Pt_ARG_COLOR (inherited from PtBasic) as the color for all the bars.

You should have at least as many bar colors as entries in the Pt_ARG_BARGRAPH_DATA array.


Note: You can't edit this resource in PhAB.

Here's an example of setting this resource:

PgColor_t   bar_colours[7] = {Pg_RED, Pg_BLUE, Pg_CELIDON,
                              Pg_GREEN, Pg_YELLOW, Pg_MAGENTA,
                              Pg_DGREEN };

PtSetResource (widget, Pt_ARG_BARGRAPH_COLOR, bar_colours, 7);

Pt_ARG_BARGRAPH_DATA

C type Pt type Default
short, short Array NULL

The data to be displayed in the bar graph. When you set this resource, the value is the array of data, and arg is the number of bars.


Note: You can't edit this resource in PhAB.

Here's an example of setting this resource:

short bar_values[7] = {0, 450, 399, 22, 500, 50, 555 };

PtSetResource (widget, Pt_ARG_BARGRAPH_DATA, bar_values, 7);

Pt_ARG_BARGRAPH_DEPTH

C type Pt type Default
short Scalar 0

The depth of the bars in the graph, in pixels.

Pt_ARG_BARGRAPH_FLAGS

C type Pt type Default
long Flag Pt_BARGRAPH_VERTICAL

Flags that affect the appearance and behavior of the bar graph; a combination of:

Pt_BARGRAPH_GRID
Display a grid.
Pt_BARGRAPH_VERTICAL
Make the bars vertical.
Pt_BARGRAPH_HORIZONTAL
Make the bars horizontal.

Pt_ARG_BARGRAPH_GRID_COLOR

C type Pt type Default
PgColor_t Scalar Pg_DGREY

The color of the grid, if displayed.


Note: You can't edit this resource in PhAB.

Pt_ARG_BARGRAPH_GRID_HORIZ

C type Pt type Default
short Scalar 6

The number of horizontal lines in the grid.

Pt_ARG_BARGRAPH_GRID_VERT

C type Pt type Default
short Scalar 6

The number of vertical lines in the grid.

Pt_ARG_BARGRAPH_MAX

C type Pt type Default
short Scalar SHRT_MAX

The maximum value in the bar graph.

Pt_ARG_BARGRAPH_MIN

C type Pt type Default
short Scalar SHRT_MIN

The minimum value in the bar graph.

Inherited resources:

If the widget modifies an inherited resource, the “Default override” column indicates the new value. This modification affects any subclasses of the widget.

Resource Inherited from Default override
Pt_ARG_ANCHOR_FLAGS PtWidget
Pt_ARG_ANCHOR_OFFSETS PtWidget
Pt_ARG_AREA PtWidget
Pt_ARG_BASIC_FLAGS PtBasic
Pt_ARG_BEVEL_WIDTH PtWidget
Pt_ARG_BITMAP_CURSOR PtWidget
Pt_ARG_BEVEL_COLOR PtBasic
Pt_ARG_BEVEL_CONTRAST PtBasic
Pt_ARG_COLOR PtBasic Pg_RED
Pt_ARG_CONTRAST PtBasic
Pt_ARG_CURSOR_COLOR PtWidget
Pt_ARG_CURSOR_TYPE PtWidget
Pt_ARG_DARK_BEVEL_COLOR PtBasic
Pt_ARG_DARK_FILL_COLOR PtBasic
Pt_ARG_DATA PtWidget
Pt_ARG_DIM PtWidget
Pt_ARG_EFLAGS PtWidget
Pt_ARG_EXTENT PtWidget
Pt_ARG_FILL_COLOR PtBasic Pg_BLACK
Pt_ARG_FILL_PATTERN PtBasic
Pt_ARG_FLAGS PtWidget
Pt_ARG_HEIGHT PtWidget
Pt_ARG_HELP_TOPIC PtWidget
Pt_ARG_HIGHLIGHT_ROUNDNESS PtBasic
Pt_ARG_INLINE_COLOR PtBasic
Pt_ARG_LIGHT_BEVEL_COLOR PtBasic
Pt_ARG_LIGHT_FILL_COLOR PtBasic
Pt_ARG_MARGIN_HEIGHT PtBasic
Pt_ARG_MARGIN_WIDTH PtBasic
Pt_ARG_MAXIMUM_DIM PtWidget
Pt_ARG_MINIMUM_DIM PtWidget
Pt_ARG_OUTLINE_COLOR PtBasic
Pt_ARG_POINTER PtWidget
Pt_ARG_POS PtWidget
Pt_ARG_RESIZE_FLAGS PtWidget
Pt_ARG_STYLE PtBasic
Pt_ARG_TRANS_PATTERN PtBasic
Pt_ARG_USER_DATA PtWidget
Pt_ARG_WIDTH PtWidget
Pt_CB_ACTIVATE PtBasic
Pt_CB_ARM PtBasic
Pt_CB_BLOCKED PtWidget
Pt_CB_DESTROYED PtWidget
Pt_CB_DISARM PtBasic
Pt_CB_DND PtWidget
Pt_CB_FILTER PtWidget
Pt_CB_GOT_FOCUS PtBasic
Pt_CB_HOTKEY PtWidget
Pt_CB_IS_DESTROYED PtWidget
Pt_CB_LOST_FOCUS PtBasic
Pt_CB_MENU PtBasic
Pt_CB_OUTBOUND PtWidget
Pt_CB_RAW PtWidget
Pt_CB_REALIZED PtWidget
Pt_CB_REPEAT PtBasic
Pt_CB_UNREALIZED PtWidget