danielkrizian / dygraphs

Interactive visualizations of time series using JavaScript and the HTML canvas tag. Issue tracker at http://code.google.com/p/dygraphs/issues/list
http://dygraphs.com
MIT License
3 stars 1 forks source link

Daylight saving shifts timestamp labels by 1 hour (for summer months) #16

Closed danielkrizian closed 10 years ago

danielkrizian commented 10 years ago

Daylight saving shifts timestamp labels by 1 hour in summer months. Eliminate this shift.

It is evident in any demo.

See legend label (fixed of floating): image

Whereas for winter months this is alright: image

For higher time resolutions, also x-axis labels are affected (shifted by 1 hour) too. See https://github.com/danielkrizian/rChartsDygraphs/issues/7

TODO: Remove 01:00 label in the legend and in the x-axis (for hourly or higher resolutions)

przmv commented 10 years ago

The quick fix is to add the value formatter to options:

"axes": {
  "x": {
    "valueFormatter": function(ms) {
      var date = new Date(ms);
      return date.toLocaleDateString();
    }
  }
}