-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add animation #28
Add animation #28
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -10,13 +10,16 @@ sources: | |||
- 3_visualize/src/svg_utils_general.R |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to build public/date_peaks.csv
and public/gw_sites.csv
, I had to add data.table
and stringr
to the packages for this yml file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added!
target_name, | ||
gw_anomaly_data_w_colors) | ||
|
||
public/gw_sites.csv: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like how you have these being saved directly to public/
instead of in a pipeline folder and then copying over ... seems like we should switch the anomaly_peaks.svg
target to do something similar at some point in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^ this is not a change request just to clarify :) just me thinking out loud
3_visualize/src/svg_utils_vue.R
Outdated
get_site_coords <- function(file_out, sites_sf){ | ||
# Get site positioning to draw sites with d3 | ||
convert_coords_to_svg(sites_sf, svg_width = 1000, view_bbox = st_bbox(generate_usa_map_data()))%>% | ||
mutate(site_no = paste0('gwl_', site_sf$site_no)) %>% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
site_sf
>> sites_sf
or the pipeline will throw an error when you build
This animates the svg map produced in R using d3 transitions to animate path
d
and fill through water year day. To do this, new targets were added to the R pipeline in3_visualize.yml
to create vue inputs of (1) a time series data frame site x quantiles x wyday (public/date_peaks.csv
) and (2) site key and position on the map (‘public/gw_sites.csv
). These were added to the.gitignore
and you will need to run the pipeline first to be able to build the page locally. Also includes a minor edit to generating<g>
elements, so that sites without data for that specific date are still given a place in the DOM.To build targets:
scmake('public/date_peaks.csv')
scmake(‘public/gw_sites.csv’)
Notes
<g>
elements (discussed more below).d
it was more performant to transition the single peak value at each site rather than transition between predefined shapes. To implement in this way, the quantile data need to be read into vue and then bound to the site locations. This should be possible using the pre-defined<g>
s that includetransform = translate(x y)
without reading in site coordinates too, but I struggled to get this to work. I think thatsvg-loader
that is injecting the svgs into the DOM is removing those<g>
s which is why I don’t see them in the DOM. This runs the svg throughsvgo
during the build, and a default option is to remove seemingly extraneous elements like<g>
(Peaks map - optimize SVG #18). I haven’t been able to change these settings yet.gwl_[nwis site_no]
and it used throughout the js code to index and bind data to DOM elements. This creates a largecsv
that the app depends on to build, which gets saved to thepublic
folder. We are at a point where we need to figure out how store and access these files (structuring pipeline from R to Vue #27).Expected result:
Screen.Recording.2021-07-14.at.12.09.06.PM.mov