GRX module routines

Company Information Software Products TDF Market Reports Download Area take me Home

GRX.C

This module contains the EGA mode charting subsystem. These are the level 2 & 3 functions.

TDF_Lib buyers - if one wished to port this package to a different graphics platform like BGI all you would have to do is rewrite &| front-end &| simulate the level 1 functions and variables in SM_GRX.C & SM_GRX2.ASM, the level 2 functions in this module will require a look (and maybe some work) and then the level 3 functions will run clean.

Function draw_cmd_chart
Include file GRX.H
Prototype GRFX *draw_cmd_chart( int cht_size , int cht_flags , int data_cnt , void *data , char *label )
Remarks Draw an initial bar or line chart. Call this routine first to get a new GRFX structure complete with scr sizes & scale factors.

Function overlay_line_plot
Include file GRX.H
Prototype void overlay_line_plot( GRFX *old_chart_ptr , float *data , int line_color )
Remarks Overlay a indicator on an existing bar or line chart. Since this doesn't recalc the scale factors you must make the first call to draw_cmd_chart with the largest range indicator.

Function new_grfx_struct
Include file GRX.H
Prototype GRFX *new_grfx_struct( int cht_size )
Remarks Allocate and initialize a new GRFX structure to the cht_size.

Function calc_scr_size_constants
Include file GRX.H
Prototype void calc_scr_size_constants( void )
Remarks Calculate the chart sizes based on current EGA resolution.

Function store_1_scr_sizes
Include file GRX.H
Prototype void store_1_scr_sizes( int idx , int xmin , int ymin , int xmax , int ymax )
Remarks Worker store routine for calc_scr_size_constants().

Function draw_empty_chart
Include file GRX.H
Prototype void draw_empty_chart( void )
Remarks Draw a virgin chart.

Function calc_dt_n_axis_scale_factors
Include file GRX.H
Prototype int calc_dt_n_axis_scale_factors( void )
Remarks Calculate the data range, plot scale factors and axis move increments. Return TRUE if ok to plot else FALSE if not.

Function build_axis_incs
Include file GRX.H
Prototype void build_axis_incs( void )
Remarks Calculate the axis plot increments based on number of data points and number of scaling rows.

Function calc_dt_range
Include file GRX.H
Prototype void calc_dt_range( void )
Remarks Calculate the data range then calc the scaling increment and plot scaling factor.

Function set_high_lows
Include file GRX.H
Prototype void set_high_lows( float *high_ptr , float *low_ptr , int loop_cnt )
Remarks Find the highest_high and the lowest_low in the data series and store them back into the caller's memory.

Function calc_range
Include file GRX.H
Prototype void calc_range( int interval_index , int loop_cnt )
Remarks Find the best fit scale interval for the data series. This routine will call itself recursively with loop_cnt in control of when to bail out.

Function set_plot_range
Include file GRX.H
Prototype void set_plot_range( float min_range , float max_range )
Remarks Use this routine to force a chart to be plotted and scaled to your specified min and max range values. This routine must be called before the call to draw_cmd_chart() and the provided values are only good for one call to draw_cmd_chart().

Function reset_temp_grfx_vars
Include file GRX.H
Prototype void reset_temp_grfx_vars( void )
Remarks Reset the per-chart call booleans.

Function round_as_int
Include file GRX.H
Prototype float round_as_int( float float_data , float interval , int fudge_factor )
Remarks Convert a float to an integer, round it, then convert it back to a float and return it.

Function align_1st_bar
Include file GRX.H
Prototype void align_1st_bar( void )
Remarks Position to the 1st bar plot loc along the x axis.

Function adv_x_axis_plot_point
Include file GRX.H
Prototype void adv_x_axis_plot_point( void )
Remarks Advance the x-axis plotting loc.

Function plot_high_low_bar
Include file GRX.H
Prototype void plot_high_low_bar( DATA_REC *bar_ptr )
Remarks Plot a high/low/close bar for the given DATA_REC.

Function get_y_plot
Include file GRX.H
Prototype int get_y_plot( float y_float )
Remarks Return the calculated y plot location for the given data value.

Function label_cmd_chart
Include file GRX.H
Prototype void label_cmd_chart( char *label )
Remarks Write a label across the top of the chart.

Function label_y_axis
Include file GRX.H
Prototype void label_y_axis( void )
Remarks Write the row prices out along the y axis.

Function plot_DATA_REC_data
Include file GRX.H
Prototype void plot_DATA_REC_data( void )
Remarks Plot all the DATA_REC data bars as high/low/close bars.

Function plot_float_data
Include file GRX.H
Prototype void plot_float_data( void )
Remarks Plot all the data as a indicator line. If the data in the float array == IND_VAL_INVALID it will be assumed as indicator not up to speed and not be output. If grfx_ptr->cht_flags has the GRFX_FG_IND_HISTOGRAM bit hit guess what you'll get.

