summaryrefslogtreecommitdiff
path: root/Volta/Resources/graph.html
blob: 49902a01ad977aa255c0a3baa0f42c79c3767db6 (plain)
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
87
88
89
90
91
92
93
94
95
96
97
98

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>Stats Graph</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
    <meta name="format-detection" content="telephone=no">
	<script language="javascript" type="text/javascript" src="jquery.js"></script>
	<script language="javascript" type="text/javascript" src="jquery.flot.js"></script>
    <script language="javascript" type="text/javascript" src="jquery.flot.categories.js"></script>
    <script language="javascript" type="text/javascript" src="jquery.flot.axislabels.js"></script>

    <style type="text/css">

        body {
            width: 320px;
        }
        
        #content {
            margin: 0 auto;
        }

        .demo-container {
            /* width: 1000px; */
            height: 200px;
            background: #fff;
            background: linear-gradient(#f6f6f6 0, #fff 50px);
            background: -o-linear-gradient(#f6f6f6 0, #fff 50px);
            background: -ms-linear-gradient(#f6f6f6 0, #fff 50px);
            background: -moz-linear-gradient(#f6f6f6 0, #fff 50px);
            background: -webkit-linear-gradient(#f6f6f6 0, #fff 50px);
        }

        .demo-placeholder {
            width: 100%;
            height: 100%;
            font-size: 14px;
            line-height: 1.2em;
        }

        .axisLabels {
            color: rgb(84, 84, 84) !important;
        }

        .y2axisLabel {
            margin-left: 6px !important;
        }

            //]]>
            </style>

        <script type="text/javascript">

            function dollarFormatter(v, axis) {
                return v.toFixed(2) + " $";
            }

            function plotData(seriesA, seriesB)
            {
                $("div.demo-container").css("width", seriesA.length*30);
                
                $.plot("#placeholder",
                       [
                        { data: seriesA, label: "kWh" },
                        { data: seriesB, label: "Cost ($)", yaxis: 2 },
                        ],
                       {
                       series: {
                            lines: { show: true },
                            points: { show: true }
                       },

                       xaxes: [ { mode: "categories" } ],
                       yaxes: [ {
                               min: 0,
                               axisLabel: 'kWh'
//                               ,tickFormatter: function(val, axis) { return val < axis.max ? val.toFixed(0) : "kWh<br />" + val.toFixed(0);}
                               }, {
                               alignTicksWithAxis: 1,
                               position: "right",
                               tickFormatter: dollarFormatter,
                               axisLabel: 'Cost ($)'
                               } ],
                        legend: { position: "sw" }
                       });
            }

            </script>
</head>
<body>
	<div id="content">
		<div class="demo-container">
			<div id="placeholder" class="demo-placeholder"></div>
		</div>
	</div>
</body>
</html>