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

how might we leverage stateface? #5

Open
timelyportfolio opened this issue Apr 22, 2015 · 2 comments
Open

how might we leverage stateface? #5

timelyportfolio opened this issue Apr 22, 2015 · 2 comments

Comments

@timelyportfolio
Copy link

I know that the goal of statebins is to be ridiculously simplistic, but since waffle from @hrbrmstr, d3-exploder, and @ramnathv experiments are fresh in my mind, I couldn't resist the urge to see if we could leverage the great project stateface in rcstatebin in my fork and branched version. If not in rcstatebin, I know I'm going to use this in R charts or other htmlwidgets.

Instead of the text abbreviation we could use the state shape (probably not a good idea for the geographically ignorant US).

image

d3.selectAll(".cell text")
  .text(function(d){return stateface.lookup[d.state]})
  .style("font-family","StateFaceRegular")
  .style("fill","none")
  .style("stroke","gray")
  .style("font-size", "24px")

In the tooltip, we could also show the state shape for additional context.

image

data.state = data.state + " <span style='font-family:StateFaceRegular;font-size:24px'>" + stateface.lookup[data.state] + "</span> "
@ramnathv
Copy link
Owner

This looks awesome @timelyportfolio ! Can you send me a PR? Note that the source is in coffeescript, so make sure to put your modifications there.

@ramnathv
Copy link
Owner

I will make this line accept a renderer function to facilitate this. More generally, as you had indicated earlier, the widget needs to fire a completed rendering event, and also expose d3.selectAll(".cell") since everything hangs off of that.

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

No branches or pull requests

2 participants