Team:TU-Eindhoven/Template:UseGraphs

From 2013.igem.org

(Difference between revisions)
(Created page with "<html> <script src="https://2013.igem.org/Team:TU-Eindhoven/JS:Flot?action=raw&ctype=text/js"></script> <script> $(function() { var d1 = []; for (var i = 0; i < 14; i += 0.5...")
 
(25 intermediate revisions not shown)
Line 1: Line 1:
<html>
<html>
-
<script src="https://2013.igem.org/Team:TU-Eindhoven/JS:Flot?action=raw&ctype=text/js"></script>
 
<script>
<script>
-
$(function() {
+
function loadGraphLibrary(){
 +
  $.getScript('https://2013.igem.org/Team:TU-Eindhoven/JS:Flot?action=raw&ctype=text/js', function(data, textStatus){
 +
          $.getScript('https://2013.igem.org/Team:TU-Eindhoven/Data:</html>{{{data}}}<html>?action=raw&ctype=text/js', function(data2, textStatus2){
 +
                var data = [];
 +
                choiceContainer = $('#graph_value_select');
 +
                $.each(datasets, function(key, val) {
 +
choiceContainer.append("<option value='" + key +
 +
"'>" + val.label + "</option>");
 +
});
-
var d1 = [];
+
                $('#graph_value_select').change(plotAccordingToChoices);
-
for (var i = 0; i < 14; i += 0.5) {
+
-
d1.push([i, Math.sin(i)]);
+
-
}
+
-
var d2 = [[0, 3], [4, 8], [8, 5], [9, 13]];
+
function plotAccordingToChoices() {
-
// A null signifies separate line segments
+
var data = [];
 +
                        var select_value = $('#graph_value_select').val();
 +
                        $.each(datasets[select_value].series, function(key, val) {
 +
    data.push(datasets[select_value].series[key]);
 +
                        });
-
var d3 = [[0, 12], [7, 12], null, [7, 2.5], [12, 2.5]];
+
if (data.length > 0) {
-
 
+
$.plot("#placeholder", data, {
-
$.plot("#placeholder", [ d1, d2, d3 ]);
+
yaxis: {
 +
min: 0,
 +
                                                max: 5
 +
},
 +
xaxis: {
 +
tickDecimals: 0
 +
}
 +
});
 +
}
 +
}
 +
                plotAccordingToChoices();
 +
                $('#graph_xlabel').html(graphoptions.xlabel);
 +
                $('#graph_xlabel').show();
 +
                $('#graph_ylabel').html(graphoptions.ylabel);
 +
                $('#graph_ylabel').show();
});
});
 +
    });
 +
}
</script>
</script>
</html>
</html>

Latest revision as of 13:02, 17 August 2013