Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<html>
<head>
<style type="text/css">
p {margin: 5px 20px; border: 2px solid #00848e; text-align: center; padding: 3px; background-color: #10b9c9; color:white; font-weight: bold; }
</style>
</head>
<body>
<div id="1"></div>
<script type="text/javascript">
var x = [];
function generateFakeData (count,numberRange) {
var data = [];
for (i=0; i<count; i++) {
var n = Math.floor(Math.random()*numberRange);
var delta = n*1000*60*60*24;
var ticks = (new Date()).getTime() - delta;
var d = new Date(ticks).toISOString().slice(0,10);
var c = "#"+((1<<24)*Math.random()|0).toString(16);
data.push({number:n, date:d, color:c})
}
return data;
}
var x = generateFakeData(9, 366);
var div = document.getElementById('1');
var items = '';
for (i=0; i<x.length; i++) {
items += '<p style="color:'+x[i].color+'">'+x[i].number+'</p>';
}
console.log('Fake data array length:'+x.length);
console.table(x);
div.innerHTML = items;
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.