Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

137 lines (132 sloc) 4.222 kb
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript" src="./underscore.min.js"></script>
<script type="text/javascript" src="./raphael-min.js"></script>
<script type="text/javascript" src="./g.raphael.js"></script>
<script type="text/javascript" src="./g.line.js"></script>
<script type="text/javascript" src="./app.js"></script>
<style type="text/css">
#holder {
padding-left: 10px
width: 900px;
height: 600px;
}
#results {
width: 300px;
height: 200px;
}
</style>
<script type="text/template" id="rowTemplate">
<tr>
<td><input type='input' class='xin' value='<%= x %>'/></td>
<td><input type='input' class='yin' value='<%= y %>'/></td>
<td><a href='#' class='remove'>X</a></td>
</tr>
</script>
<script type="text/template" class="dataTemplate" data-language="javascript">
[
<% _.each(data, function(row) { %>
[<%= row[0] %>, [<% _.each(row[1], function(v) { %><%= v %>, <% }) %>]],
<% }) %>
]
</script>
<script type="text/template" class="dataTemplate" data-language="objectivec">
<% var index = 0; %>
<% var coefficients = _.map(_.range(data.length), function(num) { return "coef" + num }); %>
<% _.each(data, function(row) { %>
<%= "NSArray *" + coefficients[index] + " = " + "[NSArray arrayWithObjects:\n" +
" [NSNumber numberWithFloat:" + row[0] + "],\n" +
" [NSArray arrayWithObjects:\n" +
_.map(row[1], function(num) {
return " [NSNumber numberWithFloat:" + num + "]";
}).join(",\n").concat(", nil], nil];") %>
<% index++; %>
<% }) %>
<%= "NSArray *coefficients = [NSArray arrayWithObjects:" + coefficients.join(", ").concat(", nil];") %>
</script>
</head>
<body>
<h1>Natural cubic spline</h1>
<div id="holder"></div>
<div style="float: left">
<h1>Points</h1>
<table width="200px">
<thead>
<tr>
<th align="left">X</th>
<th align="left">Y</th>
<th></th>
</tr>
</thead>
<tbody id="values">
<tr>
<td><input type="text" class="xin"/></td>
<td><input type="text" class="yin"/></td>
<td><a href="#" class="remove">X</a></td>
</tr>
<tr>
<td><input type="text" class="xin"/></td>
<td><input type="text" class="yin"/></td>
<td><a href="#" class="remove">X</a></td>
</tr>
<tr>
<td><input type="text" class="xin"/></td>
<td><input type="text" class="yin"/></td>
<td><a href="#" class="remove">X</a></td>
</tr>
<tr>
<td><input type="text" class="xin"/></td>
<td><input type="text" class="yin"/></td>
<td><a href="#" class="remove">X</a></td>
</tr>
</tbody>
<tbody>
<tr>
<td colspan="2">
<button id="moar">MOAR</button>
</td>
</tr>
</tbody>
</table>
</div>
<div style="float: left">
<h1>Graph</h1>
<table width="200px">
<thead>
<tr>
<th></th>
<th align="left">X</th>
<th align="left">Y</th>
</tr>
</thead>
<tbody id="ranges">
<tr>
<th>min</th>
<td><input type="text" id="xmin"/></td>
<td><input type="text" id="ymin"/></td>
</tr>
<tr>
<th>max</th>
<td><input type="text" id="xmax"/></td>
<td><input type="text" id="ymax"/></td>
</tr>
</tbody>
</table>
</div>
<div style="float: left">
<h1>Results</h1>
<select id="language">
<option value="javascript" selected="selected">JavaScript</option>
<option value="objectivec">Objective-C</option>
</select>
<p>
See the spline_interp function in app.js for sample code to use
this array.
</p>
<textarea id="results">
</textarea>
</div>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.