Closed 7yl4r closed 5 years ago
Not sure if this is overkilled but there is cool stuff we could pull from this Shiny app.
OK, I just found a Shiny app that @bbest created a while back to show phyto pigment data collected in the MBON cruises. This will do the job! The only thing to do here is to replace the pie charts with line plots and perhaps add a data download button.
:thinking: Ooh that does look nice.
Unfortunately shiny app code may not work here since it runs on a shiny server and this is set up to build as a static page. I don't know of a way to generate shiny code into a static webpage, but it might exist.
I have been trying this code in the Data_in_situ.Rmd:
library(shiny)
runGitHub("marinebon/hplc-vis", username = getOption("eqmh"), ref = "master",
launch.browser = getOption("shiny.launch.browser", interactive()))
This runs OK in the command line but when I knit the Rmd it doesn't render the app:
That is about what I would expect. Shiny is a separate "stack" from the knitr static server stack being used in this project.
Shiny runs a (dynamic) server and client application that connects to the server to execute R code at runtime (ie when you open the page). The code in this repo must all build before runtime into "static" html/css/js to be served on github's static server.
In short: shiny needs a shiny-server, and that doesn't jive with the build process here. Ben might know of something I don't, but it's a hard problem to work around.
See the above linked commit on the mapplots branch of one way to use iframes.
I added a popup_url
column to sites.csv
and then modified index.Rmd to use that column:
sites$html <- with(
sites, paste("<iframe src='", popup_url, "'></iframe>", sep="")
)
I set all popup_url values to a test url:
Sizing can be tricky, but in theory anything could go there. So I guess now we need something that generates the view for each site as a standalone html page?
Nice, @7yl4r ! I will grab the temp data from our sensors as a start.
Hi @eqmh and @7yl4r,
Here's a few more links:
mapview::popupGraph()
which also uses iframe: r - adding an htmlwidget to a the popup of a leaflet object - Stack Overflow
htmlwidgets::getDependency()
& leaflet::onRender()
more sophisticated embedding of htmlwidget dependencies: Embedding htmlwidgets in maps
similar approach:
Look forward to chatting about overall strategy further with you both. For instance,
@eqmh can you please send some sample data from your Android robolimpet app to electric.blue.data@gmail.com?
Then I can process the data using this script: http://marinebon.github.io/thermal-data.
And publish time series into a map popup a la this issue onto p2p website.
This is one aspect of larger vision to integrate biological data in the field with satellite and in situ environmental data.
I'll be joining you both in Miami Jan 15-16, flying to TPA ~4pm Thu Jan 17, leaving TPA ~noon Fri Jan 25 so we have a week+ to dig in.
@bbest thanks for the links!
Is this automated process through the email?
@eqmh and I put an hour into this today and connected up the thermaldata dygraph to the popup. Unfortunately the dygraph html doesn't do so well in the little box:
Well done guys! That's a great accomplishment getting the htmlwidget to even appear in the popup. The sparkline widget is better suite for small space like the example above. Then in the popup you could include a link to the individual station page that has the full dygraph time series.
You could generate these station pages using a parameterized Rmarkdown report and flexdashboard, similar to Ship Report Card: CARNIVAL INSPIRATION:
See repo ecoquants/ship-cards:
Hi @eqmh & @7yl4r ,
I updated the MBON P2P home page map to have a popup:
that links to a sampling site page with SST extracted from ERDDAP in the form of:
Map most recent SST, postage stamp size (10x10):
Timeseries plot of entire period available (2004 to now):
These values get cached into data/sst and when the site is rendered any missing values since last time are fetched and included.
Photos of the site for any provided with URLs in data/site_photos.csv:
More details on the mechanics are included in the README.
A few things that come to mind as next step improvements:
On the index page @eqmh would like to get a timeseries plot into the popups. Simplest way to accomplish that is going to be using an iframe I think. Here is a S.O. Q/A on that.