Team:Amsterdam/maarten/linechart
From 2012.igem.org
(Difference between revisions)
Line 5: | Line 5: | ||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> | ||
- | + | <script type="text/javascript"> | |
+ | function difEqPlot(m){ | ||
+ | f = function(t,x) { | ||
+ | return [m*(x[1]-x[0]), | ||
+ | x[0]*(28-x[2])-x[1], | ||
+ | x[0]*x[1]-(8/3)*x[2]]; | ||
+ | } | ||
+ | sol = numeric.dopri(0,20,[-1,3,4],f,1e-6,2000); | ||
+ | soly = numeric.transpose(sol.y); | ||
+ | |||
$(function () { | $(function () { | ||
var chart; | var chart; | ||
Line 17: | Line 26: | ||
}, | }, | ||
title: { | title: { | ||
- | text: ' | + | text: 'Testing Interactive Models', |
x: -20 //center | x: -20 //center | ||
}, | }, | ||
subtitle: { | subtitle: { | ||
- | text: 'Source: | + | text: 'Source: iGEM Amsterdam 2012', |
x: -20 | x: -20 | ||
}, | }, | ||
xAxis: { | xAxis: { | ||
- | + | title: { | |
- | ' | + | text: 'x-axis' |
+ | }, | ||
}, | }, | ||
yAxis: { | yAxis: { | ||
title: { | title: { | ||
- | text: ' | + | text: 'y-axis' |
}, | }, | ||
plotLines: [{ | plotLines: [{ | ||
Line 41: | Line 51: | ||
formatter: function() { | formatter: function() { | ||
return '<b>'+ this.series.name +'</b><br/>'+ | return '<b>'+ this.series.name +'</b><br/>'+ | ||
- | this.x +': '+ this.y +' | + | this.x +': '+ this.y +'�C'; |
} | } | ||
}, | }, | ||
Line 53: | Line 63: | ||
}, | }, | ||
series: [{ | series: [{ | ||
- | name: ' | + | name: 'Differential Equation 1', |
- | + | data: sol.y | |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | data: | + | |
- | + | ||
- | + | ||
- | + | ||
}] | }] | ||
}); | }); | ||
Line 69: | Line 71: | ||
}); | }); | ||
- | + | } | |
+ | </script> | ||
+ | <script type="text/javascript"> | ||
+ | difEqPlot(10) | ||
+ | </script> | ||
+ | <script type="text/javascript"> | ||
+ | function resubmitDifEqPlot(){ | ||
+ | m = document.myForm.myText.value | ||
+ | difEqPlot(m) | ||
+ | } | ||
+ | </script> | ||
</head> | </head> | ||
<body> | <body> | ||
+ | <form name="myForm"> | ||
+ | Please Enter a number and click the submit button<br> | ||
+ | <input type=TEXT value="10" name="myText"> | ||
+ | <input type=BUTTON value="Submit" name="mySubmit" onClick="resubmitDifEqPlot()"> | ||
+ | </form> | ||
<script src="http://code.highcharts.com/highcharts.js"></script> | <script src="http://code.highcharts.com/highcharts.js"></script> | ||
<script src="http://code.highcharts.com/modules/exporting.js"></script> | <script src="http://code.highcharts.com/modules/exporting.js"></script> |
Revision as of 19:20, 19 June 2012