Created
August 3, 2012 14:51
-
-
Save renaehodgkins/3248314 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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