Skip to content
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

successfully inject map d3 into target/index.html (correct branch this time!) #35

Merged
merged 19 commits into from
Jan 5, 2018

Conversation

lindsayplatt
Copy link

Please see #34 for comments.

@jordansread
Copy link

Wasn't I already pulling in D3 in vizstorm?

@lindsayplatt
Copy link
Author

Hmm, not that I noticed. Where were you adding it?

@jordansread
Copy link

@lindsaycarr whoops, you are right, it isn't in here. But it is in https://github.com/USGS-VIZLAB/example/blob/master/viz.yaml#L190 and note that minified D3 is in the vizlab package, so you shouldn't need to commit that file.

viz.yaml Outdated
@@ -232,13 +232,22 @@ visualize:
title: "SVG skeleton"
alttext: "Beginning of the full storm SVG"
publish:
-
mimetype: application/javascript
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's this line for?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoops - forgot to delete it when I deleted the d3 library load

@lindsayplatt lindsayplatt changed the title successfully inject dummy d3 into target/index.html (correct branch this time!) successfully inject map d3 into target/index.html (correct branch this time!) Jan 5, 2018
@lindsayplatt
Copy link
Author

Ready to merge. Here's what the result of running vizmake() looks like:

state_map_hovers

.attr( 'id', 'map' );

// Add map features
d3.json('../cache/state_map.geojson', function(us_data){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

../cache isn't going to be available on CHS

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.....WUT 🤦‍♀️ been operating under that assumption with this code.

Do you think I can push them to a target/data directory?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think data that you want access to in target needs to be publish or otherwise exported.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see #37

@aappling-usgs
Copy link
Member

Sweeeeet!

@@ -1,266 +0,0 @@

#' Sub mustache keys into text
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i thought we still had uncertainty about whether the functions in this file can be used to keep the user experience speedy. if true, we may not be ready to remove this file already, though I know the functions are still on the other branch and in git history. what's your thinking on this now that you've been looking at vizstorm for a day, lindsay?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went the route of saving everything as geojson, and using that within the D3 code. To be honest, I didn't really understand what this was, just thought it was needed when we handrolled SVG. I see what you mean, though - although we haven't experienced any slowness yet (but probably will when we get working with more data). I can revert so that the file remains. I probably got a little heavy-handed with my cleanup.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well...this gets at the question of where we draw the line between R and D3 - which is interesting. One thing, for example, is using R for the GIS side of things - I liked the original projection (and the flexibility that we can use whatever makes sense) over the one we'd need for d3.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For what it's worth - D3 should be able to do any projection. I'm just struggling with that right now.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, i think the R-D3 question is still open. makes sense to me to keep this file in here for now and think about how to optimize our use of the tools. i agree with lindsay that d3 projections should give us all the flexibility we'd need, but am also curious to eventually learn how much doing the projection in R might speed us up (or not). this may or may not be a question we answer in the next few weeks.

@lindsayplatt lindsayplatt mentioned this pull request Jan 5, 2018
@lindsayplatt
Copy link
Author

Not particularly happy with how I had to hack my way through getting JSON to be in target/, but here's something that works. I couldn't get the solution for the Hurricane Harvey viz linked in USGS-VIZLAB/vizlab#263 to work quite right, so this is a bit of a hybrid. remake won't allow me to use location: cache/state_map.geojson more than once, so I had to hack that a little. Since there is an issue in vizlab for making this easier, I'm not going to worry about it too much here.

@lindsayplatt
Copy link
Author

lindsayplatt commented Jan 5, 2018

Via Slack:

aappling: oof. a copy of your remake file with duplication locations might still be useful, but i'm starting to get an idea of what might be happening...and may not be able to fix it fast after all. hmm. i think this publish step is throwing a lot of wrenches around as currently implemented...

lcarr: I might revert those last changes, and keep using cache so that I can continue actually working on the viz and not battling vizlab. I can make an issue so that we don't forget this branch won't work on CHS until json files make it into target somewhere

Please see #37.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants