diff --git a/web/static/js/swapp.js b/web/static/js/swapp.js index f074095..2e61df8 100644 --- a/web/static/js/swapp.js +++ b/web/static/js/swapp.js @@ -250,7 +250,7 @@ } TimeSeries.prototype.init = function(){ var dx, this$ = this; - console.info("Initializing time series " + this.title + " of " + this.target + "..."); + console.info("Initializing time series " + this.title + " of " + this.target.name + "..."); this.margin = { top: 30, right: 20, @@ -296,7 +296,7 @@ height = GOLDEN_RATIO * GOLDEN_RATIO * GOLDEN_RATIO * GOLDEN_RATIO * width; this.plotWidth = width; this.plotHeight = height; - console.log("Resizing time series " + this.title + " of " + this.target + ": " + width + " x " + height); + console.log("Resizing time series " + this.title + " of " + this.target.name + ": " + width + " x " + height); this.xScale.range([0, width]); this.yScale.range([height, 0]); this.svg.attr('width', width + this.margin.right + this.margin.left).attr('height', height + this.margin.top + this.margin.bottom); @@ -419,7 +419,7 @@ this.yAxisTitle.attr('transform', 'rotate(-90)'); this.sun = this.plotWrapper.append("svg:image").attr('xlink:href', this.options.sun.img).attr('width', '32px').attr('height', '32px'); this.sun.append('svg:title').text("Sol"); - $(this.svg.node).hide(); + $(this.svg.node()).hide(); return this.resize(); }; Orbits.prototype.orbitersElements = {}; @@ -451,7 +451,7 @@ orbit_line: orbit_line }; this.resize(); - $(this.svg.node).show(); + $(this.svg.node()).show(); return this; }; Orbits.prototype.resize = function(){ diff --git a/web/static/js/swapp.ls b/web/static/js/swapp.ls index f04e557..bf272f9 100644 --- a/web/static/js/swapp.ls +++ b/web/static/js/swapp.ls @@ -187,12 +187,12 @@ export class TimeSeries (@parameter, @title, @target, @data, @active, @container, @options = {}) -> # parameter : slug of the parameter to observe, like magn or pdyn # title : string - # target : slug of the target, like jupiter or tchouri + # target : target object like described in configuration # data : list of {x: , y: } @init() init: -> - console.info "Initializing time series #{@title} of #{@target}..." + console.info "Initializing time series #{@title} of #{@target.name}..." @margin = { top: 30, @@ -234,6 +234,10 @@ export class TimeSeries .on("mouseout", @onMouseOut) .on("mousemove", @onMouseMove) +# @plotWrapper.append("g") +# .attr("class", "brush") +# .call(d3.brush().on("brush", @onBrushEnd)); + @plotWrapper.append('g').classed('x axis', true) @plotWrapper.append('g').classed('y axis', true) @yAxisText = @plotWrapper.append("text") @@ -285,7 +289,7 @@ export class TimeSeries @plotWidth = width @plotHeight = height - console.log("Resizing time series #{@title} of #{@target}: #{width} x #{height}") + console.log("Resizing time series #{@title} of #{@target.name}: #{width} x #{height}") @xScale.range([0, width]); @yScale.range([height, 0]); @@ -324,6 +328,7 @@ export class TimeSeries resizeDomain: (started_at, stopped_at) -> # fixme +# d3.behavior.zoom() onMouseMove: ~> x = @xScale.invert(d3.mouse(@mouseCanvas.node())[0]) @@ -344,6 +349,18 @@ export class TimeSeries else @hideCursor() +# onBrushEnd: ~> +# s = d3.event.selection +# console.info("on brush end", s) +# if not s +# @xScale.domain(d3.extent(@data, (d) -> d.x)).nice() +# @yScale.domain(d3.extent(@data, (d) -> d.y)).nice() +# else +# console.info "brush end", s +# @xScale.domain([s[0][0], s[1][0]].map(x.invert, x)) +# @yScale.domain([s[1][1], s[0][1]].map(y.invert, y)) +# scatter.select(".brush").call(brush.move, null) + showCursor: -> @focus.style("display", null) @@ -445,7 +462,7 @@ export class Orbits .attr('width', '32px').attr('height', '32px') @sun.append('svg:title').text("Sol") - $(@svg.node).hide(); # we'll show it later when there'll be data + $(@svg.node()).hide(); # we'll show it later when there'll be data @resize() orbitersElements: {} @@ -484,7 +501,7 @@ export class Orbits @resize() - $(@svg.node).show(); + $(@svg.node()).show(); this -- libgit2 0.21.2