cgrchart.h
来自「开放源码的编译器open watcom 1.6.0版的源代码」· C头文件 代码 · 共 770 行 · 第 1/2 页
H
770 行
FRAME_X_ONLY,
FRAME_OFF
};
typedef unsigned int frame_op;
enum {
AS_IS = 1,
DEFAULT_NAMES,
STOCK_LEGEND_LAST
};
typedef unsigned int stock_leg_type;
enum {
LEGEND_OFF = 1,
LEGEND_TOP,
LEGEND_BOTTOM,
LEGEND_LEFT,
LEGEND_RIGHT,
LEGEND_INSIDE,
LEGEND_LAST
};
typedef unsigned int legend_op;
enum {
LEG_POSITION = 1,
LEG_FLOATING,
LEG_TOP,
LEG_BOTTOM,
LEG_LEFT,
LEG_RIGHT,
LEG_LAST
};
typedef unsigned int legend_type;
enum {
GROUP_BY_COLUMN = 1, // group by column (bla only)
GROUP_BY_ROW
};
typedef unsigned int group_by_op;
enum {
NOTATION_AS_IS = 1,
NOTATION_SCIENTIFIC,
NOTATION_COMPACT
};
typedef unsigned int notation_op;
enum {
COMPACT_NONE = 1,
COMPACT_THOUSANDS,
COMPACT_MILLIONS
};
typedef unsigned int compact_op;
enum {
COMMAS_OFF = 1,
COMMAS_ON
};
typedef unsigned int commas_op;
enum {
POS_BELOW = 1,
POS_ABOVE,
POS_LEFT,
POS_RIGHT,
POS_LAST
};
typedef unsigned int values_pos;
enum {
SPEC_MANUAL = 1,
SPEC_AUTO,
};
typedef unsigned int spec_op;
enum {
OTHER_OFF = 1,
OTHER_ON
};
typedef unsigned int other_op;
enum {
DATA_SUBSET_ALL = 1,
DATA_SUBSET_RANGE
};
typedef unsigned int subset_op;
/***************************************************/
#define TEXT_NORMAL 0
#define TEXT_BOLD 1
#define TEXT_ITALIC 2
#define TEXT_UNDERLINE 4
#define TEXT_STRIKEOUT 8
#define TEXT_SIZEABLE 16
typedef struct text_def {
ibool not_set; // TRUE if font not set yet
char face_name[LF_FACESIZE];
unsigned int style;
unsigned int size;
cgr_color color;
/**** this font info is not user specified: inferred from selection ****/
unsigned int char_set;
char pitchfamily;
} text_def;
typedef struct draw_text_def {
char text[LEN_TEXT]; // the text
text_def text_info; // text information
wcoord top_left; // %-age coordinates of text
bool framed; // draw frame around outside
} draw_text_def;
typedef struct arrow_def {
wcoord top_left; // %-age coordinates
wcoord bottom_right; // of arrow
line_style line; // line style for arrow
line_width width; // line width for arrow
cgr_color color; // color for drawing arrow
arrowhead_width head_width; // width of the arrowhead
arrowhead_length head_length; // length of the arrowhead
arrowhead_type head_type; // type of the arrowhead
} arrow_def;
typedef union {
arrow_def arrow;
draw_text_def text;
} draw_item_def;
typedef int gda_index; // an index into the graphics data area
typedef struct gda_pos { // a position in the graphics data area
gda_index row; // row (0 origin)
gda_index col; // column (0 origin)
} gda_pos;
typedef struct gda_range { // a range in the graphics data area
gda_index range_start; // start
gda_index range_end; // end
} gda_range;
typedef struct common_attr { // common attributes between chart types
ibool display; // display row (pie) or column (other)
ibool val_display; // show value label(s) for column/row
cgr_color color; // color for drawing attributes
fill_style fill; // for bars, areas, pie slices
int order; // order of column/row for display
} common_attr;
typedef struct format_desc {
char prefix[LEN_FORMAT];
char suffix[LEN_FORMAT];
notation_op notation;
commas_op commas;
int precision;
} format_desc;
typedef struct values_desc {
values_op display;
text_def text_info;
format_desc format;
} values_desc;
typedef struct labels_desc {
labels_op display;
text_def text_info;
format_desc format;
} labels_desc;
typedef struct legend_desc {
legend_op display; // type of fixed legend
legend_type type; // type of legend
float x_offset; // %-age coordinates
float y_offset; // of legend
ibool framed; // if true, legend has a frame
ibool horizontal; // last legend state: for float only
text_def text_info; // text information for legend
} legend_desc;
typedef struct scale_op { // scale options for line-bar/area chart
labels_desc show_scale; // details of showing the scale
scale_type calc_scale; // auto or manual scale
float start_scale; // start of scale value
float end_scale; // end of scale value
float scale_step; // step per scale increment
float scale_100_step; // step for 100% charts
} scale_op;
typedef struct scale_op_ltd { // limited scale options
scale_type calc_scale; // auto or manual scale
float start_scale; // start of scale value
float end_scale; // end of scale value
float scale_step; // step per scale increment
float scale_100_step; // step for 100% charts
} scale_op_ltd;
typedef struct pie_labels_desc { // description of pie labels
pie_labels_op display;
text_def text_info;
} pie_labels_desc;
typedef struct text_desc { // a title, row or column label
char text[LEN_TEXT]; // the text
text_def text_info;
text_align align; // alignment of text about top or axis
} text_desc;
typedef struct light_3d { // 3d lighting parameters
light_type type;
light_vert_pos vert;
light_horz_pos horz;
light_depth_pos depth;
int brightness;
int contrast;
} light_3d;
typedef struct view_3d {
int h_angle; // spherical coord of viewing point
int v_angle;
int perspective; // amount of perspective to use
int zoom; // amount of zoom
proj_type type; // projection type
} view_3d;
typedef struct three_d_op {
view_3d view;
light_3d lighting;
ibool black_edges;
surface_res resolution;
} three_d_op;
typedef struct pie_attr { // attributes for each pie slice (row)
common_attr c_attr; // common attributes
int slice_cut; // slice cut
} pie_attr;
typedef struct pie_chart { // pie chart options
pie_attr far *attr; // array of attributes for each row
HANDLE attr_hld; // hld of above memory
int num_attr; // # of alloced attrs
gda_index column; // column to make pie chart
values_desc values; // how values are to be displayed
values_pos val_pos; // position of values
pie_labels_desc labels; // whether labels are to be displayed
float pie_size; // size of the pie
int angle; // angle of the pie
other_op other_slice; // is the other slice on or off?
pie_attr other_attr; // attributes for 'other' slice
float other_value; // 'other' slice value
char other_label[LEN_TEXT]; // 'other' slice label
} pie_chart;
typedef struct bla_attr { // bar-line or area column attributes
common_attr c_attr; // common attributes for column
int precision; // precision of data for column
col_type type; // type of drawing for column
line_style line; // line style for column
line_width width; // line width for column
marker_style marker; // marker style for column
scale_xy y2_scale; // use y1 or y2?
gda_index x_group; // for xy chart only
gda_index y_group; // for xy chart only
x_y_type xy_type; // for xy chart only
gda_index start_group; // for gantt chart only
gda_index length_group; // for gantt chart only
gda_index bx_group; // for bubble chart only
gda_index by_group; // for bubble chart only
gda_index bval_group; // for bubble chart only
} bla_attr;
typedef struct draw_attr {
bool deleted; // NOT A USER OPTION!!!!
draw_item_type type; // type of draw item (arrow, text)
draw_item_def d_item; // the draw item
} draw_attr;
typedef struct bla_chart { // bar-line or area chart options
bla_attr far *attr; // array of attributes for each column
HANDLE attr_hld; // hld of above memory
int num_attr; // # of alloced attrs
arrange arrange; // arrangement of bars/areas
chart_dir_type vertical_chart; // vertical or horizontal chart
values_desc data_labels; // how data labels are displayed
scale_op scale; // scaling options
scale_op xscale; // for XY and radar charts only
scale_op_ltd y2_scale; // for second y scale
labels_desc z_labels; // z axis labels for 3d charts
bool y_scale_shown; // is y scale used?
bool y2_scale_shown; // is y2 scale used?
frame_op frame; // TRUE: frame chart
gda_range row_range; // row range to chart
text_desc row_label; // row label
text_desc col_label; // column label
text_desc col2_label; // y2 label
text_desc zcol_label; // z axis label for 3d charts
grid_type row_grid; // grid lines up from row axis
grid_type z_grid; // grid lines for z axis in 3d charts
grid_type col_grid; // grid lines across from column axis
grid_type col2_grid; // grid lines across from y2 axis
tick_type row_tick; // row axis tick marks
tick_type z_tick; // z axis ticks for 3d charts
tick_type col_tick; // column axis tick marks
tick_type col2_tick; // y2 axis tick marks
prec_op data_prec; // data label precision
scale_prec_op yscale_prec; // y scale precision
scale_prec_op xscale_prec; // x scale precision
spec_op user_overlap; // user specification
float bar_overlap; // overlap % of the bars
spec_op user_width; // user specification
float bar_width; // width % of the clusters
cgr_color frame_color; // frame/grid/tick colour
subset_op data_subset; // row/column range type
grid_type zero_line; // style for zero axes
grid_type radar_xaxis; // style for x_axis
grid_type radar_yaxis; // style for y_axis
orientation radar_orient; // orientation of radar
float radar_size; // size of the radar circle
stock_leg_type stock_legend; // column names or hi/lo/open/close
stck_type stock_type; // type of stock chart
spec_op stock_u_width; // user specification for stock charts
float stock_b_width; // width % of the clusters " "
ibool overlay_grid; // if TRUE, overlay the grid ( radar )
} bla_chart;
typedef unsigned chart_hld;
typedef struct cgr_chart { // this defines a chart
chart_type type; // the type of chart
three_d_display three_d; // is the chart a 3d chart
text_desc title; // title of the chart
gda_index max_row; // row data access: 0 to max_row
gda_index max_col; // column data access: 0 to max_col
draw_type draw; // use color, patterns, or both
legend_desc legend; // TRUE: put legend on chart
group_by_op group_by; // grouped by bar/column
pie_chart pie; // options for a pie chart
bla_chart bar_area; // options for a bar-line or area chart
three_d_op view; // viewing parameters for 3d charts
LPSTR (APIENTRY *row_names)
(chart_hld chart, unsigned row);// row name fetch routine
LPSTR (APIENTRY *col_names)
(chart_hld chart, unsigned col);// column name fetch routine
BOOL (APIENTRY *get_data)
(chart_hld chart, unsigned row,
unsigned col, float far *value); // fetch data routine
void (APIENTRY *use_data)
( chart_hld chart, BOOL ); // toggle data useage by CGR
LPSTR (APIENTRY *macro_value) // chart macros
( chart_hld chart, LPSTR macro_name );
WPI_COLOUR far *palette; // colour palette of the chart
HANDLE palette_hld; // gbl handle of palette
int palette_size; // size of the palette
draw_attr far *draw_attr; // array of attr's for each draw item
HANDLE draw_attr_hld; // hld of above memory
int num_draw_attr; // number of draw items
text_desc subtitle; // subtitle of the chart
text_desc footnote; // footnote of the chart
} cgr_chart;
/* this structure is used to add or change a chart. The application
passes it into CGR */
typedef struct {
unsigned max_row;
unsigned max_col;
LPSTR (APIENTRY *row_names)
(chart_hld chart, unsigned row);// row name fetch routine
LPSTR (APIENTRY *col_names)
(chart_hld chart, unsigned col);// column name fetch routine
BOOL (APIENTRY *get_data)
(chart_hld chart, unsigned row,
unsigned col, float far *value); // fetch data routine
void (APIENTRY *use_data)
( chart_hld chart, BOOL ); // toggle data useage by CGR
LPSTR (APIENTRY *macro_value) // chart macros
( chart_hld chart, LPSTR macro_name );
} cgr_add_chart;
/* some constants of interest */
#define CGR_MAX_PRECISION 6 // maximum value precision
#define CGR_MAX_SLICE_CUT 9 // max slice cut
#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?