STATISTICA







STATISTICA BASIC Program MetaHist.stb

[Graph] { This program will produce a histogram "built from" user-defined clipart, and based on a frequency table, as produced via the STATISTICA Basic Statistics module or the Quick Basic Stats options. The bars in the histogram will be made up from a specified metafile, and it is assumed that the Scrollsheet with frequencies is the top-most Scrollsheet.

Program written, modified, or edited at StatSoft, Inc.}


NoDataFileVariableNames;
scr := GetScrollsheet(0);                       {get handle for top-most Scrollsheet}
nbgroups := ScrollsheetGetNbRows (scr) - 2;     {get number of categories}
Redim Freq(nbgroups), x(nbgroups);              {declare arrays}
ScrollsheetGetMatrix (scr, 1, 1, Freq);         {retrieve frequencies from the scrollsheet}
for i:=1 to nbgroups do x(i):=i;                {prepare x axes values}
ValMax (Freq, 1, nbgroups, maxFreq);            {get the largest frequency}

metafile$:='*.wmf';                             {select metafile}
SelectOpenFileName ('Select metafile', metafile$, '.wmf');

                                                {create graph}
graph:=NewGraph (SCATTERPLOT, 'Histogram', 'Frequency', 'Category', nbgroups, x, Freq);
GraphSetPlotPointStyle (Graph, 1, 0, ?Pattern, ?Size, ?Color);

GraphSetScaling (graph, AX_X, SCALING_MANUAL, 0, nbgroups+1, 1);
ystep := trunc(maxFreq/10) + 1;
GraphSetScaling (graph, AX_Y, SCALING_MANUAL_0, 0, maxFreq+ystep, ystep);


for i:=1 to nbgroups do
begin
  for j:=1 to trunc(Freq(i)/ystep)+1 do
  begin
    GraphInsertFile (graph, metafile$, 0, 0, i-0.4, min(j*ystep,Freq(i)), i+0.4, (j-1)*ystep, 1);
  end;
end;
Back to List of Programs



[StatSoft]
2300 East 14th Street, Tulsa, OK 74104
Phone: (918) 749-1119; Fax: (918) 749-2217

[StatSoft]e-mail: info@statsoft.com

©Copyright StatSoft, Inc., 1984-2004.
StatSoft, StatSoft logo, STATISTICA, SEWSS, SEDAS, Data Miner, SEPATH and GTrees are trademarks of StatSoft, Inc.