Last active
February 7, 2017 06:47
-
-
Save cmstead/53f684144a13d4d1b213c06c32594570 to your computer and use it in GitHub Desktop.
User view for simple stats API example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<body> | |
<input type="text" value="" name="sample" id="sample" /> | |
<button id="compute">Compute Mean and Standard Deviation</button> | |
<h4>Mean:</h4> | |
<p id="mean">0</p> | |
<h4>Standard Deviation:</h4> | |
<p id="standard-deviation">0</p> | |
<script src="./stats-api.js"></script> | |
<script src="./view-helper.js"></script> | |
<script src="../simple-ui-test-runner.js"></script> | |
<script src="../extended-simple-ui-test-runner.js"></script> | |
<script> | |
var meanOutput = document.getElementById('mean'); | |
var standardDeviationOutput = document.getElementById('standard-deviation'); | |
var sampleInput = document.getElementById('sample'); | |
document.getElementById('compute').addEventListener('click', function () { | |
var values = viewHelper.parseNumberValues(sampleInput.value); | |
meanOutput.innerText = statsApi.getMean(values); | |
standardDeviationOutput.innerText = statsApi.getStandardDeviation(values); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment