danielkrizian / rChartsDygraphs

An `rCharts` extension. Run `dygraphs` from R - interactive visualizations of time series using JavaScript and HTML canvas. See: http://dygraphs.com/ and
http://rcharts.io/
9 stars 10 forks source link

time in UTC tz format #27

Open jangorecki opened 10 years ago

jangorecki commented 10 years ago

It looks like Dygraphs uses local time when plotting, which often will be confusing. Google brings me to: http://stackoverflow.com/questions/24196183/dygraph-showing-dates-in-an-arbitrary-timezone/24196184#24196184 Do we have possibility to use it in rChartsDygraphs? If not, let treat it as future feature request.

danielkrizian commented 10 years ago

Quick fix on the JS level is:

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

Credit: https://github.com/danielkrizian/dygraphs/issues/16

Prototypically speaking, rough rCharts wrapper equivalent would be to pass the following list viasetOpts and rCharts object will JSONize it:

axes = list(x=list(valueFormatter="#!
    function(ms) {
      var date = new Date(ms);
      return date.toLocaleDateString();
    }
    !#"))`

Away from my usual workspace, so apologies for syntax inaccuracies.