@@ -122,103 +122,3 @@ function monthName($month, $short = 0)
122122 ),
123123);
124124
125- $ chartCount = 0 ;
126- foreach ($ systemstats as $ item ) {
127- ++$ chartCount ;
128- if (!isset ($ item ['range ' ])) {
129- $ item ['range ' ] = 'month ' ;
130- }
131- if (!isset ($ item ['collate ' ])) {
132- $ item ['collate ' ] = false ;
133- }
134-
135- $ req = Sql_Query ($ item ['query ' ]);
136- $ ls = new WebblerListing ('' );
137- $ chartData = array ();
138- $ collation = 0 ;
139- while ($ row = Sql_Fetch_Assoc ($ req )) {
140- if (!isset ($ chartData [$ row ['year ' ]]) || !is_array ($ chartData [$ row ['year ' ]])) {
141- $ chartData [$ row ['year ' ]] = array ();
142- }
143- if ($ item ['collate ' ]) {
144- $ collation = $ collation + $ row ['num ' ];
145- $ row ['num ' ] = $ collation ;
146- }
147- if ($ item ['range ' ] != 'year ' ) {
148- $ ls ->addElement ($ row ['year ' ].' ' .monthName ($ row ['month ' ]));
149- $ ls ->addColumn ($ row ['year ' ].' ' .monthName ($ row ['month ' ]), '# ' , $ row ['num ' ]);
150- $ chartData [$ row ['year ' ]][$ row ['month ' ]] = $ row ['num ' ];
151- } else {
152- $ ls ->addElement ($ row ['year ' ]);
153- $ ls ->addColumn ($ row ['year ' ], '# ' , $ row ['num ' ]);
154- $ chartData [$ row ['year ' ]]['' ] = $ row ['num ' ];
155- }
156- if (!empty ($ row ['year ' ]) && !empty ($ row ['month ' ]) && !empty ($ row ['num ' ])) {
157- cl_output ($ item ['name ' ].'| ' .$ row ['year ' ].'| ' .$ row ['month ' ].'| ' .$ row ['num ' ]);
158- }
159- }
160-
161- unset($ chartData ['2000 ' ]);
162- unset($ chartData ['2001 ' ]);
163- unset($ chartData ['2002 ' ]);
164- unset($ chartData ['2003 ' ]);
165- unset($ chartData ['2004 ' ]);
166- unset($ chartData ['2005 ' ]);
167- unset($ chartData ['2006 ' ]);
168- //unset($chartData['2007']);
169- //unset($chartData['2008']);
170- //unset($chartData['2009']);
171- //unset($chartData['2011']);
172-
173- //var_dump($chartData);
174- if (class_exists ('gBarChart ' )) {
175- $ Chart = new gBarChart (800 , 350 );
176- $ max = 0 ;
177- $ min = 99999 ;
178- $ nummonths = 0 ;
179- $ chartData = array_reverse ($ chartData , true );
180- foreach ($ chartData as $ year => $ months ) {
181- /*
182- print "<h3>$year</h3>";
183- var_dump($months);
184- */
185- ksort ($ months );
186- $ Chart ->addDataSet (array_values ($ months ));
187- $ monthmax = $ util ->getMaxOfArray ($ months );
188- if ($ monthmax > $ max ) {
189- $ max = $ monthmax ;
190- }
191- $ nummonths = count ($ months );
192- }
193- $ Chart ->setLegend (array_keys ($ chartData ));
194- //$Chart->setBarWidth(4,1,3);
195- $ Chart ->setAutoBarWidth ();
196- $ Chart ->setColors (array ('ff3344 ' , '11ff11 ' , '22aacc ' , '3333aa ' ));
197- $ Chart ->setVisibleAxes (array ('x ' , 'y ' ));
198- $ Chart ->setDataRange (0 , $ max );
199- $ Chart ->addAxisRange (0 , 1 , $ nummonths );
200- $ Chart ->addAxisRange (1 , 0 , $ max );
201- //$lineChart->addBackgroundFill('bg', 'EFEFEF');
202- //$lineChart->addBackgroundFill('c', '000000');
203- }
204-
205- echo '<div class="tabbed"> ' ;
206- echo '<h3> ' .$ GLOBALS ['I18N ' ]->get ($ item ['name ' ]).'</h3> ' ;
207- if (!empty ($ Chart )) {
208- echo '<ul> ' ;
209- echo '<li><a href="#graph ' .$ chartCount .'">Graph</a></li> ' ;
210- echo '<li><a href="#numbers ' .$ chartCount .'">Numbers</a></li> ' ;
211- echo '</ul> ' ;
212- }
213-
214- if (!empty ($ Chart )) {
215- echo '<div id="graph ' .$ chartCount .'"> ' ;
216- // print $Chart->getUrl();
217- echo '<img src="./?page=gchart&url= ' .urlencode ($ Chart ->getUrl ()).'" /> ' ;
218- echo '</div> ' ;
219- }
220- echo '<div id="numbers ' .$ chartCount .'"> ' ;
221- echo $ ls ->display ();
222- echo '</div> ' ;
223- echo '</div> ' ;
224- }
0 commit comments