1 /*
2  *  This file is part of XForms.
3  *
4  *  XForms is free software; you can redistribute it and/or modify it
5  *  under the terms of the GNU Lesser General Public License as
6  *  published by the Free Software Foundation; either version 2.1, or
7  *  (at your option) any later version.
8  *
9  *  XForms is distributed in the hope that it will be useful, but
10  *  WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  *  Lesser General Public License for more details.
13  *
14  *  You should have received a copy of the GNU Lesser General Public
15  *  License along with XForms; see the file COPYING.  If not, write to
16  *  the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
17  *  MA 02111-1307, USA.
18  */
19 
20 
21 /*
22  * Showing all different charts
23  *
24  *  This file is part of xforms package
25  *  M. Overmars and T.C. Zhao   (1997)
26  */
27 
28 
29 #ifdef HAVE_CONFIG_H
30 #include "config.h"
31 #endif
32 
33 #include "include/forms.h"
34 
35 
36 FL_FORM *form;
37 
38 FL_OBJECT *barchart,
39           *linechart,
40           *filledchart,
41           *piechart,
42           *specialpiechart,
43           *exitbut,
44           *horbarchart,
45           *spikechart;
46 
47 
48 void create_form_form( void );
49 
50 
51 /***************************************
52  ***************************************/
53 
54 void
fill_in(FL_OBJECT * ob)55 fill_in( FL_OBJECT * ob )
56 {
57    int c = FL_BLACK;
58 
59    fl_add_chart_value( ob, 15.0, "item 1", ++c );
60    fl_add_chart_value( ob,  5.0, "item 2", ++c );
61    fl_add_chart_value( ob,  0.0, "item 3", ++c );
62    fl_add_chart_value( ob, -10., "item 4", ++c );
63    fl_add_chart_value( ob, 25.0, "item 5", ++c );
64    fl_add_chart_value( ob, 12.0, "item 6", ++c );
65 }
66 
67 
68 /***************************************
69  ***************************************/
70 
71 int
main(int argc,char * argv[])72 main( int    argc,
73       char * argv[ ] )
74 {
75 
76    fl_initialize( &argc, argv, "FormDemo", 0, 0 );
77 
78    create_form_form( );
79    fill_in( barchart );
80    fill_in( horbarchart );
81    fill_in( linechart );
82    fl_set_object_helper( linechart, "A LineChart" );
83    fill_in( filledchart );
84    fill_in( spikechart );
85    fill_in( piechart );
86    fill_in( specialpiechart );
87 
88    fl_show_form( form, FL_PLACE_CENTER, FL_TRANSIENT, "Charts" );
89 
90    fl_do_forms( );
91 
92    fl_finish( );
93    return 0;
94 }
95 
96 
97 /***************************************
98  ***************************************/
99 
100 void
create_form_form(void)101 create_form_form( void )
102 {
103     FL_OBJECT *obj;
104 
105     form = fl_bgn_form( FL_NO_BOX, 940, 360 );
106 
107     fl_add_box( FL_UP_BOX, 0, 0, 940, 360, "" );
108 
109     barchart = obj = fl_add_chart( FL_BAR_CHART, 20, 20, 210, 140,
110                                    "BAR_CHART" );
111     fl_set_object_boxtype( obj, FL_RSHADOW_BOX );
112 
113     linechart = obj = fl_add_chart( FL_LINE_CHART, 250, 20, 210, 140,
114                                     "LINE_CHART" );
115     fl_set_object_boxtype( obj, FL_RSHADOW_BOX );
116 
117     filledchart = obj = fl_add_chart( FL_FILLED_CHART, 250, 190, 210, 140,
118                                       "FILLED_CHART" );
119     fl_set_object_boxtype( obj ,FL_RSHADOW_BOX );
120 
121     piechart = obj = fl_add_chart( FL_PIE_CHART, 480, 190, 210, 140,
122                                    "PIE_CHART" );
123     fl_set_object_boxtype( obj, FL_RSHADOW_BOX );
124 
125     specialpiechart = obj = fl_add_chart( FL_SPECIALPIE_CHART,
126                                           710, 20, 210, 140,
127                                           "SPECIALPIE_CHART" );
128     fl_set_object_boxtype( obj, FL_RSHADOW_BOX );
129 
130     horbarchart = obj = fl_add_chart( FL_HORBAR_CHART, 20, 190, 210, 140,
131                                       "HORBAR_CHART" );
132     fl_set_object_boxtype( obj, FL_RSHADOW_BOX );
133 
134     spikechart = obj = fl_add_chart( FL_SPIKE_CHART, 480, 20, 210, 140,
135                                      "SPIKE_CHART" );
136     fl_set_object_boxtype( obj, FL_RSHADOW_BOX );
137 
138     exitbut = fl_add_button( FL_NORMAL_BUTTON, 750, 260, 140, 30, "Exit" );
139 
140     fl_end_form( );
141 }
142 
143 
144 /*
145  * Local variables:
146  * tab-width: 4
147  * indent-tabs-mode: nil
148  * End:
149  */
150