DeV1doR,
код как пример ... в целом нуждается в оптимизации и структурировании
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title></title>
<style type="text/css">
div {
float: left;
width: 33%;
height: 100%;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/adapters/standalone-framework.js"></script>
<script type="text/javascript">
var Q, D, T, AIR, AF, AW;
var AR = new Array(8);
function myFunctionCPT(q,d) {
D = d;
Q = q;
var arr = [];
for (T = -800; T < 1601; T += 400) {
AIR = [0.238785488, -0.00900857881, 0.0193221258, 0.132711466, -0.190166916, 0.10379398, -0.0258490883, 0.00245365952];
AF = [0.367102859, 0.384334584, 0.190633867, -0.361766882, 0.263417998, -0.112618047, 0.0257271586, -0.00237417234];
AW = [0.4700077, -0.3206047, 1.196138, 1.728544, 1.55052, -0.8291961, 0.237057, -0.02773743];
for (var i = 0; i < 8; i++) {
AR[i] = (AIR[i] + Q * AF[i] + D * AW[i]) / (1 + Q + D);
}
R = T / 1000;
CPTA = 94 * Q / (1 + Q + D);
B = R * (AR[0] + R * (AR[1] / 2 + R * (AR[2] / 3 + R * (AR[3] / 4 + R * (AR[4] / 5 + R * (AR[5] / 6 + R * (AR[6] / 7 + R * AR[7] / 8)))))));
CPT = CPTA + B * 1000;
arr.push(CPT);
document.getElementById('show').innerHTML += 'CPT: ' + CPT.toFixed(3) + ' T : ' + T + 'K' + '<br>' + '<br>'; //document.write();
}
return {
data: arr,
name: 'd=' + D + '; q=' + Q,
type: 'spline'
}
}
var series = [];
function plotGraph(form) {
var q = +form.q.value, d = +form.d.value ;
form.q.value = '';
form.d.value = '';
series.push(myFunctionCPT(q,d));
$('#CPT-T').highcharts({
title: {
text: 'График CPT-T'
},
xAxis: {
categories: [-800, -400, 0, 400, 800, 1200, 1600]
},
series: series
});
return false
}
</script>
</head>
<body>
<form action="http://" onsubmit="return plotGraph(this)">
<label><input name="q">q</label>
<label><input name="d">d</label>
<input type="submit" value="ok" />
</form>
<div id="CPT-T"></div>
<div id="show"></div>
</body>
</html>