1

Fixing bug in computing result density.

This commit is contained in:
Alex Yatskov 2015-04-18 18:52:37 +09:00
parent 54a912cac3
commit 8e30a32b1c
2 changed files with 15 additions and 16 deletions

View File

@ -95,7 +95,6 @@
var _onValueChanged = params.onValueChanged; var _onValueChanged = params.onValueChanged;
var _range = params.range; var _range = params.range;
var _scale = params.scale; var _scale = params.scale;
var _steps = params.steps;
var _elements = {}; var _elements = {};
function createShapes() { function createShapes() {
@ -194,10 +193,12 @@
} }
function groupHints() { function groupHints() {
var stepSize = _range.length() / _steps;
var hintGroups = []; var hintGroups = [];
for (var i = 0; i < _steps; ++i) {
var stepCount = _data.hints.length;
if (stepCount > 0) {
var stepSize = _range.length() / stepCount;
for (var i = 0; i < stepCount; ++i) {
var stepMax = _range.max - stepSize * i; var stepMax = _range.max - stepSize * i;
var stepMin = stepMax - stepSize; var stepMin = stepMax - stepSize;
@ -211,6 +212,7 @@
hintGroups.push(hintValue); hintGroups.push(hintValue);
} }
}
return hintGroups; return hintGroups;
} }
@ -308,7 +310,6 @@
var _columns = {}; var _columns = {};
var _data = {}; var _data = {};
var _range = new Range(-1.0, 1.0); var _range = new Range(-1.0, 1.0);
var _steps = params.steps || 20;
var _useLocalScale = params.useLocalScale || false; var _useLocalScale = params.useLocalScale || false;
var _displayType = params.displayType || 'density'; var _displayType = params.displayType || 'density';
var _onValueChanged = params.onValueChanged; var _onValueChanged = params.onValueChanged;
@ -370,7 +371,6 @@
else { else {
_columns[name] = new Column({ _columns[name] = new Column({
onValueChanged: _onValueChanged, onValueChanged: _onValueChanged,
steps: _steps,
range: _range, range: _range,
canvas: _canvas, canvas: _canvas,
data: columnData, data: columnData,

View File

@ -97,7 +97,6 @@
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,
onValueChanged: onAdjust, onValueChanged: onAdjust,
displayType: $('#displayType').val(), displayType: $('#displayType').val(),
useLocalScale: $('#useLocalScale').is(':checked') useLocalScale: $('#useLocalScale').is(':checked')