Skip to content

Instantly share code, notes, and snippets.

@getflourish
Last active August 29, 2015 13:57
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 getflourish/9528344 to your computer and use it in GitHub Desktop.
Save getflourish/9528344 to your computer and use it in GitHub Desktop.
$scope.generateData = function(n) {
var fakeData = {"keys":[], "values":[]};
var months = [
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
"Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
]
var year = 14;
for (var i = 0; i < n; i++) {
if (i % 12 == 0) {
year++;
ms = 0;
} else {
ms++;
}
var data = {
"Date": months[ms] + "-" + year,
}
fakeData.values.push(data);
}
// push keys
for(var k in fakeData.values[0]) fakeData.keys.push(k);
return fakeData;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment