Commit 3ee0b596953a5e2dce3ea3cf485643ed8539e456

Authored by Goutte
1 parent 8cb213b9

Fix an annoying bug that cost me a thorough debugging.

Showing 2 changed files with 26 additions and 9 deletions   Show diff stats
web/static/js/swapp.js
... ... @@ -250,7 +250,7 @@
250 250 }
251 251 TimeSeries.prototype.init = function(){
252 252 var dx, this$ = this;
253   - console.info("Initializing time series " + this.title + " of " + this.target + "...");
  253 + console.info("Initializing time series " + this.title + " of " + this.target.name + "...");
254 254 this.margin = {
255 255 top: 30,
256 256 right: 20,
... ... @@ -296,7 +296,7 @@
296 296 height = GOLDEN_RATIO * GOLDEN_RATIO * GOLDEN_RATIO * GOLDEN_RATIO * width;
297 297 this.plotWidth = width;
298 298 this.plotHeight = height;
299   - console.log("Resizing time series " + this.title + " of " + this.target + ": " + width + " x " + height);
  299 + console.log("Resizing time series " + this.title + " of " + this.target.name + ": " + width + " x " + height);
300 300 this.xScale.range([0, width]);
301 301 this.yScale.range([height, 0]);
302 302 this.svg.attr('width', width + this.margin.right + this.margin.left).attr('height', height + this.margin.top + this.margin.bottom);
... ... @@ -419,7 +419,7 @@
419 419 this.yAxisTitle.attr('transform', 'rotate(-90)');
420 420 this.sun = this.plotWrapper.append("svg:image").attr('xlink:href', this.options.sun.img).attr('width', '32px').attr('height', '32px');
421 421 this.sun.append('svg:title').text("Sol");
422   - $(this.svg.node).hide();
  422 + $(this.svg.node()).hide();
423 423 return this.resize();
424 424 };
425 425 Orbits.prototype.orbitersElements = {};
... ... @@ -451,7 +451,7 @@
451 451 orbit_line: orbit_line
452 452 };
453 453 this.resize();
454   - $(this.svg.node).show();
  454 + $(this.svg.node()).show();
455 455 return this;
456 456 };
457 457 Orbits.prototype.resize = function(){
... ...
web/static/js/swapp.ls
... ... @@ -187,12 +187,12 @@ export class TimeSeries
187 187 (@parameter, @title, @target, @data, @active, @container, @options = {}) ->
188 188 # parameter : slug of the parameter to observe, like magn or pdyn
189 189 # title : string
190   - # target : slug of the target, like jupiter or tchouri
  190 + # target : target object like described in configuration
191 191 # data : list of {x: <datetime>, y: <float>}
192 192 @init()
193 193  
194 194 init: ->
195   - console.info "Initializing time series #{@title} of #{@target}..."
  195 + console.info "Initializing time series #{@title} of #{@target.name}..."
196 196  
197 197 @margin = {
198 198 top: 30,
... ... @@ -234,6 +234,10 @@ export class TimeSeries
234 234 .on("mouseout", @onMouseOut)
235 235 .on("mousemove", @onMouseMove)
236 236  
  237 +# @plotWrapper.append("g")
  238 +# .attr("class", "brush")
  239 +# .call(d3.brush().on("brush", @onBrushEnd));
  240 +
237 241 @plotWrapper.append('g').classed('x axis', true)
238 242 @plotWrapper.append('g').classed('y axis', true)
239 243 @yAxisText = @plotWrapper.append("text")
... ... @@ -285,7 +289,7 @@ export class TimeSeries
285 289 @plotWidth = width
286 290 @plotHeight = height
287 291  
288   - console.log("Resizing time series #{@title} of #{@target}: #{width} x #{height}")
  292 + console.log("Resizing time series #{@title} of #{@target.name}: #{width} x #{height}")
289 293  
290 294 @xScale.range([0, width]);
291 295 @yScale.range([height, 0]);
... ... @@ -324,6 +328,7 @@ export class TimeSeries
324 328  
325 329 resizeDomain: (started_at, stopped_at) ->
326 330 # fixme
  331 +# d3.behavior.zoom()
327 332  
328 333 onMouseMove: ~>
329 334 x = @xScale.invert(d3.mouse(@mouseCanvas.node())[0])
... ... @@ -344,6 +349,18 @@ export class TimeSeries
344 349 else
345 350 @hideCursor()
346 351  
  352 +# onBrushEnd: ~>
  353 +# s = d3.event.selection
  354 +# console.info("on brush end", s)
  355 +# if not s
  356 +# @xScale.domain(d3.extent(@data, (d) -> d.x)).nice()
  357 +# @yScale.domain(d3.extent(@data, (d) -> d.y)).nice()
  358 +# else
  359 +# console.info "brush end", s
  360 +# @xScale.domain([s[0][0], s[1][0]].map(x.invert, x))
  361 +# @yScale.domain([s[1][1], s[0][1]].map(y.invert, y))
  362 +# scatter.select(".brush").call(brush.move, null)
  363 +
347 364 showCursor: ->
348 365 @focus.style("display", null)
349 366  
... ... @@ -445,7 +462,7 @@ export class Orbits
445 462 .attr('width', '32px').attr('height', '32px')
446 463 @sun.append('svg:title').text("Sol")
447 464  
448   - $(@svg.node).hide(); # we'll show it later when there'll be data
  465 + $(@svg.node()).hide(); # we'll show it later when there'll be data
449 466 @resize()
450 467  
451 468 orbitersElements: {}
... ... @@ -484,7 +501,7 @@ export class Orbits
484 501  
485 502 @resize()
486 503  
487   - $(@svg.node).show();
  504 + $(@svg.node()).show();
488 505  
489 506 this
490 507  
... ...