Skip to content

Instantly share code, notes, and snippets.

@TweededBadger
Created October 18, 2014 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TweededBadger/17a6f13a787578a69fc5 to your computer and use it in GitHub Desktop.
Save TweededBadger/17a6f13a787578a69fc5 to your computer and use it in GitHub Desktop.
angular.module('SvgMapApp', [])
.controller('MainCtrl', ['$scope', function ($scope) {
var states = ["AL", "AK", "AS", "AZ", "AR", "CA", "CO", "CT", "DE", "DC", "FM", "FL", "GA", "GU", "HI", "ID", "IL",
"IN", "IA", "KS", "KY", "LA", "ME", "MH", "MD", "MA", "MI", "MN", "MS", "MO", "MT", "NE", "NV", "NH", "NJ", "NM",
"NY", "NC", "ND", "MP", "OH", "OK", "OR", "PW", "PA", "PR", "RI", "SC", "SD", "TN", "TX", "UT", "VT", "VI", "VA",
"WA", "WV", "WI", "WY"];
$scope.createDummyData = function () {
var dataTemp = {};
angular.forEach(states, function (state, key) {
dataTemp[state] = {value: Math.random()}
});
$scope.dummyData = dataTemp;
};
$scope.createDummyData();
}]);
<!--...-->
<div class="container">
<div svg-map></div>
<p>
<button ng-click="createDummyData()" class="btn btn-block btn-default">Create Dummy Data</button>
</p>
<div class="regionlist">
<div ng-repeat="(key,region) in dummyData">
<div>{{key}}</div>
<div>{{region.value | number}}</div>
</div>
</div>
</div>
<!--...-->
/*....*/
.regionlist {
-webkit-column-count: 5; /* Chrome, Safari, Opera */
-moz-column-count: 5; /* Firefox */
column-count: 5;
}
.regionlist > div {
display: inline-block;
width: 100%;
border-bottom: 1px solid grey;
}
.regionlist > div > div {
display: inline-block;
width: 48%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment