-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstockgraph.php
79 lines (73 loc) · 1.86 KB
/
stockgraph.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
<?php
INCLUDE 'rot/connect/base.php';
date_default_timezone_set('Europe/Oslo');
$sth = mysql_query("SELECT UNIX_TIMESTAMP(date) as date, value FROM portefoljeverdi");
$rows = array();
while($r = mysql_fetch_assoc($sth)) {
$verdi=($r['value']/100000);
$verdi = ($verdi-1)*1000;
$verdi = $verdi+100;
//$verdi = 100+$verdi*10;
$dato=$r['date'];
//$dato->add(new DateInterval('P1D'));
$dato *= 1000;
$data[] = "[$dato, $verdi]";
}
/*$fp = fopen('results.json', 'w');
fwrite($fp, json_encode($data));
fclose($fp); */
?>
<script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js'></script>
<script type='text/javascript'>
$(function() {
// Create the chart
Highcharts.setOptions({
global: {
useUTC: false
},
lang: {
months: ['Januar', 'Februar', 'Mars', 'April', 'Mai', 'Juni',
'Juli', 'August', 'September', 'Oktober', 'November', 'Desember'],
weekdays: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag']
}
});
window.chart = new Highcharts.StockChart({
chart: {
renderTo: 'container',
height: 300
},
xAxis: {
minTickInterval: 24 * 3600 * 1000
},
rangeSelector: {
enabled: false,
inputEnabled: false
},
exporting: {
enabled: false
},
credits: {
enabled: false
},
title: {
text: 'Veldedighetsfondet'
},
subtitle: {
text: 'Utvikling i %'
},
scrollbar: {
enabled: false
},
series: [{
name: 'Fondsverdi (%)',
data: [<?php //echo join($data, ',') ?> 100],
tooltip: {
valueDecimals: 2
}
}]
});
});
</script>
<script src='http://code.highcharts.com/stock/highstock.js'></script>
<script src='http://code.highcharts.com/stock/modules/exporting.js'></script>
<div id='container'></div>