1

More cleanup

This commit is contained in:
Alex Yatskov 2014-10-31 11:51:11 +09:00
parent 0abb488acd
commit 97d13f5e41
3 changed files with 49 additions and 46 deletions

View File

@ -14,39 +14,39 @@
</div> </div>
<!-- query input --> <!-- query input -->
<!-- <div id="input" class="form-horizontal"> --> <div id="input" class="form-horizontal">
<!-- <div class="form-group"> --> <div class="form-group">
<!-- <label for="keywordsToSearch" class="col-md-2 control-label">Keywords</label> --> <label for="keywordsToSearch" class="col-md-2 control-label">Keywords</label>
<!-- <div class="col-md-10"> --> <div class="col-md-10">
<!-- <select id="keywordsToSearch" class="form-control" multiple="multiple" data-max-options="4" data-live-search="data-live-search"></select> --> <select id="keywordsToSearch" class="form-control" multiple="multiple" data-max-options="4" data-live-search="data-live-search"></select>
<!-- </div> --> </div>
<!-- </div> --> </div>
<!-- <div class="form-group"> --> <div class="form-group">
<!-- <label for="minScore" class="col-md-2 control-label">Minimum score</label> --> <label for="minScore" class="col-md-2 control-label">Minimum score</label>
<!-- <div class="col-md-10"> --> <div class="col-md-10">
<!-- <input class="form-control" type="number" step="any" value="0.25" id="minScore"> --> <input class="form-control" type="number" step="any" value="0.25" id="minScore">
<!-- </div> --> </div>
<!-- </div> --> </div>
<!-- <div class="form-group"> --> <div class="form-group">
<!-- <label for="hintSteps" class="col-md-2 control-label">Hint steps</label> --> <label for="hintSteps" class="col-md-2 control-label">Hint steps</label>
<!-- <div class="col-md-10"> --> <div class="col-md-10">
<!-- <input class="form-control" type="number" value="20" id="hintSteps"> --> <input class="form-control" type="number" value="20" id="hintSteps">
<!-- </div> --> </div>
<!-- </div> --> </div>
<!-- <div class="form-group"> --> <div class="form-group">
<!-- <label for="maxResults" class="col-md-2 control-label">Max results</label> --> <label for="maxResults" class="col-md-2 control-label">Max results</label>
<!-- <div class="col-md-10"> --> <div class="col-md-10">
<!-- <input class="form-control" type="number" value="100" id="maxResults"> --> <input class="form-control" type="number" value="100" id="maxResults">
<!-- </div> --> </div>
<!-- </div> --> </div>
<!-- <div class="form-group"> --> <div class="form-group">
<!-- <div class="col-md-offset-2 col-md-10"> --> <div class="col-md-offset-2 col-md-10">
<!-- <button class="btn btn-primary" id="searchKeywords" type="button" disabled="disabled"> --> <button class="btn btn-primary" id="searchKeywords" type="button" disabled="disabled">
<!-- <span class="glyphicon glyphicon-search"></span> Search --> <span class="glyphicon glyphicon-search"></span> Search
<!-- </button> --> </button>
<!-- </div> --> </div>
<!-- </div> --> </div>
<!-- </div> --> </div>
<!-- options dialog --> <!-- options dialog -->
<div class="modal fade" id="optionsDialog" tabindex="-1"> <div class="modal fade" id="optionsDialog" tabindex="-1">
@ -130,9 +130,6 @@
</symbol> </symbol>
<use xlink:href="#graph" x="0" y="0"/> <use xlink:href="#graph" x="0" y="0"/>
<use xlink:href="#graph" x="110" y="0"/>
<use xlink:href="#graph" x="220" y="0"/>
<use xlink:href="#graph" x="330" y="0"/>
</svg> </svg>
<!-- query output --> <!-- query output -->

View File

@ -48,7 +48,7 @@
} }
function onSearch() { function onSearch() {
var keywords = $('#keywordsToSearch').val() || []; var keywords = $('#keywordsToSearch').val() || [];
var searchParams = {}; var searchParams = {};
for (var i = 0, count = keywords.length; i < count; ++i) { for (var i = 0, count = keywords.length; i < count; ++i) {
@ -70,7 +70,13 @@
ctx.hintSteps = query.hintSteps; ctx.hintSteps = query.hintSteps;
ctx.maxResults = query.maxResults; ctx.maxResults = query.maxResults;
ctx.grapher = new grapher.Grapher('grapher', ctx.searchRange, 150, true, true); ctx.grapher = new grapher.Grapher({
canvas: null,
columnRange: ctx.searchRange,
columnWidth: 150,
useLocalScale: true,
useRelativeScale: true
});
ctx.grapher.setColumns(results.columns); ctx.grapher.setColumns(results.columns);
ctx.grapher.setValueChangedListener(onAdjust); ctx.grapher.setValueChangedListener(onAdjust);
@ -86,9 +92,9 @@
var useRelativeScale = $('#useRelativeScale').is(':checked'); var useRelativeScale = $('#useRelativeScale').is(':checked');
ctx.grapher.setUseRelativeScale(useRelativeScale); ctx.grapher.setUseRelativeScale(useRelativeScale);
}); });
$('#input').fadeOut(function() { // $('#input').fadeOut(function() {
$('#output').fadeIn(); // $('#output').fadeIn();
}); // });
}); });
} }

View File

@ -238,7 +238,7 @@
for (var name in columns) { for (var name in columns) {
var data = columns[name]; var data = columns[name];
if (useLocalScale) { if (useLocalScale) {
scale = this.computeLocalScale(column.hints); scale = this.computeLocalScale(data.hints);
} }
var column = this.columns[name]; var column = this.columns[name];
@ -246,13 +246,13 @@
column.update(data, scale); column.update(data, scale);
} }
else { else {
this.columns.push(new Column({ this.columns[name] = new Column({
canvas: this.canvas, canvas: this.canvas,
data: column, data: column,
name: name, name: name,
range: this.range, range: this.range,
scale: scale, scale: scale,
})); });
} }
} }
}; };
@ -300,9 +300,9 @@
this.canvas = params.canvas; this.canvas = params.canvas;
this.columnData = null; this.columnData = null;
this.columnPadding = 10; this.columnPadding = params.columnPadding || 10;
this.columnRange = new Range(-1.0, 1.0); this.columnRange = new Range(-1.0, 1.0);
this.columnWidth = 100; this.columnWidth = params.columnWidth || 100;
this.columns = {}; this.columns = {};
this.useLocalScale = params.useLocalScale || true; this.useLocalScale = params.useLocalScale || true;
this.useRelativeScale = params.useRelativeScale || true; this.useRelativeScale = params.useRelativeScale || true;