GINO Graphics Suite - GINOGRAF v9.5  

Area Chart Components

There are four components available for the building of a fully annotated, filled Area Chart:

ggBlockFillAreaChart() Drawing block filled area chart
ggAddAreaChartOutline() Drawing area or column outline
ggFillAreaChart() Drawing filled areas
ggAddAreaChartValues() Displaying area values

All four routines may be used independently of each other or on the same chart although it is usual to use a combination of block filling and values, or simple filling, outline and values. It is necessary to define both X and Y axis positions and data ranges before calling any of these routines either by the axis definition routines or the Complete Chart Drawing routine ggPlotAreaChart().

Users should note that if ggFillAreaChart() is called after ggPlotAreaChart() or ggAddAreaChartOutline() the Area Chart outline will be overwritten by the filling. If the outline is required, the solution is to always draw the outline with ggAddAreaChartOutline() after the filling. The block filling routine fills the appropriate areas and follows this with drawing the area chart outline in the current GINO line colour.

Block Filled Area Chart

The routine to display a block filled area chart is:

ggBlockFillAreaChart(nareas,areas,xory,line)

This routine displays a set of data values as filled areas on the last defined set of axes. The width of each area is defined to be between the values supplied in the elements areas.s and areas.f and the height of each area is defined to be between the values supplied in the elements areas.h1 and areas.h2. The argument xory determines whether the areas are oriented with the heights against the vertical (xory=GXAXIS) or horizontal (xory=GYAXIS) axis.

All the blocks are solid filled with the specified line style with the extrusions filled with a darker (or lighter) shade of this line style according to the current block chart attributes (using ggSetBlockChartAttribs()).

The following shows an example of a block filled area chart.

Block Filled Area Chart

Area Chart Outline

The routine to display a set of areas is:

ggAddAreaChartOutline(nareas,areas,xory) 

This routine displays a set of data values as areas on the last defined set of axes. The start and finish values of each area are held in the elements areas.s and areas.f, with the lower and upper values in the corresponding elements of the areas.h1 and areas.h2. The argument xory determines whether the heights are plotted against the vertical (xory=GXAXIS) or horizontal (xory=GYAXIS) axis.

Area Chart Filling

The routine to display a set of filled areas is:

ggFillAreaChart(nareas,areas,xory,fill,line) 

This routine displays a set of data values as filled areas on the last defined set of axes. The width of each area is defined to be between the values supplied in the elements areas.s and areas.f and the height of each area is defined to be between the values supplied in the elements areas.h1 and areas.h2. The argument xory determines whether the areas are oriented with the heights against the vertical (xory=GXAXIS) or horizontal (xory=GYAXIS) axis. When using ggFillAreaChart() in conjunction with ggPlotAreaChart(), xory should be set to GXAXIS. 

The hatch or fill style for each area is held in the array fill. Various hatches and cross hatches as well as solid fill are available. If an element of fill contains a number less than -1 (GHOLLOW), the corresponding area is not filled and the boundary not drawn. The line styles used to fill the areas are held in the array line. The default line styles, hatch styles and fill styles appear in Appendix A of this manual (see Defaults). Further information on line style definition (which includes colour definition) and information on hatch and fill style definition appears in the main introduction.

The area outlines are not drawn with this routine. Users should use ggPlotAreaChart() or ggAddAreaChartOutline() to draw the outline.

Annotating Area Charts

The routine to annotate an Area Chart is:

ggAddAreaChartValues(nareas,areas,sfl,xory)

where ggAddAreaChartValues() will display nareas values associated with the Area Chart drawn by ggPlotAreaChart() or ggAddAreaChartOutline(). The argument sfl provides the choice of displaying seven different values:

sfl = GSTART start value of each area
  GFINISH finish value of each area
  GLOWER lower height value of each area
  GUPPER upper height value of each area
  GWIDTH width of each area
  GHEIGHT height of each area
  GAREA area of each area

By default, the values are positioned at the centre of the associated area in the same numerical format as their associated axis. The numerical format of the data values can be changed through the routine ggSetAxesAnnotation() with xory set appropriately. 

The user can select alternative positions and formatting options by using the annotation control routines (see Histogram Components). The 15 control point positions around the Area Chart areas are located in the same logical position irrespective of the data limits or the axis direction. These routines also provide for string angle and justification control as well as prefix and/or suffix strings added to each value.

Although the area outline is not drawn with this routine it is necessary to set the correct orientation of the areas to ensure the values are correctly positioned. This is determined by the argument xory such that when xory=GXAXIS the height of the area is oriented against the vertical axis and when xory=GYAXIS the height of the area is oriented against the horizontal axis. When using ggAddAreaChartValues() in conjunction with ggPlotAreaChart(), xory should be set to GXAXIS.

