danvk / dygraphs

Interactive visualizations of time series using JavaScript and the HTML canvas tag
http://dygraphs.com
Other
3.17k stars 605 forks source link

Fractional second handling (millisecond time) #654

Closed kuna-matata closed 8 years ago

kuna-matata commented 9 years ago

The following three threads discuss handling millisecond time. I got the data to display with R library(dygraphs), but dygraphs.js appears to truncate or round the data to the nearest second. Please consider adding support (or describe how) to resolve fractional seconds.

TonyDIRL commented 9 years ago

This would be something I'd also be very interested to have answered.

danvk commented 9 years ago

Here's a repro: http://jsfiddle.net/eM2Mg/7082/

The chart is displayed fine, you just lose the milliseconds in the axis labels and legend.

kuna-matata commented 9 years ago

Interesting that danvk's example works. I'm running dygraphs through R. Perhaps that's the source of the issue. The following code executed in R reproduces the rounding issue for me:

library(xts) library(dygraphs) r = 5 t = seq(0,2pi,by=0.03) x = rcos(t) y = r*sin(t) t0 = Sys.time() ts = xts(y,t0-unclass(t0)+x) dygraph(ts)

TonyDIRL commented 9 years ago

Thanks for the response @danvk . I attempted to get this display working in dygraphs quite a while ago but I could never figure out the correct configuration of axisLabelFormatter and valueFormatter. http://jsfiddle.net/kaliatech/DfWNz/3/

Could you please suggest a workaround that would display milli's in the axis label and legend?

hallegue commented 8 years ago

Have anyone figured out how to force dygraphs to not truncate or round the data to seconds and display milliseconds?

TonyDIRL commented 8 years ago

Unfortunately I could never get this working. The plotly or highcharter packages handle subsecond plotting much better

statquant commented 8 years ago

It is really too bad dygraph is so much better at downsampling than plotly, but non-fractional second is just a no go for anyone in the finance field :(

danvk commented 8 years ago

Closed by #774