forked from benaskins/simplegraph
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 875255a
Showing
6 changed files
with
5,630 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
1. Clone it | ||
2. Open index.html to see an example | ||
3. Look at js/sample.js to see how it's done | ||
4. Look at js/simplegraph.js for tweakability | ||
5. $$$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
<?xml version='1.0' encoding='utf-8' ?> | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html> | ||
<head> | ||
<title>Title of page › Category if there is one › Site name here: site description</title> | ||
<script src="js/vendor/jquery.js" type="text/javascript"></script> | ||
<script src="js/vendor/raphael.js" type="text/javascript"></script> | ||
<script src="js/simplegraph.js" type="text/javascript"></script> | ||
<script src="js/sample.js" type="text/javascript"></script> | ||
</head> | ||
<body> | ||
<div id='canvas'> | ||
<h3>Temperature in 7 days</h3> | ||
<div id='temp-data'> | ||
<table cellspacing='0' class='graph' summary='Temperature in 7 days'> | ||
<caption>Temperature in 7 days</caption> | ||
<tfoot> | ||
<tr></tr> | ||
<th> | ||
Wednesday | ||
17 Dec | ||
</th> | ||
<th> | ||
Thursday | ||
18 Dec | ||
</th> | ||
<th> | ||
Friday | ||
19 Dec | ||
</th> | ||
<th> | ||
Saturday | ||
20 Dec | ||
</th> | ||
<th> | ||
Sunday | ||
21 Dec | ||
</th> | ||
<th> | ||
Monday | ||
22 Dec | ||
</th> | ||
<th> | ||
Tuesday | ||
23 Dec | ||
</th> | ||
</tfoot> | ||
<tbody> | ||
<tr></tr> | ||
<td>25</td> | ||
<td>23</td> | ||
<td>23</td> | ||
<td>28</td> | ||
<td>28</td> | ||
<td>22</td> | ||
<td>25</td> | ||
</tbody> | ||
</table> | ||
</div> | ||
<div id='temp_graph_holder'></div> | ||
|
||
<h3>Rain in 7 days</h3> | ||
<div id='rain-data'> | ||
<table cellspacing='0' class='graph' summary='Rain in 7 days'> | ||
<caption>Rain in 7 days</caption> | ||
<tfoot> | ||
<tr></tr> | ||
<th> | ||
Wednesday | ||
17 Dec | ||
</th> | ||
<th> | ||
Thursday | ||
18 Dec | ||
</th> | ||
<th> | ||
Friday | ||
19 Dec | ||
</th> | ||
<th> | ||
Saturday | ||
20 Dec | ||
</th> | ||
<th> | ||
Sunday | ||
21 Dec | ||
</th> | ||
<th> | ||
Monday | ||
22 Dec | ||
</th> | ||
<th> | ||
Tuesday | ||
23 Dec | ||
</th> | ||
</tfoot> | ||
<tbody> | ||
<tr></tr> | ||
<td>5</td> | ||
<td>0</td> | ||
<td>0</td> | ||
<td>5</td> | ||
<td>0</td> | ||
<td>0</td> | ||
<td>0</td> | ||
</tbody> | ||
</table> | ||
</div> | ||
<div id='rain_graph_holder'></div> | ||
|
||
<h3>Combined Graph</h3> | ||
<div></div> | ||
<div id='combined_graph_holder'></div> | ||
|
||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
window.onload = function () { | ||
|
||
// Get the data | ||
var temp_labels = [], temp_data = []; | ||
$("#temp-data tfoot th").each(function () { | ||
temp_labels.push($(this).html()); | ||
}); | ||
$("#temp-data tbody td").each(function () { | ||
temp_data.push($(this).html()); | ||
}); | ||
var rain_labels = [], rain_data = []; | ||
$("#rain-data tfoot th").each(function () { | ||
rain_labels.push($(this).html()); | ||
}); | ||
$("#rain-data tbody td").each(function () { | ||
rain_data.push($(this).html()); | ||
}); | ||
|
||
// Hide the data | ||
$("#rain-data").hide(); | ||
$("#temp-data").hide(); | ||
|
||
// Plot the data | ||
// - Temperature Graph | ||
var temp_graph = new SimpleGraph("temp_graph_holder", {lineColor: "#f00", pointColor: "#f00", fillUnderLine: true, fillColor: "#f00"}); | ||
temp_graph.drawGrid(temp_labels, temp_data, 30); | ||
temp_graph.addYAxisLabels(0, "Max Temp (ºC)"); | ||
temp_graph.plot(temp_labels, temp_data, "ºC"); | ||
// - Rain Graph | ||
var rain_graph = new SimpleGraph("rain_graph_holder", {lineColor: "#00f", pointColor: "#00f"}); | ||
rain_graph.drawGrid(rain_labels, rain_data, 10); | ||
rain_graph.addYAxisLabels(0, "Max Rainfall (mm)"); | ||
rain_graph.plot(rain_labels, rain_data, "mm"); | ||
// - Combined Graph | ||
var combined_graph = new SimpleGraph("combined_graph_holder", {lineColor: "#f00", pointColor: "#f00"}); | ||
combined_graph.drawGrid(temp_labels, temp_data, 30); | ||
combined_graph.addYAxisLabels(0, "Max Temp (ºC)"); | ||
combined_graph.plot(temp_labels, temp_data, "ºC"); | ||
combined_graph.changeYAxis(rain_labels, rain_data, 10); | ||
combined_graph.settings.lineColor = "#00f"; | ||
combined_graph.settings.pointColor = "#00f"; | ||
combined_graph.addYAxisLabels(30, "Max Rainfall (mm)"); | ||
combined_graph.plot(rain_labels, rain_data, "mm"); | ||
|
||
|
||
}; |
Oops, something went wrong.