e.g. D3 Parsing Dates
http://stackoverflow.com/questions/21487456/chart-xaxis-tickformat-formatting-is-not-working
by Nivaldo
HTML
INPUT: <div id="data"></div><br/>
OUTPUT: <div id="results"></div>
JavaScript
var histcatexplong = [
{
"key" : "Consumer Discretionary" ,
"values" : [ [ 20131201 , 27.38478809681],[ 20131202 , 27.38478809681], [ 20131203 , 27.38478809681]]
} ,
{
"key" : "Consumer Staples" ,
"values" : [ [ 20131201 , 7.2800122043237],[ 20131202 , 27.38478809681], [ 20131203 , 27.38478809681]]
} ];
d3.select("#data").html(histcatexplong[0].values);
var parser = d3.time.format("%Y%m%d");
histcatexplong.forEach(function(d) {
d.values.forEach(function(e) {
e[0] = parser.parse("" + e[0]);
});
});
d3.select("#results").html(histcatexplong[0].values);