Example of Fully Annotated Area Chart

The following example shows the use of all the Area Chart component routines:

Fully annotated Area Chart

[C/C++]
/*  FULLY ANNOTATED AREA CHART */
#include <gino-c.h>
#include <graf-c.h>

int main(void) {
   GAREACHART areas[7]={0.0,20.0,43.0,51.0,
       20.0,30.0,14.0,45.0,30.0,60.0,31.0,76.0,
       60.0,80.0,44.0,84.0,80.0,100.0,65.0,87.0,
       100.0,130.0,71.0,93.0,170.0,200.0,87.0,96.0};

   GCHASTY rep;
   GLIMIT lims;
   int i, flg, fill[7]={9,10,11,12,13,14,15},line[7];
   for (i=0; i<7; i++) line[i]=1;
   gOpenGino();
   xxxxx();
   ggSetGraphCharMode(GGINOMODE);
/* ENQUIRE GINOGRAF DRAWING LIMITS AND CHARACTER SIZE */
   ggEnqPlotFrame(&flg,&lims); 
   gEnqCharAttribs(&rep);
/* SET UP AXES POSITIONS AND SCALES */
   ggSetAxesPos(GAXISSTART,9.0*rep.width,
       5.0*rep.height,lims.xmax-lims.xmin-12.0*rep.width,GXAXIS);
   ggSetAxesScaling(GLINEARTYPE1,11,0.0,200.0,GXAXIS);    ggSetAxesPos(GAXISSTART,9.0*rep.width,
       5.0*rep.height,lims.ymax-lims.ymin-10.0*rep.height,GXAXIS);  
   ggSetAxesScaling(GLINEARTYPE1,10,10.0,100.0,GYAXIS);
/* DRAW AREA CHART */
   ggFillAreaChart(7,areas,GXAXIS,fill,line);
   ggAddAreaChartOutline(7,areas,GXAXIS);
/* LEAVE DEFAULT CENTRAL POSITION OF AREA VALUES */
   ggAddAreaChartValues(7,areas,GAREA,GXAXIS);
/* DRAW GRID */
   ggAddGrid(GCARDINAL,GTICKS,GANNOTATION,GANNOTATION);

   gSuspendDevice(); 
   gCloseGino();
   return(0);
}
[F90]
! FULLY ANNOTATED AREA CHART
use gino_f90
use graf_f90


  type (GAREACHART), dimension(7) :: areas= &
    (/GAREACHART(0.0,20.0,43.0,51.0), &
      GAREACHART(20.0,30.0,14.0,45.0), &
      GAREACHART(30.0,60.0,31.0,76.0), &
      GAREACHART(60.0,80.0,44.0,84.0), &
      GAREACHART(80.0,100.0,65.0,87.0), &
      GAREACHART(100.0,130.0,71.0,93.0), &
      GAREACHART(170.0,200.0,87.0,96.0)/)
  type (GCHASTY) rep
  type (GLIMIT) lims
  integer i, flg
  integer, dimension(7) :: fill=(/9,10,11,12,13,14,15/)
  integer, dimension(7) :: line=(/7*1/)
  call gOpenGino
  call xxxxx
  call ggSetGraphCharMode(GGINOMODE)
! ENQUIRE GINOGRAF DRAWING LIMITS AND CHARACTER SIZE
  call ggEnqPlotFrame(flg,lims)
  call gEnqCharAttribs(rep)
! SET UP AXES POSITIONS AND SCALES 
  call ggSetAxesPos(GAXISSTART,9.0*rep%width, &
       5.0*rep%height,lims%xmax-lims%xmin-12.0*rep%width,GXAXIS)
  call ggSetAxesScaling(GLINEARTYPE1,11,0.0,200.0,GXAXIS)   call ggSetAxesPos(GAXISSTART,9.0*rep%width, &
       5.0*rep%height,lims%ymax-lims%ymin-10.0*rep%height,GXAXIS)
  call ggSetAxesScaling(GLINEARTYPE1,10,10.0,100.0,GYAXIS)
! DRAW AREA CHART
  call ggFillAreaChart(7,areas,GXAXIS,fill,line)
  call ggAddAreaChartOutline(7,areas,GXAXIS)
! LEAVE DEFAULT CENTRAL POSITION OF AREA VALUES
  call ggAddAreaChartValues(7,areas,GAREA,GXAXIS)
! DRAW GRID
  call ggAddGrid(GCARDINAL,GTICKS,GANNOTATION,GANNOTATION)

  call gSuspendDevice
  call gCloseGino
  stop
  end