Skip to content

Instantly share code, notes, and snippets.

@danpalmer
Created April 11, 2013 17:10
Show Gist options
  • Save danpalmer/5365248 to your computer and use it in GitHub Desktop.
Save danpalmer/5365248 to your computer and use it in GitHub Desktop.
// Transform this:
{
visitors.total: [
{
timestamp: 1365548400,
value: 1
},
{
timestamp: 1365548700,
value: 2
},
{
timestamp: 1365549000,
value: 5
},
]
}
// Into this:
{
graph: {
title: "Visitors",
datasequences: [
{
title: "Site Name",
color: "blue",
datapoints: [
{
value: 1,
title: "00:00" // Human readable time from timestamp
},
{
value: 2,
title: "00:05"
},
{
value: 5,
title: "00:10"
}
]
}
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment