php - Error when setting up y axis from a data table that is JSON. parsed for d3 charts -
i can't seem use projectdate field set x axis. use json.parse data json , prepared data using data.foreach used d3 chart. when call page, "uncaught typeerror: t.substring not function. please let me know doing wrong.
// data viewmodel var data = json.parse(<?php echo json_encode($viewmodel) ?>); data.foreach(function(d) { d.projectdate = parsedate(d.projectdate); d.cost = +d.cost; }); var y = d3.scale.linear() .domain([0, d3.max(data, function(d){ return d.cost; })]) .range([height, 0]); var x = d3.scale.ordinal() .domain(d3.extent(data, function(d){ var date = parsedate(d.projectdate); return (date); })) .range([0, width]); var ordinalcolorscale = d3.scale.category20();
Comments
Post a Comment