diff options
author | pommicket <leonardomtenenbaum@gmail.com> | 2016-10-16 16:04:51 -0400 |
---|---|---|
committer | pommicket <leonardomtenenbaum@gmail.com> | 2016-10-16 16:04:51 -0400 |
commit | db20c66b3634e43049e1339ce8a0d51ee5944780 (patch) | |
tree | a385bbda8eaaa0bd38570a2924325945824e1385 /js | |
parent | 9b477c4c5d298ae32cb10a3be947b5525348324b (diff) |
Added legend to RPN
Diffstat (limited to 'js')
-rw-r--r-- | js/complexfunctions.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/js/complexfunctions.js b/js/complexfunctions.js index f71c23b..9703b5d 100644 --- a/js/complexfunctions.js +++ b/js/complexfunctions.js @@ -79,7 +79,7 @@ function draw() function makeCanvas(w, h) { - $("#canvas").html(); + $("#canvas").html(""); var canvas = createCanvas(w, h); canvas.parent("canvas"); domainPoints = []; @@ -104,8 +104,14 @@ $(function() animating = false; var funcs = $("#function").val().split(","); colors = []; + $("#legend").html(""); for (var i = 0; i < funcs.length; i++) + { colors.push([Math.random() * 255, Math.random() * 255, Math.random() * 255]); + $("#legend").append("<div><span style='display: inline-block; background: rgb(" + + Math.floor(colors[i][0]) + ", " + Math.floor(colors[i][1]) + ", " + Math.floor(colors[i][2]) + + "); width: 10px; height: 10px;'></span> " + funcs[i] + "</div>"); + } drawFuncs(funcs); }); $(".form-control").keydown(function(e) |