-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraph_route.php
86 lines (70 loc) · 2.25 KB
/
graph_route.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
<?php
/**
Ride Stats - Statistics system for non-competitive associations.
Copyright (C) 2008 - Iván Sánchez Luque
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Own code starts here
include ('source/connect.php');
global $DB_PREFIX;
$con = connect();
$res = mysql_query(" SELECT value
FROM " . $DB_PREFIX . "_settings
WHERE name = 'current_track'
");
$row= mysql_fetch_array($res);
$track_table = $row['value'];
$res = mysql_query(" SELECT pointID, alt
FROM " . $track_table);
mysql_close($con);
$cn2 = 0;
$points = 50; //points in graph
$max = 0;
$p = mysql_num_rows($res)/$points;
while ($row = mysql_fetch_array($res))
{
if (($cn2 % $p) == 0)
{
$data[] = $row['alt'];
}
if ($max < $row['alt'])
$max = $row['alt'];
$cn2++;
}
$data[] = 'null';
for ($n=0; $n < $max; $n+=200);
$max = $n;
// use the chart class to build the chart:
include_once( 'ofc-library/open-flash-chart.php' );
$g = new graph();
$g->line( 2, '#2222BB');
// Title
$g->title( 'Perfil Ruta ', '{font-size: 18px; color: #FFFFFF}' );
//Set style
$g->bg_colour = '#44607e';
//$g->set_x_label_style( 14, '#FFFFFF', 2 );
$g->set_y_label_style( 14, '#FFFFFF');
$g->set_y_legend( 'Metros', 12, '#FFFFFF' );
$g->x_axis_colour( '#D0D0D0', '#808080' );
$g->y_axis_colour( '#D0D0D0', '#808080' );
$g->set_inner_background( '#999999', '#888888', 90 );
$g->set_data( $data );
$g->set_x_axis_steps( 10 );
// label each point with its value
//$g->set_x_labels( array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec' ) );
// set the Y max
$g->set_y_max( $max );
// label every 20 (0,20,40,60)
$g->y_label_steps( 5 );
// display the data
echo $g->render();
?>