Commit 2d8a575344cb3be1f3ebff465c21c8d70a81f960
1 parent
ed7cc33f
Exists in
master
and in
2 other branches
Make the Y-Axis of time series dynamic
Showing
3 changed files
with
19 additions
and
4 deletions
Show diff stats
CHANGELOG.md
1 | 1 | ## Nicolas |
2 | 2 | |
3 | 3 | - [ ] séries temporelles en échelle log ou linéaire |
4 | -- [ ] quant on zoome modifier l'échelle en Y afin qu'elle s'adapte aux valeurs maximales de l'intervalle du zoom | |
5 | 4 | - [ ] permettre à l'utilisateur de choisir inner heliosphere (jusqu'à mars) ou outer heliosphere (jusqu'à saturne) pour la visualisation des éphémérides planétaires |
6 | -- [ ] rajouter uranus et neptune comme planètes cibles | |
7 | 5 | - [ ] rajouter MAVEN, New Horizons, Cassini, Galileo, ExoMars comme spacecraft cible |
8 | 6 | - [ ] prévoir la possibilité à l'utilisateur d'afficher le temps en Day Of Year |
9 | 7 | - [ ] modifier le bandeau vertical d'affichage des choix utilisateurs pour qu'il soit plus petit (en particulier les champs paramètres) |
... | ... | @@ -23,13 +21,20 @@ |
23 | 21 | - [ ] Add a README to the download tarball |
24 | 22 | - [ ] Set the log level to _error_ in production (see `web/run.py`) |
25 | 23 | - [ ] CRON statements to call the cache cleanup and warmup |
26 | -- [ ] Give the future data another color | |
27 | 24 | - [ ] Rework the images of Rosetta and Juno |
28 | 25 | - [ ] Enable p67 |
26 | +- [ ] Enable Uranus | |
27 | +- [ ] Enable Neptune | |
29 | 28 | - [ ] Find a way to handle the huge amount of data files for Earth |
30 | 29 | |
31 | 30 | |
32 | 31 | |
32 | +## 1.0.0-rc7 | |
33 | + | |
34 | +- [ ] Give the future data another color | |
35 | +- [x] Make the Y-Axis of time series dynamic (at the expense of animations) | |
36 | + | |
37 | + | |
33 | 38 | ## 1.0.0-rc6 |
34 | 39 | |
35 | 40 | - [x] Re-lock Earth until we have better support | ... | ... |
web/static/js/swapp.js
... | ... | @@ -657,6 +657,14 @@ |
657 | 657 | stopDate = maxDate; |
658 | 658 | } |
659 | 659 | this.xScale.domain([startDate, stopDate]); |
660 | + this.yScale.domain(d3.extent(this.data, function(d){ | |
661 | + var ref$; | |
662 | + if (startDate <= (ref$ = d.x) && ref$ <= stopDate) { | |
663 | + return d.y; | |
664 | + } else { | |
665 | + return 0; | |
666 | + } | |
667 | + })); | |
660 | 668 | return this.applyZoom(); |
661 | 669 | }; |
662 | 670 | TimeSeries.prototype.resetZoom = function(){ | ... | ... |
web/static/js/swapp.ls
... | ... | @@ -8,7 +8,7 @@ |
8 | 8 | # $ lsc --watch --compile swapp.ls |
9 | 9 | |
10 | 10 | # All the "javascript" code is in this file, except for inline scripts in |
11 | -# templates, such as `home.html.jinja2`. | |
11 | +# templates, such as in `home.html.jinja2`. | |
12 | 12 | |
13 | 13 | # Note: We use Promises and ES6 whenever relevant. |
14 | 14 | # You also WILL NEED d3js v4 documentation : https://d3js.org/ |
... | ... | @@ -368,6 +368,7 @@ export class TimeSeries |
368 | 368 | console.info "Initializing plot of #{@}…" |
369 | 369 | |
370 | 370 | # pre-compute extents for performance when zooming |
371 | + # those are final and always hold the biggest extent | |
371 | 372 | @xDataExtent = d3.extent(@data, (d) -> d.x) |
372 | 373 | @yDataExtent = d3.extent(@data, (d) -> d.y) |
373 | 374 | if @options['started_at'] then @xDataExtent[0] = @options['started_at'] |
... | ... | @@ -589,6 +590,7 @@ export class TimeSeries |
589 | 590 | if startDate < minDate then startDate = minDate |
590 | 591 | if stopDate > maxDate then stopDate = maxDate |
591 | 592 | @xScale.domain([startDate, stopDate]) |
593 | + @yScale.domain(d3.extent(@data, (d) -> if startDate <= d.x <= stopDate then d.y else 0)) | |
592 | 594 | @applyZoom() |
593 | 595 | |
594 | 596 | resetZoom: -> | ... | ... |