home *** CD-ROM | disk | FTP | other *** search
/ Turbo Toolbox / Turbo_Toolbox.iso / qc25 / beispiel / diagdemo.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-07-25  |  34.2 KB  |  1,145 lines

  1. /* DIAGDEMO.C - Beispielprogramm für Diagrammgrafiken
  2.  *
  3.  * Sofern GRAPHICS.LIB und PGCHART.LIB bei der Installation nicht in 
  4.  * die Laufzeit-Bibliothek eingefügt wurden, müssen die beiden 
  5.  * Bibliotheken in die Programmliste von DIAGDEMO.MAK aufgenommen 
  6.  * oder auf der Befehlszeile angegeben werden.
  7.  */
  8.  
  9. #include <stdio.h>
  10. #include <stdlib.h>
  11. #include <string.h>
  12. #include <bios.h>
  13. #include <conio.h>
  14. #include <graph.h>
  15. #include <pgchart.h>
  16. #include "diagdemo.h"
  17.  
  18. /* Strukturen für System-Konfiguration und Diagrammumgebung. */
  19. struct videoconfig vc;
  20. chartenv ce;
  21.  
  22. /* Kategorievariablen.  */
  23. short cCat;
  24. char _far * aCat[MAXWERTE];
  25.  
  26. /* Folgenvariablen  */
  27. short cFolge;
  28. short _far acFolge[MAXFOLGEN];
  29. char _far * aFolgeName[MAXFOLGEN];
  30.  
  31. /* Vorübergendes Aufbewahrungs-Datenfeld für alle Daten. Datenwerte für
  32.  * Balken-, Säulen- und Strichdiagramme aus Mehrfachfolgen bleiben hier.
  33.  * Daten für andere Diagramme werden auf die folgenden Datenfelder
  34.  * übertragen.
  35.  */
  36. float _far aWert[MAXFOLGEN][MAXWERTE];
  37.  
  38. /* Datenwerte für Diagramme aus Einzelfolgen. Das erste Datenfeld wird
  39.  * für Balken-, Säulen, Linien und Kreisdiagramme verwendet. Für das
  40.  * Einzelfolgen-Streudiagramm werden sowohl das erste also auch das
  41.  * zweite benutzt.
  42.  */
  43. float _far axWert[MAXWERTE];
  44. float _far ayWert[MAXWERTE];
  45.  
  46. /* Datenwerte für Mehrfachfolgen-Streudiagramme.  */
  47. float _far axWertMS[MAXWERTE][MAXWERTE];
  48. float _far ayWertMS[MAXWERTE][MAXWERTE];
  49.  
  50. /* Herausgezogene Bezeichner für Kreisdiagramm. */
  51. short _far aExplode[MAXWERTE];
  52.  
  53. /* Die Variablen zum Verfolgen von Steuerung und Bildschirmposition.  */
  54. struct SCREENINFO si;
  55.  
  56. /* Farben der Menüs und Eingabeaufforderungen */
  57. struct tagFarbe co;
  58.  
  59. /* Kennung ob vorgegebene oder importierte Daten verwendet werden sollen. */
  60. BOOL fDefault = WAHR;
  61.  
  62. /* Zeichenfolge-Datenfelder für die Menü-Funktion. Die erste Zeichenfolge
  63.  * ist der Menütitel. Die nächsten Zeichenfolgen ungleich Null sind die
  64.  * Wahlmöglichkeiten des Menüs. Eine Null-Zeichenfolge bedeutet das Ende der
  65.  * Liste
  66.  */
  67.  
  68. char *pszDiagrammOpt[] =
  69.     { "Optionen", "Modus (Bildschirm)", "Fenster", "Titel",
  70.       "Achse (X und Y)", "Beschriftung", "Schriften", "Zurücksetzen", "" };
  71.  
  72. char *pszDiagrammTyp[] =
  73.     { "Typ", "Balken", "Säulen", "Linien", "Streu", "Kreis", "" };
  74.  
  75. char *pszHauptMenue[] =
  76.     { "Hauptmenü", "Demo", "Ansicht", "Typ",
  77.       "Optionen", "Werte anzeigen", "Ende", "" };
  78.  
  79. /* Beispieldaten  */
  80. #define O_SAFT 0
  81. #define E_TEE  1
  82. #define KAKAO  2
  83. #define TEMPERATUR 3
  84.  
  85. char _far * aViertel[] =
  86.     { "Erstes", "Zweites", "Drittes", "Viertes" };
  87.  
  88. char _far * aMonate[] =
  89.     { "Jan", "Feb", "Mrz", "Apr", "Mai", "Jun",
  90.       "Jul", "Aug", "Sep", "Okt", "Nov", "Dez" };
  91.  
  92. float _far aVerkauf[3][12] =
  93. {
  94.     {  3.6F,  3.2F,  3.3F,  3.4F,  3.1F,  2.9F,
  95.        3.0F,  3.6F,  3.2F,  3.3F,  3.5F,  3.9F },
  96.     {  1.0F,  1.3F,  1.4F,  1.7F,  2.2F,  2.9F,
  97.        2.9F,  3.1F,  2.6F,  1.8F,  1.1F,  1.2F },
  98.     {  2.4F,  2.3F,  2.0F,  1.6F,  1.3F,  1.0F,
  99.        0.9F,  0.8F,  1.1F,  1.4F,  1.9F,  2.5F }
  100. };
  101.  
  102. float _far aTemperatur[12] =
  103.     {  6.1F, 8.5F, 10.9F, 12.8F, 16.0F, 19.5F, 
  104.        22.0F, 21.2F, 17.0F, 13.7F, 11.1F, 9.3F };
  105.  
  106. char _far * aVerkaufTitel[] =
  107.     { "Orangensaftverkauf", "Eisteeverkauf", "Kakaoverkauf" };
  108.  
  109. char *TempTitel = "Durchschnittstemperatur";
  110.  
  111. int main()
  112. {
  113.     Initialisiere();
  114.     HauptMenue();
  115.  
  116.     /* Rücksetzen des Videomodus und der Bildschirmfarben vor Abschluß */
  117.     _setvideomode( _DEFAULTMODE );
  118.     _settextcolor( co.InfoFarbe );
  119.     _clearscreen( _GCLEARSCREEN );
  120.  
  121.     return 0;
  122. }
  123.  
  124. /*  DiagrammOptionen - Ruft Diagramm-Optionen ab.
  125.  *
  126.  *  Parameter: Keine
  127.  */
  128. void DiagrammOptionen()
  129. {
  130.     int iWahl;
  131.  
  132.     PushTitel( pszDiagrammOpt[0] );
  133.     while( (iWahl = Menue( pszDiagrammOpt )) != ESCAPE )
  134.     {
  135.  
  136.         /* Diagramm-Optionen holen.  */
  137.         switch( iWahl )
  138.         {
  139.  
  140.             /* Zum entsprechenden Menü verzweigen.  */
  141.             case 1:
  142.                 BschirmModus();
  143.                 break;
  144.  
  145.             case 2:
  146.                 Fenster();
  147.                 break;
  148.  
  149.             case 3:
  150.                 Titel();
  151.                 break;
  152.  
  153.             case 4:
  154.                 Achsen();
  155.                 break;
  156.  
  157.             case 5:
  158.                 Beschriftung();
  159.                 break;
  160.  
  161.             case 6:
  162.           SchriftOptionen();
  163.                 break;
  164.  
  165.             case 7:
  166.                 RuecksetzOptionen();
  167.                 break;
  168.  
  169.         }
  170.     }
  171.     PopTitel();
  172. }
  173.  
  174. /*  DiagrammTyp - Holt Diagrammtyp.
  175.  *
  176.  *  Parameter: Keine
  177.  */
  178. void DiagrammTyp()
  179. {
  180.     int iWahl;
  181.  
  182.     /* Get chart type.  */
  183.     PushTitel( pszDiagrammTyp[0] );
  184.     iWahl = Menue( pszDiagrammTyp );
  185.  
  186.     if( iWahl != ESCAPE )
  187.     {
  188.         /* Diagrammtyp bestimmen und Diagrammart holen.  */
  189.         ce.charttype = iWahl;
  190.         switch( iWahl )
  191.         {
  192.  
  193.             case 1:
  194.             case 2:
  195.           iWahl = BlankMenue( "Stil", "Einfache Balken", "Balken Übereinander" );
  196.                 break;
  197.  
  198.             case 3:
  199.             case 4:
  200.                 iWahl = BlankMenue( "Stil", "Linien-Punkte", "Nur Punkte" );
  201.                 break;
  202.  
  203.             case 5:
  204.           iWahl = BlankMenue( "Stil", "Prozent", "Kein Prozent" );
  205.         }
  206.  
  207.         if( iWahl != ESCAPE)
  208.             ce.chartstyle = iWahl;
  209.  
  210.         /* Vorgabedaten einrichten, ohne Umgebungsvorgaben zu ändern.  */
  211.      VorgabeDaten( ce.charttype, ce.chartstyle, FALSCH );
  212.         PopTitel();
  213.     }
  214.     PopTitel();
  215. }
  216.  
  217.  
  218. /*  DatenLoeschen - Löscht Daten für Kategorie und Wert.
  219.  *
  220.  *  Parameter: fWirklich - Kennung, ob bestätigt werden soll. */
  221. void DatenLoeschen( BOOL fWirklich )
  222. {
  223.     char chAntwort = 'J';
  224.     int iCat;
  225.  
  226.     WrtForm( 18 );
  227.  
  228.     /* Anfrage nach Bestätigung.  */
  229.     if( fWirklich )
  230.      chAntwort = EingabeChar( "Sind Sie sicher? ", "JN\x1b" );
  231.  
  232.     if( chAntwort == 'J' )
  233.     {
  234.  
  235.         /* Alle relevanten Daten löschen.  */
  236.         for( iCat = 0; iCat < cCat; iCat++ )
  237.             aCat[iCat] = NULL;
  238.         cCat = 0;
  239.      cFolge = 0;
  240.     }
  241. }
  242.  
  243. /*  VorgabeDaten - Initialisiert Vorgabedaten für jeden Diagrammtyp.
  244.  *
  245.  *  Parameter: iTyp   - Zu initialisierender Diagrammtyp
  246.  *             iStil  - Diagrammstil
  247.  *             fLoesch - Signal, alle Vorgaben zu löschen
  248.  */
  249. void VorgabeDaten( short iTyp, short iStil, BOOL fLoesch )
  250. {
  251.     int iCat, iWert, iSubWert, iFolge;
  252.  
  253.     /* Vorgabediagramm aufrufen um alte Werte zu löschen.  */
  254.     if( fLoesch )
  255.         _pg_defaultchart( &ce, iTyp, iStil );
  256.  
  257.     /* Kategorietitel initialisieren.  */
  258.     cCat = 12;
  259.     for( iCat = 0; iCat < cCat; iCat++ )
  260.         aCat[iCat] = aMonate[iCat];
  261.  
  262.     switch( ce.charttype )
  263.     {
  264.  
  265.         /* Daten für jeden Diagrammtyp initialisieren.  */
  266.         case _PG_BARCHART:
  267.  
  268.          strcpy( ce.maintitle.title, "Orangensaft- und Eisteeverkauf" );
  269.          cFolge = 2;
  270.          for( iFolge = 0; iFolge < cFolge; iFolge++ )
  271.             {
  272.           aFolgeName[iFolge] = aVerkaufTitel[iFolge];
  273.           acFolge[iFolge] = cCat;
  274.                 for( iWert = 0; iWert < cCat; iWert++ )
  275.               aWert[iFolge][iWert]  = (float)aVerkauf[iFolge][iWert];
  276.             }
  277.             break;
  278.  
  279.         case _PG_COLUMNCHART:
  280.  
  281.          strcpy( ce.maintitle.title, "Orangensaftverkauf" );
  282.          cFolge = 1;
  283.          for( iFolge = 0; iFolge < cFolge; iFolge++ )
  284.             {
  285.           aFolgeName[iFolge] = aVerkaufTitel[iFolge];
  286.           acFolge[iFolge] = cCat;
  287.                 for( iWert = 0; iWert < cCat; iWert++ )
  288.               aWert[iFolge][iWert]  = (float)aVerkauf[iFolge][iWert];
  289.             }
  290.             break;
  291.  
  292.         case _PG_LINECHART:
  293.  
  294.             strcpy( ce.maintitle.title, "Getränkeverkauf" );
  295.          cFolge = 3;
  296.          for( iFolge = 0; iFolge < cFolge; iFolge++ )
  297.             {
  298.           aFolgeName[iFolge] = aVerkaufTitel[iFolge];
  299.           acFolge[iFolge] = cCat;
  300.                 for( iWert = 0; iWert < cCat; iWert++ )
  301.               aWert[iFolge][iWert] = (float)aVerkauf[iFolge][iWert];
  302.             }
  303.             break;
  304.  
  305.         case _PG_SCATTERCHART:
  306.  
  307.             strcpy( ce.maintitle.title,
  308.                  "Durchschnittstemperatur im Vergleich zum Getränkeverkauf"
  309. );
  310.             /* ce.chartstyle = _PG_POINTONLY; */
  311.          cFolge = 4;
  312.  
  313.          aFolgeName[0] = aVerkaufTitel[E_TEE];
  314.          aFolgeName[2] = aVerkaufTitel[KAKAO];
  315.          acFolge[0] = acFolge[1] = acFolge[2] = acFolge[3] = 12;
  316.             for( iWert = 0; iWert < 12; iWert++ )
  317.             {
  318.           aWert[0][iWert]  = (float)aVerkauf[E_TEE][iWert] ;
  319.           aWert[1][iWert]  = (float)aVerkauf[TEMPERATUR][iWert] ;
  320.           aWert[2][iWert]  = (float)aVerkauf[KAKAO][iWert] ;
  321.           aWert[3][iWert]  = (float)aVerkauf[TEMPERATUR][iWert] ;
  322.             }
  323.             break;
  324.  
  325.         case _PG_PIECHART:
  326.         default:
  327.  
  328.          strcpy( ce.maintitle.title, "Eisteeverkauf" );
  329.             cCat = 4;
  330.             for( iCat = 0; iCat < cCat; iCat++ )
  331.                 aCat[iCat] = aViertel[iCat];
  332.  
  333.          cFolge = 1;
  334.          aFolgeName[0] = aVerkaufTitel[E_TEE];
  335.          acFolge[0] = cCat;
  336.  
  337.             for( iWert = 0; iWert < cCat; iWert++ )
  338.             {
  339.                 aWert[0][iWert] = 0.0F;
  340.                 for( iSubWert = 0; iSubWert < 3; iSubWert++ )
  341.               aWert[0][iWert] += (float)aVerkauf[E_TEE][iSubWert * iWert];
  342.             }
  343.             aExplode[3] = 1;
  344.             break;
  345.     }
  346. }
  347.  
  348. /*  Demo - Zeigt eine Reihe von Diagrammbeispielen.
  349.  *
  350.  *  Parameter: Keine
  351.  */
  352. void Demo()
  353. {
  354.     int  cWert;
  355.     palettetype palette_struct;
  356.  
  357.     /* Zeigt Beispielsdaten in Tabellenform. */
  358.     ZeigeBspielDaten();
  359.  
  360.     VorgabeDaten( _PG_PIECHART, _PG_NOPERCENT, WAHR );
  361.  
  362.     /* Videomodus einrichten und Diagramme zeichnen. Vorgabedaten für
  363.      * jedes Diagramm einrichten und gewünschte Umgebungsfelder ändern.
  364.      * Im Fall eines Fehlers, Demo abbrechen.
  365.      */
  366.     _setvideomode( si.mode );
  367.  
  368.     cWert = 4;
  369.     strcpy( ce.subtitle.title, "Vorgegebenes Kreisdiagramm" );
  370.     if( DiagrammAnsicht() )
  371.         return;
  372.     else
  373.         _clearscreen( _GCLEARSCREEN );
  374.  
  375.     strcpy( ce.subtitle.title, "Geändertes Kreisdiagramm" );
  376.     ce.chartstyle = _PG_PERCENT;
  377.     ce.legend.place = _PG_BOTTOM;
  378.     if (si.fFarbe)
  379.     {
  380.         ce.maintitle.titlecolor = ce.subtitle.titlecolor = 0;
  381.         ce.chartwindow.background = 1;
  382.         ce.datawindow.background = ce.legend.legendwindow.background = 6;
  383.         ce.legend.textcolor = 1;
  384.     }
  385.     if( DiagrammAnsicht() )
  386.         return;
  387.     else
  388.         _clearscreen( _GCLEARSCREEN );
  389.  
  390.     cWert = 12;
  391.     VorgabeDaten( _PG_BARCHART, _PG_PLAINBARS, WAHR );
  392.     strcpy( ce.subtitle.title, "Vorgegebenes Balkendiagramm" );
  393.     if( DiagrammAnsicht() )
  394.         return;
  395.     else
  396.         _clearscreen( _GCLEARSCREEN );
  397.  
  398.     strcpy( ce.subtitle.title, "Spezielles Überlagertes Balkendiagramm" );
  399.     strcpy( ce.xaxis.axistitle.title, "Verkauf in Tausenden" );
  400.     strcpy( ce.yaxis.axistitle.title, "Monat" );
  401.     ce.chartstyle = _PG_STACKEDBARS;
  402.     ce.legend.place = _PG_RIGHT;
  403.     ce.xaxis.ticdecimals = 2;
  404.     if (si.fFarbe)
  405.     {
  406.         ce.maintitle.titlecolor = ce.subtitle.titlecolor = 12;
  407.         ce.chartwindow.background = 7;
  408.         ce.datawindow.background = 8;
  409.         ce.legend.textcolor = 0;
  410.         ce.legend.legendwindow.background = 8;
  411.         ce.legend.autosize = FALSCH;
  412.         ce.legend.legendwindow.y1 = vc.numypixels - 85;
  413.         ce.legend.legendwindow.y2 = vc.numypixels - 45;
  414.     }
  415.     if( DiagrammAnsicht() )
  416.         return;
  417.     else
  418.         _clearscreen( _GCLEARSCREEN );
  419.  
  420.     VorgabeDaten( _PG_COLUMNCHART, _PG_PLAINBARS, WAHR );
  421.     strcpy( ce.subtitle.title, "Vorgegebenees Säulendiagramm" );
  422.     if( DiagrammAnsicht() )
  423.         return;
  424.     else
  425.         _clearscreen( _GCLEARSCREEN );
  426.  
  427.     strcpy( ce.subtitle.title, "Geändertes Säulendiagramm" );
  428.     strcpy( ce.xaxis.axistitle.title, "Monat" );
  429.     strcpy( ce.yaxis.axistitle.title, "Verkauf in Tausenden" );
  430.     ce.legend.place = _PG_BOTTOM;
  431.     if (si.fFarbe)
  432.     {
  433.      ce.maintitle.titlecolor   = 0;
  434.      ce.subtitle.titlecolor    = 0;
  435.      ce.chartwindow.background = 8;
  436.      ce.datawindow.background  = 2;
  437.      ce.legend.legendwindow.background = 10;
  438.     }
  439.     if( DiagrammAnsicht() )
  440.         return;
  441.     else
  442.         _clearscreen( _GCLEARSCREEN );
  443.  
  444.     VorgabeDaten( _PG_LINECHART, _PG_POINTANDLINE, WAHR );
  445.     strcpy( ce.subtitle.title, "Vorgegebenes Liniendiagramm" );
  446.     if( DiagrammAnsicht() )
  447.         return;
  448.     else
  449.         _clearscreen( _GCLEARSCREEN );
  450.  
  451.     strcpy( ce.subtitle.title, "Geändertes Liniendiagramm" );
  452.     strcpy( ce.xaxis.axistitle.title, "Monat" );
  453.     strcpy( ce.yaxis.axistitle.title, "Verkauf in Tausenden" );
  454.     ce.legend.place = _PG_RIGHT;
  455.     if (si.fFarbe)
  456.     {
  457.         ce.maintitle.titlecolor = 1;
  458.         ce.subtitle.titlecolor = 1;
  459.         ce.chartwindow.background = 3;
  460.         ce.datawindow.background = 7;
  461.         ce.legend.legendwindow.background = 7;
  462.         ce.legend.autosize = FALSCH;
  463.         ce.legend.legendwindow.y1 = vc.numypixels - 85;
  464.         ce.legend.legendwindow.y2 = vc.numypixels - 45;
  465.     }
  466.     if( DiagrammAnsicht() )
  467.         return;
  468.     else
  469.         _clearscreen( _GCLEARSCREEN );
  470.  
  471.     VorgabeDaten( _PG_SCATTERCHART, _PG_POINTONLY, WAHR );
  472.     strcpy( ce.subtitle.title, "Vorgegebenes Streudiagramm" );
  473.     if( DiagrammAnsicht() )
  474.         return;
  475.     else
  476.         _clearscreen( _GCLEARSCREEN );
  477.  
  478.     cFolge = 4;
  479.     strcpy( ce.subtitle.title, "Geändertes Streudiagramm" );
  480.     strcpy( ce.xaxis.axistitle.title, "Verkauf in Tausenden" );
  481.     strcpy( ce.yaxis.axistitle.title, "Durchschnittstemperatur" );
  482.     ce.legend.place = _PG_RIGHT;
  483.     if (si.fFarbe)
  484.     {
  485.         ce.maintitle.titlecolor = 0;
  486.         ce.subtitle.titlecolor = 0;
  487.         ce.chartwindow.background = 4;
  488.         ce.datawindow.background = 8;
  489.         ce.legend.legendwindow.background = 8;
  490.         ce.legend.autosize = FALSCH;
  491.         ce.legend.legendwindow.y1 = vc.numypixels - 85;
  492.         ce.legend.legendwindow.y2 = vc.numypixels - 45;
  493.     }
  494.     if( DiagrammAnsicht() )
  495.         return;
  496.     else
  497.         _clearscreen( _GCLEARSCREEN );
  498.  
  499.     VorgabeDaten( _PG_BARCHART, _PG_PERCENT, WAHR );
  500. }
  501.  
  502. /*  FindVideoMode - Findet "besten" Videomodus für eingebauten Adapter.
  503.  *
  504.  *  Parameter: vc - Struktur des Typs struct videoconfig
  505.  *
  506.  *  Ergibt: Besten Videomodus
  507.  */
  508. int FindVideoMode( struct videoconfig vc )
  509. {
  510.     switch( vc.adapter )
  511.     {
  512.         case _CGA:
  513.         case _OCGA:
  514.             return _HRESBW;
  515.         case _EGA:
  516.         case _OEGA:
  517.             return( vc.monitor == _MONO ) ? _ERESNOCOLOR : _ERESCOLOR;
  518.         case _VGA:
  519.         case _OVGA:
  520.         case _MCGA:
  521.             return _VRES16COLOR;
  522.         case _HGC:
  523.             return _HERCMONO;
  524.         default:
  525.             return _DEFAULTMODE;
  526.     }
  527. }
  528.  
  529.  
  530. /*  Initialisiere - Initialisiert diverse Werte.
  531.  *
  532.  *  Parameter: Keine
  533.  */
  534. void Initialisiere( void )
  535. {
  536.     int iFolge, iWert;
  537.  
  538.     /* Initialisiert alle Wert-Datenfelder auf fehlend.  */
  539.     for( iFolge = 0; iFolge < MAXFOLGEN; iFolge++ )
  540.     {
  541.  
  542.      axWert[iFolge] = _PG_MISSINGVALUE;
  543.      ayWert[iFolge] = _PG_MISSINGVALUE;
  544.  
  545.      for( iWert = 0; iWert < MAXWERTE; iWert++ )
  546.          aWert[iFolge][iWert] = _PG_MISSINGVALUE;
  547.  
  548.      for( iWert = 0; iWert < MAXWERTE; iWert++ )
  549.         {
  550.          axWertMS[iFolge][iWert] = _PG_MISSINGVALUE;
  551.          ayWertMS[iFolge][iWert] = _PG_MISSINGVALUE;
  552.         }
  553.     }
  554.  
  555.     /* Nullreihen initialisieren.  */
  556.     cFolge = 0;
  557.  
  558.     /* Vorgabe Diagrammumgebung, Bildschirmmodus und Daten initialisieren.*/
  559.     _pg_initchart();
  560.     _getvideoconfig( &vc );
  561.  
  562.     /* Besten Modus zur Anzeige finden.
  563.      * NICHT auf 256 Farben bei mittlerer Auflösung (_MRES256COLOR).
  564.      */
  565.     si.mode = FindVideoMode( vc );
  566.  
  567.     if( si.mode == _TEXTMONO )
  568.     {
  569.         _clearscreen( _GCLEARSCREEN );
  570.         _outtext( "Grafik nicht verfügbar - kann Demo nicht fahren." );
  571.         exit( 1 );
  572.     }
  573.  
  574.     SetDisplayColors();
  575.  
  576.     SetGraphMode( si.mode );
  577.     VorgabeDaten( _PG_BARCHART, _PG_PLAINBARS, WAHR );
  578.  
  579.     _setvideomode( _DEFAULTMODE );
  580.  
  581. }
  582.  
  583.  
  584. /*  HauptMenue - Verwaltet das Hauptmenü.
  585.  *
  586.  *  Parameter: Keine
  587.  */
  588. void HauptMenue( void )
  589. {
  590.     int iWahl;
  591.     char chAntwort = 'J';
  592.     char chBestaetigen;
  593.  
  594.     PushTitel( pszHauptMenue[0] );
  595.     do
  596.     {
  597.         /*  Wählt der Benutzer Ende, enthält iWahl 6. Drückt er die
  598.          *  ESC-Taste, wird iWahl zu ESCAPE, d.h. gleich 27.
  599.          *  In jedem Fall können wir auf beide Bedingungen prüfen, indem
  600.          *  geprüft wird, ob iWahl kleiner als 6 ist.
  601.          */
  602.         while( (iWahl = Menue( pszHauptMenue )) < 6 )
  603.         {
  604.             /* Hauptmenü-Auswahl holen.  */
  605.             switch( iWahl )
  606.             {
  607.  
  608.                 case 1:
  609.                     /* Demo-Diagramme anzeigen.  */
  610.                     Demo();
  611.                     _setvideomode( _DEFAULTMODE );
  612.                     break;
  613.  
  614.                 case 2:
  615.                     /* Auf Grafikmodus schalten, gegenwärtiges Diagramm
  616.                      * anzeigen und wieder auf Textmodus rücksetzen.
  617.                      */
  618.                     _setvideomode( si.mode );
  619.                     DiagrammAnsicht();
  620.                     _setvideomode( _DEFAULTMODE );
  621.                     break;
  622.  
  623.                 case 3:
  624.                     /* Diagrammtyp und Stil holen.  */
  625.                     DiagrammTyp();
  626.                     break;
  627.  
  628.                 case 4:
  629.                     /* Diagrammoptionen holen.  */
  630.                     DiagrammOptionen();
  631.                     break;
  632.                 case 5:
  633.                     /* Diagrammdaten zeigen. */
  634.                     ZeigeDiagrammDaten();
  635.                     break;
  636.  
  637.             }
  638.  
  639.         }
  640.  
  641.         /* Versucht der Benutzer das Programm über die ESCAPE-Taste zu
  642.          * verlassen, muß dies jeweils bestätigt werden, denn sonst könnte
  643.          * man mit zu häufigem Drücken von ESCAPE versehentlich an einer
  644.          * ungeplanten Stelle aussteigen.
  645.          */
  646.         if( iWahl == ESCAPE )
  647.         {
  648.          Hilfe( "Drücken Sie \"E\", um wirklich zu Beenden", co.EingabeFarbe );
  649.  
  650.          putchar( SIGNAL );
  651.             _settextposition( si.help - 1, 32 );
  652.          chBestaetigen = getch();
  653.          if( tolower( chBestaetigen ) != 'e' )
  654.                 iWahl = 0;
  655.             else
  656.                 iWahl = 6;
  657.         }
  658.  
  659.     } while( iWahl != 6 );
  660.     PopTitel();
  661. }
  662.  
  663. /*  RuecksetzOptionen - Nach Bestätigung Diagrammoptionen
  664.  *                      auf Vorgabe rücksetzen.
  665.  *
  666.  *  Parameter: Keine
  667.  */
  668. void RuecksetzOptionen()
  669. {
  670.     char chAntwort;
  671.  
  672.     /* Aufforderung zur Bestätigung vor Rücksetzen zur Vorgabeumgebung.  */
  673.     LschForm();
  674.     Hilfe( "Mit 'J' alle Optionen, mit 'N' beibehalten.", co.EingabeFarbe );
  675.     chAntwort = EingabeChar( "Sind Sie sicher? ", "JN\x1b" );
  676.     if( chAntwort == 'J' )
  677.         _pg_defaultchart( &ce, 1, 1 );
  678.  
  679. }
  680.  
  681. /*  SetGraphMode - Prüft den verlangten Grafikmodus und richtet die Werte
  682.  *  xMax und yMax in der si-Struktur ein (si = Screen Information).
  683.  *
  684.  *  Parameter: modus
  685.  *
  686.  *  Ergibt: FALSCH wenn der Modus ungültig ist, sonst WAHR.
  687.  */
  688. BOOL SetGraphMode(int modus)
  689. {
  690.     if (!_setvideomode( modus ) )
  691.      return FALSCH;
  692.     else
  693.     {
  694.         _getvideoconfig ( &vc );
  695.         if( !vc.numxpixels )
  696.         return FALSCH;
  697.         si.xMax = vc.numxpixels;
  698.         si.yMax = vc.numypixels;
  699.         si.mode = modus;
  700.  
  701.         /* Kennung einsetzen, ob mehrfache Farben verfügbar sind.  */
  702.         si.fFarbe = iscolor( modus );
  703.  
  704.      return WAHR;
  705.     }
  706. }
  707.  
  708. /*  ZeigeDiagrammDaten - Zeigt die Daten in der Diagrammumgebung.
  709.  *
  710.  *  Parameter: Keine
  711.  */
  712. void ZeigeDiagrammDaten()
  713. {
  714.     int iReihe = 2;
  715.     struct _fontinfo fd;
  716.     static char *szWeiter =
  717.      "Beliebige Taste zum Fortsetzen drücken, mit ESC zurück zum Menü.";
  718.  
  719.     _clearscreen( _GCLEARSCREEN );
  720.     SAusgabePos( iReihe++, 1, "short      charttype =  %d", ce.charttype );
  721.     SAusgabePos( iReihe++, 1, "short      chartstyle = %d", ce.chartstyle );
  722.     SAusgabePos( iReihe++, 1, "windowtype chartwindow =" );
  723.     iReihe = ZeigeFensterTyp( iReihe, 1, ce.chartwindow );
  724.     SAusgabePos( iReihe++, 1, "windowtype datawindow =" );
  725.     iReihe = ZeigeFensterTyp( iReihe, 1, ce.datawindow );
  726.     SAusgabePos( ++iReihe, 1, szWeiter );
  727.     if( getch() == ESCAPE )
  728.         return;
  729.  
  730.     iReihe = 2;
  731.     _clearscreen( _GCLEARSCREEN );
  732.     SAusgabePos( iReihe++, 1, "titletype  maintitle =" );
  733.     iReihe = ZeigeTitelTyp( iReihe, 1, ce.maintitle );
  734.     SAusgabePos( iReihe++, 1, "titletype   subtitle =" );
  735.     iReihe = ZeigeTitelTyp( iReihe, 1, ce.subtitle );
  736.     SAusgabePos( ++iReihe, 1, szWeiter );
  737.     if( getch() == ESCAPE )
  738.         return;
  739.  
  740.     iReihe = 2;
  741.     _clearscreen( _GCLEARSCREEN );
  742.     SAusgabePos( iReihe++, 1, "axistype       xaxis =" );
  743.     iReihe = ZeigeAchsenTyp( iReihe, 1, ce.xaxis );
  744.     SAusgabePos( ++iReihe, 1, szWeiter );
  745.     if( getch() == ESCAPE )
  746.         return;
  747.  
  748.     iReihe = 2;
  749.     _clearscreen( _GCLEARSCREEN );
  750.     SAusgabePos( iReihe++, 1, "axistype       yaxis =" );
  751.     iReihe = ZeigeAchsenTyp( iReihe, 1, ce.yaxis );
  752.     SAusgabePos( ++iReihe, 1, szWeiter );
  753.     if( getch() == ESCAPE )
  754.         return;
  755.  
  756.     iReihe = 2;
  757.     _clearscreen( _GCLEARSCREEN );
  758.     SAusgabePos( iReihe++, 1, "legendtype     Beschriftung =" );
  759.     iReihe = ZeigeBeschriftungTyp( iReihe, 1, ce.legend );
  760.     SAusgabePos( ++iReihe, 1, "Press any key to continue . . ." );
  761.     getch();
  762.  
  763.     iReihe = 2;
  764.     _clearscreen( _GCLEARSCREEN );
  765.     if( _getfontinfo( &fd ) != -1)
  766.     {
  767.         SAusgabePos( ++iReihe, 1, "struct _fontinfo =" );
  768.         iReihe = ZeigeFontInfo( iReihe, 1, fd);
  769.         SAusgabePos( ++iReihe, 1, "Press any key to continue . . ." );
  770.     getch();
  771.     }
  772. }
  773.  
  774. /*  ZeigeAchsenTyp -  Zeigt Daten in einer Variablen des Typs "axistype".
  775.  *
  776.  *  Parameter: iReihe - Anfangsreihe
  777.  *             iSplt - Spalten einzurücken
  778.  *             dieAchse - anzuzeigende Variable des Typs "axistype"
  779.  *
  780.  *  Ergibt: Nächste verfügbare Reihe
  781.  */
  782. int ZeigeAchsenTyp( int iReihe, int iSplt, axistype dieAchse )
  783. {
  784.     SAusgabePos( iReihe++, iSplt + 5, "short        .grid = %d",
  785.            dieAchse.grid );
  786.     SAusgabePos( iReihe++, iSplt + 5, "short   .gridstyle = %d",
  787.            dieAchse.gridstyle );
  788.     SAusgabePos( iReihe++, iSplt + 5, "titletype axistitle=" );
  789.     iReihe = ZeigeTitelTyp( iReihe, iSplt + 5, dieAchse.axistitle );
  790.     SAusgabePos( iReihe++, iSplt + 5, "short   .axiscolor = %d",
  791.            dieAchse.axiscolor );
  792.     SAusgabePos( iReihe++, iSplt + 5, "short     .labeled = %s",
  793.            (dieAchse.labeled) ? "WAHR" : "FALSCH" );
  794.     SAusgabePos( iReihe++, iSplt + 5, "short   .rangetype = %d",
  795.            dieAchse.rangetype );
  796.     SAusgabePos( iReihe++, iSplt + 5, "float     .logbase = %f",
  797.            dieAchse.logbase );
  798.     SAusgabePos( iReihe++, iSplt + 5, "short   .autoscale = %s",
  799.            (dieAchse.autoscale) ? "WAHR" : "FALSCH" );
  800.     SAusgabePos( iReihe++, iSplt + 5, "float    .scalemin = %f",
  801.            dieAchse.scalemin );
  802.     SAusgabePos( iReihe++, iSplt + 5, "float    .scalemax = %f",
  803.            dieAchse.scalemax );
  804.     SAusgabePos( iReihe++, iSplt + 5, "float .scalefactor = %f",
  805.            dieAchse.scalefactor );
  806.     iReihe = ZeigeTitelTyp( iReihe, iSplt + 5, dieAchse.scaletitle );
  807.     SAusgabePos( iReihe++, iSplt + 5, "float  .ticinterval = %f",
  808.            dieAchse.ticinterval );
  809.     SAusgabePos( iReihe++, iSplt + 5, "short    .ticformat = %d",
  810.            dieAchse.ticformat );
  811.     SAusgabePos( iReihe++, iSplt + 5, "short  .ticdecimals = %d",
  812.            dieAchse.ticdecimals );
  813.  
  814.     return iReihe;
  815. }
  816.  
  817. /* ZeigeFontInfo - Gibt die Daten einer Variable vom Typ "_fontinfo" aus.
  818.  *
  819.  *  Parameter: iReihe - Anfangsreihe
  820.  *             iSplt - Spalten einzurücken
  821.  *             derFont - auszugebende Variable vom Typ "_fontinfo"
  822.  *  Ergibt: Nächste verfügbare Reihe
  823.  */
  824.  
  825. int ZeigeFontInfo ( int iReihe, int iSplt, struct _fontinfo derFont)
  826. {
  827.     SAusgabePos( iReihe, iSplt + 5, "int         .type = %d", derFont.type );
  828.     SAusgabePos( iReihe, iSplt + 5, "int       .ascent = %d", derFont.ascent );
  829.     SAusgabePos( iReihe, iSplt + 5, "int     .pixwidth = %d", derFont.pixwidth );
  830.     SAusgabePos( iReihe, iSplt + 5, "int    .pixheight = %d", derFont.pixheight );
  831.     SAusgabePos( iReihe, iSplt + 5, "int     .avgwidth = %d", derFont.avgwidth );
  832.     SAusgabePos( iReihe, iSplt + 5, "int     .filename = %d", derFont.filename );
  833.     SAusgabePos( iReihe, iSplt + 5, "int     .facename = %d", derFont.facename );
  834.  
  835.     return iReihe;
  836.  
  837. }
  838.  
  839. /*  ZeigeBeschriftungTyp - Zeigt Daten des Variablentyps "legendtype".
  840.  *
  841.  *  Parameter: iReihe - Anfangsreihe
  842.  *             iSplt - Spalten einzurücken
  843.  *             dieBeschriftung - anzuzeigende Variable des Typs "legendtype"
  844.  *
  845.  *  Ergibt: Nächste verfügbare Reihe
  846.  */
  847. int ZeigeBeschriftungTyp( int iReihe, int iSplt, legendtype dieBeschriftung )
  848. {
  849.     SAusgabePos( iReihe++, iSplt + 5, "short      .legend = %s",
  850.            (dieBeschriftung.legend) ? "WAHR" : "FALSCH" );
  851.     SAusgabePos( iReihe++, iSplt + 5, "short       .place = %d",
  852. dieBeschriftung.place );
  853.     SAusgabePos( iReihe++, iSplt + 5, "short   .textcolor = %d",
  854. dieBeschriftung.textcolor );
  855.     SAusgabePos( iReihe++, iSplt + 5, "short    .autosize = %d",
  856. dieBeschriftung.autosize );
  857.     SAusgabePos( iReihe++, iSplt + 5, "windowtype legendwindow =" );
  858.     iReihe = ZeigeFensterTyp( iReihe, iSplt + 5,
  859. dieBeschriftung.legendwindow );
  860.  
  861.     return iReihe;
  862. }
  863.  
  864. /*  ZeigeBspielDaten - Zeigt die Beispielsdaten für das Demoprogramm.
  865.  *
  866.  *  Parameter: Keine
  867.  */
  868. void ZeigeBspielDaten()
  869. {
  870.     int  iCat, y, iFolge, iWert;
  871.     char szTmp[80];
  872.  
  873.     /* Daten in Tabellenform darstellen. */
  874.     _clearscreen( _GCLEARSCREEN );
  875.     AusgabePos( 1, 40 - strlen(szTmp) / 2, "Daten in Tabellenform", -1 );
  876.  
  877.     /* Titel schreiben und Trennlinie zeichnen. */
  878.     y = 3;
  879.     for( iCat = 1; iCat <= 12; iCat++ )
  880.     AusgabePos( y, iCat * 6, aMonate[iCat - 1], -1 );
  881.  
  882.     memset( szTmp, '-', 69 );
  883.     szTmp[69] = 0;
  884.     AusgabePos( ++y, 6, szTmp, -1 );
  885.  
  886.     /* Daten schreiben. */
  887.     for( iFolge = 1; iFolge <= 3; iFolge++ )
  888.     {
  889.      AusgabePos( y += 2, 4, aVerkaufTitel[iFolge - 1], -1 );
  890.         y += 2;
  891.         for( iWert = 1; iWert <= 12; iWert++ )
  892.         {
  893.          sprintf( szTmp, "%#3.2f", aVerkauf[iFolge - 1][iWert - 1] );
  894.          AusgabePos( y, iWert * 6, (char _far *)szTmp, -1 );
  895.         }
  896.     }
  897.     AusgabePos( y += 2, 4, TempTitel, -1 );
  898.     y += 2;
  899.     for( iWert = 1; iWert <= 12; iWert++ )
  900.     {
  901.         sprintf( szTmp, "%#3.1f", aTemperatur[iWert - 1] );
  902.      AusgabePos( y, iWert * 6, szTmp, -1 );
  903.     }
  904.  
  905.     AusgabePos( y += 2, 1, "Weiter mit beliebiger Taste . . .", -1 );
  906.     getche();
  907. }
  908.  
  909. /*  ZeigeTitelTyp - Zeigt Daten des Variablentyps "titletype".
  910.  *
  911.  *  Parameter: iReihe - Anfangsreihe
  912.  *          iSplt - Spalten einzurücken
  913.  *          derTitel - anzuzeigende Variable des Typs "titletype"
  914.  *
  915.  *  Ergibt: Nächste verfügbare Reihe
  916.  */
  917. int ZeigeTitelTyp( int iReihe, int iSplt, titletype derTitel )
  918. {
  919.     SAusgabePos( iReihe++, iSplt + 5, "char    .title[%d] = \"%s\"",
  920. _PG_TITLELEN,
  921.            derTitel.title );
  922.     SAusgabePos( iReihe++, iSplt + 5, "short  .titlecolor = %d",
  923. derTitel.titlecolor );
  924.     SAusgabePos( iReihe++, iSplt + 5, "short     .justify = %d",
  925. derTitel.justify );
  926.  
  927.     return iReihe;
  928. }
  929.  
  930. /*  ZeigeFensterTyp - Zeigt Daten des Variablentyps "windowtype".
  931.  *
  932.  *  Parameter: iReihe - Anfangsreihe
  933.  *          iSplt - Spalten einzurücken
  934.  *          dasFenster - anzuzeigende Variable des Typs "windowtype"
  935.  *
  936.  *  Ergibt: Nächste verfügbare Reihe
  937.  */
  938. int ZeigeFensterTyp( int iReihe, int iSplt, windowtype dasFenster )
  939. {
  940.     SAusgabePos( iReihe++, iSplt + 5, "short          .x1 = %d", dasFenster.x1
  941. );
  942.     SAusgabePos( iReihe++, iSplt + 5, "short          .y1 = %d", dasFenster.y1
  943. );
  944.     SAusgabePos( iReihe++, iSplt + 5, "short          .x2 = %d", dasFenster.x2
  945. );
  946.     SAusgabePos( iReihe++, iSplt + 5, "short          .y2 = %d", dasFenster.y2
  947. );
  948.     SAusgabePos( iReihe++, iSplt + 5, "short      .border = %d",
  949. dasFenster.border );
  950.     SAusgabePos( iReihe++, iSplt + 5, "short  .background = %d",
  951. dasFenster.background );
  952.     SAusgabePos( iReihe++, iSplt + 5, "short .borderstyle = %d",
  953. dasFenster.borderstyle );
  954.     SAusgabePos( iReihe++, iSplt + 5, "short .bordercolor = %d",
  955. dasFenster.bordercolor );
  956.  
  957.     return iReihe;
  958. }
  959.  
  960. /*  ZeigeFehler - Bringt Fehlermeldung für einen der Diagrammbibliotheks-
  961.  *  Fehler.
  962.  *
  963.  *  Parameter: iErr - Fehlernummer
  964.  */
  965. void ZeigeFehler( int iErr )
  966. {
  967.     char szTmp[50];
  968.  
  969.     /* Auf Textbildschirm wechseln.  */
  970.     _setvideomode( _DEFAULTMODE );
  971.  
  972.     /* Den Fehlertext wählen.  */
  973.     switch( iErr )
  974.     {
  975.         case _PG_NOTINITIALIZED:
  976.             strcpy( szTmp, "Diagrammbibliothek nicht initialisiert" );
  977.             break;
  978.         case _PG_BADSCREENMODE:
  979.             strcpy( szTmp, "Ungültiger Bildschirmmodus" );
  980.             break;
  981.         case _PG_BADCHARTTYPE:
  982.             strcpy( szTmp, "Ungültiger Diagrammtyp" );
  983.             break;
  984.         case _PG_BADCHARTSTYLE:
  985.             strcpy( szTmp, "Ungültiger Diagrammstil" );
  986.             break;
  987.         case _PG_BADLEGENDWINDOW:
  988.             strcpy( szTmp, "Ungültiges Beschriftungsfenster" );
  989.             break;
  990.         case _PG_BADDATAWINDOW:
  991.          strcpy( szTmp, "Kein Platz für Datenfenster" );
  992.             break;
  993.         case _PG_BADCHARTWINDOW:
  994.             strcpy( szTmp, "Ungültige Diagramm Fensterkoordinaten" );
  995.             break;
  996.         case _PG_NOMEMORY:
  997.             strcpy( szTmp, "Unzureichend Speicher für Daten-Datenfelder" );
  998.             break;
  999.         case _PG_BADLOGBASE:
  1000.             strcpy( szTmp, "Log-Basis X oder Y <= 0" );
  1001.             break;
  1002.         case _PG_BADSCALEFACTOR:
  1003.             strcpy( szTmp, "Skalenfaktor X oder Y = 0" );
  1004.             break;
  1005.         case _PG_TOOSMALLN:
  1006.             strcpy( szTmp, "Zu wenige Datenwerte" );
  1007.             break;
  1008.         case _PG_TOOFEWSERIES:
  1009.          strcpy( szTmp, "Es wurde keine Datenfolge bestimmt" );
  1010.             break;
  1011.         default:
  1012.             strcpy( szTmp, "Unbekannter Fehler" );
  1013.     }
  1014.  
  1015.     FehlerMldg( szTmp );
  1016. }
  1017.  
  1018. /*  DiagrammAnsicht - Zeichnet das gegenwärtige Diagramm.
  1019.  *
  1020.  *  Parameter: Keine
  1021.  */
  1022. int DiagrammAnsicht()
  1023. {
  1024.     int cWert, iWert, iFolge, iErr;
  1025.  
  1026.     /* Sich vergewissern, daß Daten vorliegen.  */
  1027.     if( cFolge <= 0 )
  1028.     {
  1029.      fDefault = WAHR;
  1030.      VorgabeDaten( ce.charttype, ce.chartstyle, FALSCH );
  1031.     }
  1032.  
  1033.     /* Die längste Folge finden.  */
  1034.     cWert = 0;
  1035.     for( iFolge = 0; iFolge < cFolge; iFolge++ )
  1036.      if( acFolge[iFolge] > cWert )
  1037.          cWert = acFolge[iFolge];
  1038.  
  1039.     _setvideomode( si.mode );
  1040.  
  1041.  
  1042.     /* Je nach Diagrammtyp verarbeiten.  */
  1043.     switch( ce.charttype )
  1044.     {
  1045.  
  1046.         case _PG_PIECHART:
  1047.         case _PG_BARCHART:
  1048.         case _PG_COLUMNCHART:
  1049.         case _PG_LINECHART:
  1050.  
  1051.          /* Daten initialisieren und Kreisdiagramm oder Einzelfolgen-
  1052.              * Balkendiagramm, Säulen- oder Liniendiagramm zeichnen.
  1053.              */
  1054.          if( (cFolge == 1) ||( ce.charttype == _PG_PIECHART) )
  1055.             {
  1056.  
  1057.                 /* Daten zu eindimensionalem Datenfeld übertragen.  */
  1058.                 for( iWert = 0; iWert < cWert; iWert++ )
  1059.                    axWert[iWert] = aWert[0][iWert];
  1060.  
  1061.                 /* Diagramm zeichnen.  */
  1062.                 if( ce.charttype == _PG_PIECHART )
  1063.                     iErr = _pg_chartpie( &ce, aCat, axWert,
  1064.                                          aExplode, cWert );
  1065.                 else
  1066.                     iErr = _pg_chart( &ce, aCat, axWert, cWert );
  1067.             }
  1068.          /* Wenn Mehrfachfolge, sind Daten in Ordnung;
  1069.           * dann einfach Diagramm zeichnen.
  1070.           */
  1071.             else
  1072.                 iErr = _pg_chartms( &ce, aCat, (float _far *)aWert,
  1073.                         cFolge, cWert, cWert, aFolgeName );
  1074.             break;
  1075.  
  1076.         case _PG_SCATTERCHART:
  1077.  
  1078.             /* Sich vergewissern, daß genug Datensets vorliegen.  */
  1079.          if( cFolge == 1 )
  1080.             {
  1081.                 _setvideomode( _DEFAULTMODE );
  1082.                 si.help = 10;
  1083.           FehlerMldg( "Zu wenig Wertdatenspalten für Streudiagramm." );
  1084.                 return 1;
  1085.  
  1086.             }
  1087.              /* Im Fall eines Einzelfolgen-Streudiagramms, Daten zu ein-
  1088.              * dimensionalen Datenfeldern übertragen, dann Diagrammaufruf
  1089.              * machen.
  1090.              */
  1091.          else if( cFolge == 2 )
  1092.             {
  1093.                 for( iWert = 0; iWert < cWert; iWert++ )
  1094.                 {
  1095.                     axWert[iWert] = aWert[0][iWert];
  1096.                     ayWert[iWert] = aWert[1][iWert];
  1097.                 }
  1098.           cFolge = 1;
  1099.                 iErr = _pg_chartscatter( &ce, axWert, ayWert, cWert );
  1100.  
  1101.             }
  1102.              /* Im Falle eines Mehrfachfolgen-Streudiagramms, ungerade
  1103.              * Spalten zur X-Achsen- und gerade zur Y-Achs-Datenfeld
  1104.              * übertragen; dann Diagrammaufruf machen.
  1105.              * chart call.
  1106.              */
  1107.             else
  1108.             {
  1109.  
  1110.           for( iFolge = 1; iFolge < cFolge; iFolge += 2 )
  1111.                 {
  1112.               aFolgeName[iFolge / 2] = aFolgeName[iFolge - 1];
  1113.                     for( iWert = 0; iWert < cWert; iWert++ )
  1114.                     {
  1115.                axWertMS[iFolge / 2][iWert] =
  1116.                    aWert[iFolge - 1][iWert];
  1117.                ayWertMS[iFolge / 2][iWert] =
  1118.                    aWert[iFolge][iWert];
  1119.                     }
  1120.                 }
  1121.           cFolge /= 2;
  1122.  
  1123.                 iErr = _pg_chartscatterms( &ce, (float _far *)axWertMS,
  1124.                                            (float _far *)ayWertMS,
  1125.                             cFolge, cWert, cWert,
  1126.                             aFolgeName );
  1127.             }
  1128.     }
  1129.  
  1130.     if( !fDefault )
  1131.      DatenLoeschen( FALSCH );
  1132.  
  1133.     /* Im Fall eines Fehlers, diesen zeigen, sonst mit Diagramm auf dem
  1134.      * Bildschirm auf das Drücken einer Taste warten.
  1135.      */
  1136.     if( iErr )
  1137.     {
  1138.      ZeigeFehler( iErr );
  1139.         return iErr;
  1140.     }
  1141.     else
  1142.         return ( getch() == ESCAPE );   /* ESCAPE bedeutet Abbruch der Demo */
  1143. }
  1144.  
  1145.