1

Getting rid of relative scale because it was not very interesting

This commit is contained in:
Alex Yatskov 2015-03-22 12:10:53 +09:00
parent f782040328
commit 46dcda4060
3 changed files with 17 additions and 34 deletions

View File

@ -65,10 +65,7 @@
</select> </select>
</div> </div>
<div class="checkbox"> <div class="checkbox">
<label><input type="checkbox" id="useLocalScale" checked="checked">Use local scale</label> <label><input type="checkbox" id="useLocalScale">Use local scale</label>
</div>
<div class="checkbox">
<label><input type="checkbox" id="useRelativeScale" checked="checked">Use relative scale</label>
</div> </div>
<button type="button" data-toggle="modal" data-target="#profileDlg" class="btn btn-primary">Edit personal profile</button> <button type="button" data-toggle="modal" data-target="#profileDlg" class="btn btn-primary">Edit personal profile</button>
</div> </div>

View File

@ -304,15 +304,14 @@
// //
grapher.Grapher = function(params) { grapher.Grapher = function(params) {
var _canvas = params.canvas; var _canvas = params.canvas;
var _columns = {}; var _columns = {};
var _data = {}; var _data = {};
var _range = new Range(params.range.min || -1.0, params.range.max || 1.0); var _range = new Range(params.range.min || -1.0, params.range.max || 1.0);
var _steps = params.steps || 20; var _steps = params.steps || 20;
var _useLocalScale = params.useLocalScale || true; var _useLocalScale = params.useLocalScale || false;
var _useRelativeScale = params.useRelativeScale || true; var _displayType = params.displayType || 'density';
var _displayType = params.displayType || 'density'; var _onValueChanged = params.onValueChanged;
var _onValueChanged = params.onValueChanged;
function processHintParameters(columns) { function processHintParameters(columns) {
var displayTypes = {compatibility: 'compatibility', density: 'count'}; var displayTypes = {compatibility: 'compatibility', density: 'count'};
@ -331,12 +330,7 @@
return hint.rating; return hint.rating;
}); });
var min = 0; return new Range(0, _.max(ratings));
if (_useRelativeScale) {
min = _.min(ratings);
}
return new Range(min, _.max(ratings));
} }
function computeGlobalScale(columnsData) { function computeGlobalScale(columnsData) {
@ -357,7 +351,7 @@
this.setColumns = function(columnsData) { this.setColumns = function(columnsData) {
processHintParameters(columnsData); processHintParameters(columnsData);
var scale = 0; var scale = null;
if (!_useLocalScale) { if (!_useLocalScale) {
scale = computeGlobalScale(columnsData); scale = computeGlobalScale(columnsData);
} }
@ -395,13 +389,6 @@
} }
}; };
this.setUseRelativeScale = function(useRelativeScale) {
if (useRelativeScale != _useRelativeScale) {
_useRelativeScale = useRelativeScale;
this.setColumns(_data);
}
};
this.setDisplayType = function(displayType) { this.setDisplayType = function(displayType) {
if (displayType != _displayType) { if (displayType != _displayType) {
_displayType = displayType; _displayType = displayType;

View File

@ -81,13 +81,12 @@
$.getJSON('/query', _ctx.query, function(results) { $.getJSON('/query', _ctx.query, function(results) {
if (!_.has(_ctx, 'grapher')) { if (!_.has(_ctx, 'grapher')) {
_ctx.grapher = new grapher.Grapher({ _ctx.grapher = new grapher.Grapher({
canvas: new Snap('#svg'), canvas: new Snap('#svg'),
steps: _ctx.query.hintSteps, steps: _ctx.query.hintSteps,
range: _ctx.query.range, range: _ctx.query.range,
onValueChanged: onAdjust, onValueChanged: onAdjust,
displayType: $('#displayType').val(), displayType: $('#displayType').val(),
useLocalScale: $('#useLocalScale').is(':checked'), useLocalScale: $('#useLocalScale').is(':checked')
useRelativeScale: $('#useRelativeScale').is(':checked')
}); });
$('#useLocalScale').click(function() { $('#useLocalScale').click(function() {