Namespacing grapher and utilities
This commit is contained in:
parent
bf0faad5ed
commit
797005c9a5
@ -49,7 +49,7 @@
|
||||
ctx.hintSteps = query.hintSteps;
|
||||
ctx.maxResults = query.maxResults;
|
||||
|
||||
ctx.grapher = new Grapher('grapher', ctx.searchRange, 150, true, true);
|
||||
ctx.grapher = new grapher.Grapher('grapher', ctx.searchRange, 150, true, true);
|
||||
ctx.grapher.setColumns(results.columns);
|
||||
ctx.grapher.setValueChangedListener(onAdjust);
|
||||
|
||||
|
@ -1,21 +1,22 @@
|
||||
'use strict';
|
||||
|
||||
|
||||
//
|
||||
// Coord
|
||||
//
|
||||
(function(grapher) {
|
||||
//
|
||||
// Coord
|
||||
//
|
||||
|
||||
function Coord(x, y) {
|
||||
function Coord(x, y) {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Rect
|
||||
//
|
||||
//
|
||||
// Rect
|
||||
//
|
||||
|
||||
function Rect(left, top, width, height) {
|
||||
function Rect(left, top, width, height) {
|
||||
this.left = left;
|
||||
this.top = top;
|
||||
this.width = width;
|
||||
@ -41,14 +42,14 @@ function Rect(left, top, width, height) {
|
||||
|
||||
return new Rect(left, top, right - left, bottom - top);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Range
|
||||
//
|
||||
//
|
||||
// Range
|
||||
//
|
||||
|
||||
function Range(start, end) {
|
||||
function Range(start, end) {
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
|
||||
@ -71,14 +72,14 @@ function Range(start, end) {
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Column
|
||||
//
|
||||
//
|
||||
// Column
|
||||
//
|
||||
|
||||
function Column(canvas, name, params, scale, range, bounds) {
|
||||
function Column(canvas, name, params, scale, range, bounds) {
|
||||
this.clearShapes = function() {
|
||||
_.each(this.shapes, function(shape) {
|
||||
this.canvas.remove(shape);
|
||||
@ -453,14 +454,14 @@ function Column(canvas, name, params, scale, range, bounds) {
|
||||
this.state = this.State.NORMAL;
|
||||
|
||||
this.updateShapes(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Grapher
|
||||
//
|
||||
//
|
||||
// Grapher
|
||||
//
|
||||
|
||||
function Grapher(canvas, range, columnWidth, useLocalScale, useRelativeScale) {
|
||||
grapher.Grapher = function(canvas, range, columnWidth, useLocalScale, useRelativeScale) {
|
||||
this.setColumns = function(columns) {
|
||||
this.clearColumns();
|
||||
|
||||
@ -660,4 +661,5 @@ function Grapher(canvas, range, columnWidth, useLocalScale, useRelativeScale) {
|
||||
c.addEventListener('mouseout', this.mouseOut, false);
|
||||
c.addEventListener('dblclick', this.mouseDoubleClick, false);
|
||||
c.grapher = this;
|
||||
}
|
||||
}
|
||||
}(window.grapher = window.grapher || {}));
|
||||
|
Loading…
Reference in New Issue
Block a user