Hacker News new | past | comments | ask | show | jobs | submit login
For HN: Polls chart bookmarklet (and GreaseMonkey script)
20 points by bd on Mar 23, 2009 | hide | past | web | favorite | 7 comments
I made a bookmarklet that embeds pie charts into Hacker News poll pages. It scrapes data from a poll page and creates a chart using Google Charts API.

Just copy & paste following code into url field of newly created bookmark:




Or, if you want to change something more easily, you can also use a version that loads a script from an external source:




Note: Scraping is pretty fragile, it can break with any change of HN's html formatting.

When you are on some HN poll page, clicking on this bookmark should create a pie chart just above the poll options.

For example, here is how it should look like:


For this poll:


That's pretty cool. Any chance of making it a GreaseMonkey script so it will be done automatically on HN?

Very cool! Thanks!

I did notice a little bug, though. If you've started a poll, it thinks the * marker of your own vote is a poll option. I didn't happen to me on other polls, just on the one I started.

Thanks for noticing. I never started a poll, so I don't have a test case. I made a fix based on how the * marker is rendered elsewhere.

Please try if it works for you:

http://alteredqualia.com/visualization/hn/hnpollchart.user.j... (GreaseMonkey)

http://alteredqualia.com/visualization/hn/hn_poll_graph.js (bookmarklet include)

Both work beautifully! Thanks!


Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact