Skip to content

Instantly share code, notes, and snippets.

@renaehodgkins
Created August 3, 2012 14:51
Show Gist options
  • Save renaehodgkins/3248314 to your computer and use it in GitHub Desktop.
Save renaehodgkins/3248314 to your computer and use it in GitHub Desktop.
paper = new Raphael(@el, 1000, 750) # init paper on the @el element which is passed from Backbone Views
paper.rect(0, 0, 1000, 750, 10).attr({stroke: 'none', fill: '#fff'}) # create canvas
paper.text(20, 20, "Chrome Browser Percentage World").attr({'text-anchor': 'start', 'font-size': '20px'}) # add chart title
paper.setStart() # set point to start add element to a set which is a container that can include elements
_.each _.keys(@worldmap.shapes), (country_iso_code)=> # @worldmap.shapes is brought by world.js which contains paths of countries
path = paper.path(@worldmap.shapes[country_iso_code]).attr({stroke: "#fff", fill: @colorOfCountry(country_iso_code), "stroke-opacity": 0.25}) # draw country path, fill the color based on the percentage value
@bindHoverToCountry(paper, country_iso_code, path)
world = paper.setFinish() # set point to end the set that include all the countris path
world.transform("t0, 80") # move all the countries path 80px vertically
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment