1
This commit is contained in:
Alex Yatskov 2014-07-28 16:48:24 +09:00
parent 696049aa76
commit 195a6a4043
5 changed files with 7 additions and 6 deletions

View File

@ -2,6 +2,7 @@
var app = { };
function outputResults(results, maxResults) {
$('#results').empty();
$('#count').text(results.length);
@ -51,14 +52,13 @@ function onSearch() {
app.hintSteps = params.hintSteps;
app.maxResults = params.maxResults;
app.grapher = new Grapher('grapher', new goog.math.Range(-1.0, 1.0), true, true);
app.grapher = new Grapher('grapher', app.searchRange, true, true);
app.grapher.setColumns(results.columns);
app.grapher.setValueChangedListener(onAdjust);
outputResults(results.items, params.maxResults);
$('#query').text(params.keyword);
$('#useLocalScale').click(function() {
var useLocalScale = $('#useLocalScale').is(':checked');
app.grapher.setUseLocalScale(useLocalScale);
@ -67,7 +67,6 @@ function onSearch() {
var useRelativeScale = $('#useRelativeScale').is(':checked');
app.grapher.setUseRelativeScale(useRelativeScale);
});
$('#input').fadeOut(function() {
$('#output').fadeIn();
});

View File

@ -543,7 +543,7 @@ function Grapher(canvas, range, useLocalScale, useRelativeScale) {
this.useLocalScale = useLocalScale;
this.useRelativeScale = useRelativeScale;
this.canvas = new fabric.StaticCanvas(canvas);
this.range = range;
this.range = new goog.math.Range(range.min, range.max);
this.padding = 10;
this.indexMap = {};
this.columns = [];

View File

@ -55,10 +55,10 @@
<div class="row" style="padding: 10px;">
<canvas id="grapher" width="500" height="550"></canvas><br>
<label class="checkbox-inline">
<input type="checkbox" id="useLocalScale" name="useLocalScale"> Use local scale
<input type="checkbox" id="useLocalScale" name="useLocalScale" checked="checked"> Use local scale
</label>
<label class="checkbox-inline">
<input type="checkbox" id="useRelativeScale" name="useRelativeScale"> Use relative scale
<input type="checkbox" id="useRelativeScale" name="useRelativeScale" checked="checked"> Use relative scale
</label>
</div>
</div>

View File

@ -4,6 +4,7 @@ var _ = require('underscore');
var db_keywords = require('./keywords.json');
var db_data = require('./data.json');
function innerProduct(values1, values2) {
var result = 0;

View File

@ -5,6 +5,7 @@
var express = require('express');
var search = require('./db/search.js');
function main() {
var app = express();