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

Demo Issue / Millisecond Plotting / Integration with Shiny #2

Closed TonyDIRL closed 10 years ago

TonyDIRL commented 10 years ago

Hi,

First off, cheers for working on this package - great for someone like myself with R exposure but little JS experience to get access to the plotting power of dygraph.

With regards the initial demo - the new branch resolves some of the issues. Specifically, dygraph1 and dygraph2 will now both individually render correctly, However, layout produces a blank page and layout_dygraphs seems to skip Rstudio and goes directly to the browser with the same effect. Strangely, either function does not produce a html output.

On a different note, how would I go about plotting millisecond resolution on the x-axis? I'm aware for other rchart libraries such as highcharts the following is required paste("#!", as.numeric(....timestamps....)"!#") However, this does not seem to work for dygraph?

Finally, is it possible to integrate dygraph with Shiny? I'm aware that for other rchart libraries renderChart2 can be used but this does not seem to support dygraph as of yet - would be really cool if it did.

Thanks again and happy to help out anyway I can.

TonyDIRL commented 10 years ago

Thank you for the suggestion timelyportfolio. I tested the demo on a linux box with a clean rstudio install (R: 3.1.0 - newest versions of all packets) and it worked without issue.

Amazing speed - plotted 500k points instantly without an issue. If this can be integrated within shiny it would be very useful.

danielkrizian commented 10 years ago

Yeah, authors of the dygraphs designed it with speed in mind. Good feedback, @TonyDIRL, any comparative experience with the same dataset for Highcharts/Hightstock?

@TonyDIRL , how did you solve the milliseconds part of the question?

There is definitely a plan to use dygraphs in Shiny; @timelyportfolio , I can record that plan separately in GitHub issue tracking system with enhancement tag (best if we merge our repository forks)

timelyportfolio commented 10 years ago

go ahead with your repo and let' s use that as primary. I'll try to work on the shiny integration by implementing what is in rCharts and maybe improving by having a look at ggvis. The amount of data that I would expect (given rCharts_dygraphs by design for bigger data) is potentially a stumbling block, but I think we can overcome.

danielkrizian commented 10 years ago

@timelyportfolio, added you as collaborator to this repository (allows you to do all the ops on it). Just in case, @ramnathv added too. Created separate Github issue/feature request/enhancement around Shiny integration: https://github.com/danielkrizian/rCharts_dygraphs/issues/4

This one can be closed after @TonyDIRL gets a chance to reply to my last two follow-up questions above

TonyDIRL commented 10 years ago

With regards the millisecond issue - I haven't ironed out the formatting and display issues yet. Essentially, I think the most straightforward solution to avoid date-time formatting issues would be to use the xValueParser parameter of dygraphs and then pass it the timestamps as integers, scaling by 1000 for milliseconds. Details are discussed here: https://groups.google.com/forum/#!topic/dygraphs-users/qAKQndJvkRE and http://dygraphs.com/data.html

I'm a novice when it comes to efficient utilization of highcharts - with that said given the same dataset the chart fails to load in a reasonable time. However, there are numerous workarounds to this which could be explored: http://www.highcharts.com/stock/demo/lazy-loading

If I can get it working I'll post an R example of dygraph in milli's.

danielkrizian commented 10 years ago

thanks @TonyDIRL for insights and links (highcharts demo acts indeed slow), We can try & isolate the comparable test in the dygraphs library alone first (see the above link), if you had nice millisec dataset to share that would be great! Once that's running in JavaScript alone, we can build on top of that an R wrapper that would detect the dataset resolution and automagically switch between the parser modes ;)

danielkrizian commented 10 years ago

Isolated the feature request here https://github.com/danielkrizian/rChartsDygraphs/issues/7 and closed.