Function get_month_str
Include file GRX.H
Prototype char *get_month_str( int mth_index )
Remarks A qnd to translate the month number into the text str.

Function label_x_axis_as_date
Include file GRX.H
Prototype void label_x_axis_as_date( void )
Remarks Write date labels along the x axis.

Function label_x_axis_as_date_style2
Include file GRX.H
Prototype void label_x_axis_as_date_style2( void )
Remarks Write date labels along the x axis from a intraday data series. This routine will be called by label_x_axis_as_date() if the data series beginning date is <01/01/01 (in YYMMDD style). This routine then expects the date field to contain ( ( day_num * 60 ) + bar_num ).

Function label_ind_x_axis_with_date
Include file GRX.H
Prototype void label_ind_x_axis_with_date( DATA_REC *data_ptr )
Remarks When we draw a indicator chart the float data-array doesn't have a date field, so if we cheat and after the first indicator chart is drawn we call here with the raw DATA_REC data series we can use the module GLOBAL GRFX *ptr and label the axis.

Function plot_volume_bars
Include file GRX.H
Prototype void plot_volume_bars( void )
Remarks Add the volume bars to a GRX_FG_DATA_REC bar chart.

Function plot_open_int_line
Include file GRX.H
Prototype void plot_open_int_line( void )
Remarks Overlay a open interest line over the volume bars on a GRX_FG_DATA_REC bar chart. If grfx_add_vol_bars == FALSE or DATA_REC->open_int == 0.0 then no open_int plot.

Function set_equivolume_scale_factors
Include file GRX.H
Prototype void set_equivolume_scale_factors( void )
Remarks Calc the x axis volume step for a equivolume style chart.

Function draw_y_line
Include file GRX.H
Prototype void draw_y_line( float y_value , int line_color )
Remarks Draw a line of line_color across the chart at y_value location.

Function Graphics_on
Include file GRX.H
Prototype int Graphics_on( void )
Remarks Initialize the GRX subsystem.

Function Graphics_off
Include file GRX.H
Prototype int Graphics_off( void )
Remarks Turn off EGA graphics mode and set to BIOS int 10h - mode 3 (text mode color 80 column).

Function GRX_grid
Include file GRX.H
Prototype void GRX_grid( int x_start , int y_start , int x_stop , int y_stop , int num_of_cols , int num_of_rows , int box_the_grid )
Remarks Multi-function grid and box draw routine. This routine is front-ended by the following macros in GRX.H for various sub-functions, grid ( draws a grid, boxed grid ( draw a grid and boxes it ), hortz_dsh_lns ( draws a series of horizontal dashed lines bounded by the x/y coordinates ) and vert_dsh_lns ( same as the last except vertical ). The x/y coordinates are for the upper left corner ( x_start , y_start ) and the lower right corner ( x_stop , y_stop ) of the desired area.

Function GRX_box
Include file GRX.H
Prototype void GRX_box( int x_start , int y_start , int x_stop , int y_stop )
Remarks A simple draw a box around from upper left corner ( x_start , y_start ) to the lower right corner ( x_stop , y_stop ) of the desired area.

Function set_x_inc
Include file GRX.H
Prototype void set_x_inc( int x_start , int x_stop , int num_of_cols )
Remarks Calculate the x axis increment per data point.

Function set_y_inc
Include file GRX.H
Prototype void set_y_inc( int y_start , int y_stop , int num_of_rows )
Remarks Calculate the y axis increment per scale row.

Function tick_x_axis
Include file GRX.H
Prototype void tick_x_axis( int x_start , int y_loc , int tick_dir , int nolast_tick , int tick_length , int tick_interval )
Remarks Draw a series of x axis tick marks.

Function tick_y_axis
Include file GRX.H
Prototype void tick_y_axis( int y_start , int x_loc , int tick_dir , int nolast_tick , int tick_length , int tick_interval )
Remarks Draw a series of y axis tick marks.

Table of Contents Function Index

SM_GRX.C -

This is the C code hacked into a mini graphics library from the Aztec library. This is just level 1 stuff. All that is supported is Set mode (just EGA) , set color , draw line and plot point functions. GRX.C will support level 2 and level 3 functions.

Function mode
Include file SM_GRX.H
Prototype void mode( int val )
Remarks Set graphics mode.

Function color
Include file SM_GRX.H
Prototype void color( int c )
Remarks Set the active color.

Function color_n_return_cur
Include file SM_GRX.H
Prototype int color_n_return_cur( int c )
Remarks Set the active color and return the old color.

Function set_line_2_dashed
Include file SM_GRX.H
Prototype void set_line_2_dashed( int dash_pattern )
Remarks Set the indicator line to a dash pattern.

Function set_line_2_solid
Include file SM_GRX.H
Prototype void set_line_2_solid( void )
Remarks Set indicator line to solid.

Table of Contents Function Index

generated on 08 February 1998 - 14:43:24
© 1998 Tierra del Fuego Ltd.