-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplotter.js
More file actions
26 lines (23 loc) · 693 Bytes
/
Copy pathplotter.js
File metadata and controls
26 lines (23 loc) · 693 Bytes
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
var parameters = {
target: '#myFunction',
data: [{
fn: 'sin(x)',
color: 'red'
}],
grid: true,
yAxis: {domain: [-1, 1]},
xAxis: {domain: [0, 2*Math.PI]}
};
function plot() {
var f = document.querySelector("#function").value;
var xMin = document.querySelector("#xMin").value;
var xMax = document.querySelector("#xMax").value;
var yMin = document.querySelector("#yMin").value;
var yMax = document.querySelector("#yMax").value;
var color = document.querySelector("#color").value;
parameters.data[0].fn = f;
parameters.xAxis.domain = [xMin, xMax];
parameters.yAxis.domain = [yMin, yMax];
parameters.data[0].color = color;
functionPlot(parameters);
}