Commit a8ce269bda5df4dc83ef6e29456f086e774b917c
1 parent
696037b4
Exists in
master
and in
2 other branches
Force time display to be UTC (whatever the user's locale is)
Showing
2 changed files
with
22 additions
and
22 deletions
Show diff stats
web/static/js/swapp.js
... | ... | @@ -183,7 +183,7 @@ |
183 | 183 | return d3.csv(url, function(csv){ |
184 | 184 | var timeFormat, data; |
185 | 185 | console.debug("Requested CSV for " + target_slug + "…", csv); |
186 | - timeFormat = d3.timeParse('%Y-%m-%dT%H:%M:%S%Z'); | |
186 | + timeFormat = d3.utcParse('%Y-%m-%dT%H:%M:%S%Z'); | |
187 | 187 | data = { |
188 | 188 | 'hee': [] |
189 | 189 | }; |
... | ... | @@ -497,16 +497,16 @@ |
497 | 497 | bottom: 30, |
498 | 498 | left: 80 |
499 | 499 | }; |
500 | - this.xScale = d3.scaleTime().domain(this.xDataExtent); | |
500 | + this.xScale = d3.scaleUtc().domain(this.xDataExtent); | |
501 | 501 | this.yScale = d3.scaleLinear().domain(this.yDataExtent); |
502 | - formatMillisecond = d3.timeFormat(".%L"); | |
503 | - formatSecond = d3.timeFormat(":%S"); | |
504 | - formatMinute = d3.timeFormat("%H:%M"); | |
505 | - formatHour = d3.timeFormat("%H:%M"); | |
506 | - formatDay = d3.timeFormat("%a %d"); | |
507 | - formatWeek = d3.timeFormat("%b %d"); | |
508 | - formatMonth = d3.timeFormat("%B"); | |
509 | - formatYear = d3.timeFormat("%Y"); | |
502 | + formatMillisecond = d3.utcFormat(".%L"); | |
503 | + formatSecond = d3.utcFormat(":%S"); | |
504 | + formatMinute = d3.utcFormat("%H:%M"); | |
505 | + formatHour = d3.utcFormat("%H:%M"); | |
506 | + formatDay = d3.utcFormat("%a %d"); | |
507 | + formatWeek = d3.utcFormat("%b %d"); | |
508 | + formatMonth = d3.utcFormat("%B"); | |
509 | + formatYear = d3.utcFormat("%Y"); | |
510 | 510 | multiFormat = function(date){ |
511 | 511 | if (date > d3.timeSecond(date)) { |
512 | 512 | return formatMillisecond(date); |
... | ... | @@ -721,7 +721,7 @@ |
721 | 721 | TimeSeries.prototype.bisectDate = d3.bisector(function(d){ |
722 | 722 | return d.x; |
723 | 723 | }).left; |
724 | - TimeSeries.prototype.timeFormat = d3.timeFormat("%Y-%m-%d %H:%M"); | |
724 | + TimeSeries.prototype.timeFormat = d3.utcFormat("%Y-%m-%d %H:%M"); | |
725 | 725 | TimeSeries.prototype.moveCursor = function(x0){ |
726 | 726 | var i, d0, d1, d, xx, yy, mirrored, dx, transform; |
727 | 727 | i = this.bisectDate(this.data, x0, 1); | ... | ... |
web/static/js/swapp.ls
... | ... | @@ -159,7 +159,7 @@ https://gitlab.irap.omp.eu/CDPP/SPACEWEATHERONLINE |
159 | 159 | url = sw.buildDataUrlForTarget(target_slug, started_at, stopped_at) |
160 | 160 | d3.csv(url, (csv) -> |
161 | 161 | console.debug("Requested CSV for #{target_slug}…", csv) |
162 | - timeFormat = d3.timeParse('%Y-%m-%dT%H:%M:%S%Z') | |
162 | + timeFormat = d3.utcParse('%Y-%m-%dT%H:%M:%S%Z') | |
163 | 163 | data = { 'hee': [] } |
164 | 164 | configuration['parameters'].forEach((parameter) -> |
165 | 165 | data[parameter['id']] = [] |
... | ... | @@ -384,19 +384,19 @@ export class TimeSeries |
384 | 384 | left: 80 |
385 | 385 | } |
386 | 386 | |
387 | - @xScale = d3.scaleTime().domain(@xDataExtent) | |
387 | + @xScale = d3.scaleUtc().domain(@xDataExtent) | |
388 | 388 | @yScale = d3.scaleLinear().domain(@yDataExtent) |
389 | 389 | # Domain on a log scale MUST NOT cross zero |
390 | 390 | # @yScale = d3.scaleLog().domain(@yDataExtent) |
391 | 391 | |
392 | - formatMillisecond = d3.timeFormat(".%L") | |
393 | - formatSecond = d3.timeFormat(":%S") | |
394 | - formatMinute = d3.timeFormat("%H:%M") | |
395 | - formatHour = d3.timeFormat("%H:%M") | |
396 | - formatDay = d3.timeFormat("%a %d") | |
397 | - formatWeek = d3.timeFormat("%b %d") | |
398 | - formatMonth = d3.timeFormat("%B") | |
399 | - formatYear = d3.timeFormat("%Y") | |
392 | + formatMillisecond = d3.utcFormat(".%L") | |
393 | + formatSecond = d3.utcFormat(":%S") | |
394 | + formatMinute = d3.utcFormat("%H:%M") | |
395 | + formatHour = d3.utcFormat("%H:%M") | |
396 | + formatDay = d3.utcFormat("%a %d") | |
397 | + formatWeek = d3.utcFormat("%b %d") | |
398 | + formatMonth = d3.utcFormat("%B") | |
399 | + formatYear = d3.utcFormat("%Y") | |
400 | 400 | |
401 | 401 | multiFormat = (date) -> |
402 | 402 | if date > d3.timeSecond(date) then return formatMillisecond(date) |
... | ... | @@ -645,7 +645,7 @@ export class TimeSeries |
645 | 645 | @focus.style("display", "none") |
646 | 646 | |
647 | 647 | bisectDate: d3.bisector((d) -> d.x).left # /!\ complex |
648 | - timeFormat: d3.timeFormat("%Y-%m-%d %H:%M") | |
648 | + timeFormat: d3.utcFormat("%Y-%m-%d %H:%M") | |
649 | 649 | |
650 | 650 | moveCursor: (x0) -> |
651 | 651 | i = @bisectDate(@data, x0, 1) | ... | ... |