Click here to see the SAS code.
Click here to see the example.

---------------------------------------------------------------

See my blog for more information about this graph!


This is my SAS/GRAPH imitation of CNN's election map:
http://www.cnn.com/ELECTION/2012/ecalculator#?battleground

I use the data and colors from the CNN map, and also incorporate
some ideas from the following Huffington Post map:
http://elections.huffingtonpost.com/2012/romney-vs-obama-electoral-map


The map is created with SAS/GRAPH's Proc GMap.
The bar chart is created with SAS/GRAPH's Proc GChart.
The two graphs are combined on the same page using SAS/GRAPH's Proc GReplay.


The Gmap occupies the entire page, and the titles, footnote, and legend
are all part of the Gmap.  I customized the map slightly, creating fake
squares out in the ocean to show the color of some of the smaller states.

The Gchart (bar chart) is a very small/minimal stacked bar chart, 
and I annotate the totals and pictures above the bar chart.
I had to get a little tricky with the bar chart, to get each state
to show as a separate segment (Gchart would typically sum all the
states with the same color, and create 1 segment for all of them).

I create a custom Greplay template, with 2 areas for graphs.
One area is the entire window (which I replay the map into),
and the other area is a smaller one (that overlaps the big one)
and I replay the bar chart into this 2nd one.

I use the 'html=' option in both the map and bar chart, so I can
have html mouse-over text and drilldown tags.

Back to Samples Index