I am trying to create a web project where I get the details in JSON format, for example:
{
"file_id": 333,
"t": "2016-03-08 12:00:56"
}
I tried to show the result in a d3 js histogram. The problem I am facing is that the code that I have is working for a JSON file, but not for a deserialized object from JSON. Can anyone help me with this?
Part of the script working file for JSON:
d3.json("FILENAME", function(error, data) {
data = JSON.parse(data);
x.domain(data.map(function(d) { return d.letter }));
y.domain([0, d3.max(data, function(d) { return d.frequency })]);
If I change the file name to an object, it does not work.
source
share