Build d3 line chart based on javascript json variableWhat is the scope of variables in JavaScript?How do you check if a variable is an array in JavaScript?Check if a variable is a string in JavaScriptHow can I pretty-print JSON using JavaScript?Parse JSON in JavaScript?JavaScript check if variable exists (is defined/initialized)Is there a standard function to check for null, undefined, or blank variables in JavaScript?how to format time on xAxis use d3.jsDraw the line use the same y values, plots line at the bottomd3js - TypeError: string is undefined

Does a 3rd-level Wolf Totem barbarian get advantage against enemies when an ally is within 5 feet of the enemy?

Scrum Master role: Reporting?

Taxi Services at Didcot

Argon vs nitrogen for preserving wine

How can drunken, homicidal elves successfully conduct a wild hunt?

PhD - Well known professor or well known school?

Example of non-trivial functors

Was Jesus good at singing?

Why doesn't Adrian Toomes give up Spider-Man's identity?

How powerful is a "Breathe Air" spell?

Movie about a boy who was born old and grew young

How do you show, through your narration, a hard and uncaring world?

How would a aircraft visually signal in distress?

How to project 3d image in the planes xy, xz, yz?

Company did not petition for visa in a timely manner. Is asking me to work from overseas, but wants me to take a paycut

What's the name of this light airplane?

Is this a mistake? (regarding maximum likelihood estimator)

Was the Tamarian language in "Darmok" inspired by Jack Vance's "The Asutra"?

When conversion from Integer to Single may lose precision

Are "living" organ banks practical?

Frame failure sudden death?

Give a short name / nick name to a printer in iOS?

Inconsistent behavior of compiler optimization of unused string

What was with Miles Morales's stickers?



Build d3 line chart based on javascript json variable


What is the scope of variables in JavaScript?How do you check if a variable is an array in JavaScript?Check if a variable is a string in JavaScriptHow can I pretty-print JSON using JavaScript?Parse JSON in JavaScript?JavaScript check if variable exists (is defined/initialized)Is there a standard function to check for null, undefined, or blank variables in JavaScript?how to format time on xAxis use d3.jsDraw the line use the same y values, plots line at the bottomd3js - TypeError: string is undefined






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















Edited: added zooming.



I'm getting data from php function (just sql request) to js variable, so js variable is json data. I need to build zoomable d3 line chart based on this json.
Json variable looks like this:



[temp: "5", created_at: "2017-03-19",
temp: "5", created_at: "2017-03-19",
temp: "26", created_at: "2018-04-20"]


Error is: Error: <path> attribute d: Expected number, "MNaN,NaNLNaN,NaNL…"



 Line_chart.append("path")
.datum(data)
.attr("class", "line")
.attr("d", line); ///One error is on this line

context.append("path")
.datum(data)
.attr("class", "line")
.attr("d", line2); ///Second error is on this line





var svg = d3.select("svg"),
margin = top: 20, right: 20, bottom: 110, left: 40,
margin2 = top: 430, right: 20, bottom: 30, left: 40,
width = +svg.attr("width") - margin.left - margin.right,
height = +svg.attr("height") - margin.top - margin.bottom,
height2 = +svg.attr("height") - margin2.top - margin2.bottom;

var parseDate = d3.timeParse("%Y-%M-%D");

var x = d3.scaleTime().range([0, width]),
x2 = d3.scaleTime().range([0, width]),
y = d3.scaleLinear().range([height, 0]),
y2 = d3.scaleLinear().range([height2, 0]);

var xAxis = d3.axisBottom(x),
xAxis2 = d3.axisBottom(x2),
yAxis = d3.axisLeft(y);

var brush = d3.brushX()
.extent([[0, 0], [width, height2]])
.on("brush end", brushed);

var zoom = d3.zoom()
.scaleExtent([1, Infinity])
.translateExtent([[0, 0], [width, height]])
.extent([[0, 0], [width, height]])
.on("zoom", zoomed);

var line = d3.line()
.x(function (d) return x(d.Date); )
.y(function (d) return y(d.Air_Temp); );

var line2 = d3.line()
.x(function (d) return x2(d.Date); )
.y(function (d) return y2(d.Air_Temp); );

var clip = svg.append("defs").append("svg:clipPath")
.attr("id", "clip")
.append("svg:rect")
.attr("width", width)
.attr("height", height)
.attr("x", 0)
.attr("y", 0);


var Line_chart = svg.append("g")
.attr("class", "focus")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")")
.attr("clip-path", "url(#clip)");


var focus = svg.append("g")
.attr("class", "focus")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");

var context = svg.append("g")
.attr("class", "context")
.attr("transform", "translate(" + margin2.left + "," + margin2.top + ")");




var data = jsonfile

x.domain(d3.extent(data, function(d) return d.created_at; ));
y.domain([0, d3.max(data, function (d) return d.temp; )]);
x2.domain(x.domain());
y2.domain(y.domain());


focus.append("g")
.attr("class", "axis axis--x")
.attr("transform", "translate(0," + height + ")")
.call(xAxis);

focus.append("g")
.attr("class", "axis axis--y")
.call(yAxis);

Line_chart.append("path")
.datum(data)
.attr("class", "line")
.attr("d", line);

context.append("path")
.datum(data)
.attr("class", "line")
.attr("d", line2);


context.append("g")
.attr("class", "axis axis--x")
.attr("transform", "translate(0," + height2 + ")")
.call(xAxis2);

context.append("g")
.attr("class", "brush")
.call(brush)
.call(brush.move, x.range());

svg.append("rect")
.attr("class", "zoom")
.attr("width", width)
.attr("height", height)
.attr("transform", "translate(" + margin.left + "," + margin.top + ")")
.call(zoom);


console.log(data);







function brushed() x2.range();
x.domain(s.map(x2.invert, x2));
Line_chart.select(".line").attr("d", line);
focus.select(".axis--x").call(xAxis);
svg.select(".zoom").call(zoom.transform, d3.zoomIdentity
.scale(width / (s[1] - s[0]))
.translate(-s[0], 0));


function zoomed()
if (d3.event.sourceEvent && d3.event.sourceEvent.type === "brush") return; // ignore zoom-by-brush
var t = d3.event.transform;
x.domain(t.rescaleX(x2).domain());
Line_chart.select(".line").attr("d", line);
focus.select(".axis--x").call(xAxis);
context.select(".brush").call(brush.move, x.range().map(t.invertX, t));


function type(d)
d.Date = parseDate(d.created_at);
d.Air_Temp = +d.temp;
return d;



jsonfile in d3.json is this json variable.



I have problem with dislaying data. I have x and y axis but no displayed data.



---------Reason of the error is incorrectly parsed data, still don't know where code goes wrong.-----------



I added: after var data = jsonfile



data.forEach(function(d)
d.created_at = parseDate(d.created_at);
d.temp = +d.temp;
);


And it worked. Graph builds using console. Don't why and where json strings parsed incorrectly.










share|improve this question
























  • So as I understand the chart renders as it should on Google Chrome, but not on Firefox as it there fails to import the json-file? Are you able to recreate the problem in a code sandbox/code pen?

    – jensmtg
    Mar 24 at 16:12











  • There are no errors in google chrome console, but it only creates space for d3 graph. I'm trying to rewrite this graph without d3.json, because jsonfile is a json object, and there is no need to load data

    – Jully
    Mar 24 at 16:19











  • @Jully Could you please reproduce this on jsfiddle or something? So that we can work on it

    – wentjun
    Mar 24 at 19:25











  • Thanks for reply, I added my last corrections in the answer)

    – Jully
    Mar 24 at 19:47

















1















Edited: added zooming.



I'm getting data from php function (just sql request) to js variable, so js variable is json data. I need to build zoomable d3 line chart based on this json.
Json variable looks like this:



[temp: "5", created_at: "2017-03-19",
temp: "5", created_at: "2017-03-19",
temp: "26", created_at: "2018-04-20"]


Error is: Error: <path> attribute d: Expected number, "MNaN,NaNLNaN,NaNL…"



 Line_chart.append("path")
.datum(data)
.attr("class", "line")
.attr("d", line); ///One error is on this line

context.append("path")
.datum(data)
.attr("class", "line")
.attr("d", line2); ///Second error is on this line





var svg = d3.select("svg"),
margin = top: 20, right: 20, bottom: 110, left: 40,
margin2 = top: 430, right: 20, bottom: 30, left: 40,
width = +svg.attr("width") - margin.left - margin.right,
height = +svg.attr("height") - margin.top - margin.bottom,
height2 = +svg.attr("height") - margin2.top - margin2.bottom;

var parseDate = d3.timeParse("%Y-%M-%D");

var x = d3.scaleTime().range([0, width]),
x2 = d3.scaleTime().range([0, width]),
y = d3.scaleLinear().range([height, 0]),
y2 = d3.scaleLinear().range([height2, 0]);

var xAxis = d3.axisBottom(x),
xAxis2 = d3.axisBottom(x2),
yAxis = d3.axisLeft(y);

var brush = d3.brushX()
.extent([[0, 0], [width, height2]])
.on("brush end", brushed);

var zoom = d3.zoom()
.scaleExtent([1, Infinity])
.translateExtent([[0, 0], [width, height]])
.extent([[0, 0], [width, height]])
.on("zoom", zoomed);

var line = d3.line()
.x(function (d) return x(d.Date); )
.y(function (d) return y(d.Air_Temp); );

var line2 = d3.line()
.x(function (d) return x2(d.Date); )
.y(function (d) return y2(d.Air_Temp); );

var clip = svg.append("defs").append("svg:clipPath")
.attr("id", "clip")
.append("svg:rect")
.attr("width", width)
.attr("height", height)
.attr("x", 0)
.attr("y", 0);


var Line_chart = svg.append("g")
.attr("class", "focus")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")")
.attr("clip-path", "url(#clip)");


var focus = svg.append("g")
.attr("class", "focus")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");

var context = svg.append("g")
.attr("class", "context")
.attr("transform", "translate(" + margin2.left + "," + margin2.top + ")");




var data = jsonfile

x.domain(d3.extent(data, function(d) return d.created_at; ));
y.domain([0, d3.max(data, function (d) return d.temp; )]);
x2.domain(x.domain());
y2.domain(y.domain());


focus.append("g")
.attr("class", "axis axis--x")
.attr("transform", "translate(0," + height + ")")
.call(xAxis);

focus.append("g")
.attr("class", "axis axis--y")
.call(yAxis);

Line_chart.append("path")
.datum(data)
.attr("class", "line")
.attr("d", line);

context.append("path")
.datum(data)
.attr("class", "line")
.attr("d", line2);


context.append("g")
.attr("class", "axis axis--x")
.attr("transform", "translate(0," + height2 + ")")
.call(xAxis2);

context.append("g")
.attr("class", "brush")
.call(brush)
.call(brush.move, x.range());

svg.append("rect")
.attr("class", "zoom")
.attr("width", width)
.attr("height", height)
.attr("transform", "translate(" + margin.left + "," + margin.top + ")")
.call(zoom);


console.log(data);







function brushed() x2.range();
x.domain(s.map(x2.invert, x2));
Line_chart.select(".line").attr("d", line);
focus.select(".axis--x").call(xAxis);
svg.select(".zoom").call(zoom.transform, d3.zoomIdentity
.scale(width / (s[1] - s[0]))
.translate(-s[0], 0));


function zoomed()
if (d3.event.sourceEvent && d3.event.sourceEvent.type === "brush") return; // ignore zoom-by-brush
var t = d3.event.transform;
x.domain(t.rescaleX(x2).domain());
Line_chart.select(".line").attr("d", line);
focus.select(".axis--x").call(xAxis);
context.select(".brush").call(brush.move, x.range().map(t.invertX, t));


function type(d)
d.Date = parseDate(d.created_at);
d.Air_Temp = +d.temp;
return d;



jsonfile in d3.json is this json variable.



I have problem with dislaying data. I have x and y axis but no displayed data.



---------Reason of the error is incorrectly parsed data, still don't know where code goes wrong.-----------



I added: after var data = jsonfile



data.forEach(function(d)
d.created_at = parseDate(d.created_at);
d.temp = +d.temp;
);


And it worked. Graph builds using console. Don't why and where json strings parsed incorrectly.










share|improve this question
























  • So as I understand the chart renders as it should on Google Chrome, but not on Firefox as it there fails to import the json-file? Are you able to recreate the problem in a code sandbox/code pen?

    – jensmtg
    Mar 24 at 16:12











  • There are no errors in google chrome console, but it only creates space for d3 graph. I'm trying to rewrite this graph without d3.json, because jsonfile is a json object, and there is no need to load data

    – Jully
    Mar 24 at 16:19











  • @Jully Could you please reproduce this on jsfiddle or something? So that we can work on it

    – wentjun
    Mar 24 at 19:25











  • Thanks for reply, I added my last corrections in the answer)

    – Jully
    Mar 24 at 19:47













1












1








1








Edited: added zooming.



I'm getting data from php function (just sql request) to js variable, so js variable is json data. I need to build zoomable d3 line chart based on this json.
Json variable looks like this:



[temp: "5", created_at: "2017-03-19",
temp: "5", created_at: "2017-03-19",
temp: "26", created_at: "2018-04-20"]


Error is: Error: <path> attribute d: Expected number, "MNaN,NaNLNaN,NaNL…"



 Line_chart.append("path")
.datum(data)
.attr("class", "line")
.attr("d", line); ///One error is on this line

context.append("path")
.datum(data)
.attr("class", "line")
.attr("d", line2); ///Second error is on this line





var svg = d3.select("svg"),
margin = top: 20, right: 20, bottom: 110, left: 40,
margin2 = top: 430, right: 20, bottom: 30, left: 40,
width = +svg.attr("width") - margin.left - margin.right,
height = +svg.attr("height") - margin.top - margin.bottom,
height2 = +svg.attr("height") - margin2.top - margin2.bottom;

var parseDate = d3.timeParse("%Y-%M-%D");

var x = d3.scaleTime().range([0, width]),
x2 = d3.scaleTime().range([0, width]),
y = d3.scaleLinear().range([height, 0]),
y2 = d3.scaleLinear().range([height2, 0]);

var xAxis = d3.axisBottom(x),
xAxis2 = d3.axisBottom(x2),
yAxis = d3.axisLeft(y);

var brush = d3.brushX()
.extent([[0, 0], [width, height2]])
.on("brush end", brushed);

var zoom = d3.zoom()
.scaleExtent([1, Infinity])
.translateExtent([[0, 0], [width, height]])
.extent([[0, 0], [width, height]])
.on("zoom", zoomed);

var line = d3.line()
.x(function (d) return x(d.Date); )
.y(function (d) return y(d.Air_Temp); );

var line2 = d3.line()
.x(function (d) return x2(d.Date); )
.y(function (d) return y2(d.Air_Temp); );

var clip = svg.append("defs").append("svg:clipPath")
.attr("id", "clip")
.append("svg:rect")
.attr("width", width)
.attr("height", height)
.attr("x", 0)
.attr("y", 0);


var Line_chart = svg.append("g")
.attr("class", "focus")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")")
.attr("clip-path", "url(#clip)");


var focus = svg.append("g")
.attr("class", "focus")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");

var context = svg.append("g")
.attr("class", "context")
.attr("transform", "translate(" + margin2.left + "," + margin2.top + ")");




var data = jsonfile

x.domain(d3.extent(data, function(d) return d.created_at; ));
y.domain([0, d3.max(data, function (d) return d.temp; )]);
x2.domain(x.domain());
y2.domain(y.domain());


focus.append("g")
.attr("class", "axis axis--x")
.attr("transform", "translate(0," + height + ")")
.call(xAxis);

focus.append("g")
.attr("class", "axis axis--y")
.call(yAxis);

Line_chart.append("path")
.datum(data)
.attr("class", "line")
.attr("d", line);

context.append("path")
.datum(data)
.attr("class", "line")
.attr("d", line2);


context.append("g")
.attr("class", "axis axis--x")
.attr("transform", "translate(0," + height2 + ")")
.call(xAxis2);

context.append("g")
.attr("class", "brush")
.call(brush)
.call(brush.move, x.range());

svg.append("rect")
.attr("class", "zoom")
.attr("width", width)
.attr("height", height)
.attr("transform", "translate(" + margin.left + "," + margin.top + ")")
.call(zoom);


console.log(data);







function brushed() x2.range();
x.domain(s.map(x2.invert, x2));
Line_chart.select(".line").attr("d", line);
focus.select(".axis--x").call(xAxis);
svg.select(".zoom").call(zoom.transform, d3.zoomIdentity
.scale(width / (s[1] - s[0]))
.translate(-s[0], 0));


function zoomed()
if (d3.event.sourceEvent && d3.event.sourceEvent.type === "brush") return; // ignore zoom-by-brush
var t = d3.event.transform;
x.domain(t.rescaleX(x2).domain());
Line_chart.select(".line").attr("d", line);
focus.select(".axis--x").call(xAxis);
context.select(".brush").call(brush.move, x.range().map(t.invertX, t));


function type(d)
d.Date = parseDate(d.created_at);
d.Air_Temp = +d.temp;
return d;



jsonfile in d3.json is this json variable.



I have problem with dislaying data. I have x and y axis but no displayed data.



---------Reason of the error is incorrectly parsed data, still don't know where code goes wrong.-----------



I added: after var data = jsonfile



data.forEach(function(d)
d.created_at = parseDate(d.created_at);
d.temp = +d.temp;
);


And it worked. Graph builds using console. Don't why and where json strings parsed incorrectly.










share|improve this question
















Edited: added zooming.



I'm getting data from php function (just sql request) to js variable, so js variable is json data. I need to build zoomable d3 line chart based on this json.
Json variable looks like this:



[temp: "5", created_at: "2017-03-19",
temp: "5", created_at: "2017-03-19",
temp: "26", created_at: "2018-04-20"]


Error is: Error: <path> attribute d: Expected number, "MNaN,NaNLNaN,NaNL…"



 Line_chart.append("path")
.datum(data)
.attr("class", "line")
.attr("d", line); ///One error is on this line

context.append("path")
.datum(data)
.attr("class", "line")
.attr("d", line2); ///Second error is on this line





var svg = d3.select("svg"),
margin = top: 20, right: 20, bottom: 110, left: 40,
margin2 = top: 430, right: 20, bottom: 30, left: 40,
width = +svg.attr("width") - margin.left - margin.right,
height = +svg.attr("height") - margin.top - margin.bottom,
height2 = +svg.attr("height") - margin2.top - margin2.bottom;

var parseDate = d3.timeParse("%Y-%M-%D");

var x = d3.scaleTime().range([0, width]),
x2 = d3.scaleTime().range([0, width]),
y = d3.scaleLinear().range([height, 0]),
y2 = d3.scaleLinear().range([height2, 0]);

var xAxis = d3.axisBottom(x),
xAxis2 = d3.axisBottom(x2),
yAxis = d3.axisLeft(y);

var brush = d3.brushX()
.extent([[0, 0], [width, height2]])
.on("brush end", brushed);

var zoom = d3.zoom()
.scaleExtent([1, Infinity])
.translateExtent([[0, 0], [width, height]])
.extent([[0, 0], [width, height]])
.on("zoom", zoomed);

var line = d3.line()
.x(function (d) return x(d.Date); )
.y(function (d) return y(d.Air_Temp); );

var line2 = d3.line()
.x(function (d) return x2(d.Date); )
.y(function (d) return y2(d.Air_Temp); );

var clip = svg.append("defs").append("svg:clipPath")
.attr("id", "clip")
.append("svg:rect")
.attr("width", width)
.attr("height", height)
.attr("x", 0)
.attr("y", 0);


var Line_chart = svg.append("g")
.attr("class", "focus")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")")
.attr("clip-path", "url(#clip)");


var focus = svg.append("g")
.attr("class", "focus")
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");

var context = svg.append("g")
.attr("class", "context")
.attr("transform", "translate(" + margin2.left + "," + margin2.top + ")");




var data = jsonfile

x.domain(d3.extent(data, function(d) return d.created_at; ));
y.domain([0, d3.max(data, function (d) return d.temp; )]);
x2.domain(x.domain());
y2.domain(y.domain());


focus.append("g")
.attr("class", "axis axis--x")
.attr("transform", "translate(0," + height + ")")
.call(xAxis);

focus.append("g")
.attr("class", "axis axis--y")
.call(yAxis);

Line_chart.append("path")
.datum(data)
.attr("class", "line")
.attr("d", line);

context.append("path")
.datum(data)
.attr("class", "line")
.attr("d", line2);


context.append("g")
.attr("class", "axis axis--x")
.attr("transform", "translate(0," + height2 + ")")
.call(xAxis2);

context.append("g")
.attr("class", "brush")
.call(brush)
.call(brush.move, x.range());

svg.append("rect")
.attr("class", "zoom")
.attr("width", width)
.attr("height", height)
.attr("transform", "translate(" + margin.left + "," + margin.top + ")")
.call(zoom);


console.log(data);







function brushed() x2.range();
x.domain(s.map(x2.invert, x2));
Line_chart.select(".line").attr("d", line);
focus.select(".axis--x").call(xAxis);
svg.select(".zoom").call(zoom.transform, d3.zoomIdentity
.scale(width / (s[1] - s[0]))
.translate(-s[0], 0));


function zoomed()
if (d3.event.sourceEvent && d3.event.sourceEvent.type === "brush") return; // ignore zoom-by-brush
var t = d3.event.transform;
x.domain(t.rescaleX(x2).domain());
Line_chart.select(".line").attr("d", line);
focus.select(".axis--x").call(xAxis);
context.select(".brush").call(brush.move, x.range().map(t.invertX, t));


function type(d)
d.Date = parseDate(d.created_at);
d.Air_Temp = +d.temp;
return d;



jsonfile in d3.json is this json variable.



I have problem with dislaying data. I have x and y axis but no displayed data.



---------Reason of the error is incorrectly parsed data, still don't know where code goes wrong.-----------



I added: after var data = jsonfile



data.forEach(function(d)
d.created_at = parseDate(d.created_at);
d.temp = +d.temp;
);


And it worked. Graph builds using console. Don't why and where json strings parsed incorrectly.







javascript json d3.js






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 24 at 20:09







Jully

















asked Mar 24 at 15:38









JullyJully

62




62












  • So as I understand the chart renders as it should on Google Chrome, but not on Firefox as it there fails to import the json-file? Are you able to recreate the problem in a code sandbox/code pen?

    – jensmtg
    Mar 24 at 16:12











  • There are no errors in google chrome console, but it only creates space for d3 graph. I'm trying to rewrite this graph without d3.json, because jsonfile is a json object, and there is no need to load data

    – Jully
    Mar 24 at 16:19











  • @Jully Could you please reproduce this on jsfiddle or something? So that we can work on it

    – wentjun
    Mar 24 at 19:25











  • Thanks for reply, I added my last corrections in the answer)

    – Jully
    Mar 24 at 19:47

















  • So as I understand the chart renders as it should on Google Chrome, but not on Firefox as it there fails to import the json-file? Are you able to recreate the problem in a code sandbox/code pen?

    – jensmtg
    Mar 24 at 16:12











  • There are no errors in google chrome console, but it only creates space for d3 graph. I'm trying to rewrite this graph without d3.json, because jsonfile is a json object, and there is no need to load data

    – Jully
    Mar 24 at 16:19











  • @Jully Could you please reproduce this on jsfiddle or something? So that we can work on it

    – wentjun
    Mar 24 at 19:25











  • Thanks for reply, I added my last corrections in the answer)

    – Jully
    Mar 24 at 19:47
















So as I understand the chart renders as it should on Google Chrome, but not on Firefox as it there fails to import the json-file? Are you able to recreate the problem in a code sandbox/code pen?

– jensmtg
Mar 24 at 16:12





So as I understand the chart renders as it should on Google Chrome, but not on Firefox as it there fails to import the json-file? Are you able to recreate the problem in a code sandbox/code pen?

– jensmtg
Mar 24 at 16:12













There are no errors in google chrome console, but it only creates space for d3 graph. I'm trying to rewrite this graph without d3.json, because jsonfile is a json object, and there is no need to load data

– Jully
Mar 24 at 16:19





There are no errors in google chrome console, but it only creates space for d3 graph. I'm trying to rewrite this graph without d3.json, because jsonfile is a json object, and there is no need to load data

– Jully
Mar 24 at 16:19













@Jully Could you please reproduce this on jsfiddle or something? So that we can work on it

– wentjun
Mar 24 at 19:25





@Jully Could you please reproduce this on jsfiddle or something? So that we can work on it

– wentjun
Mar 24 at 19:25













Thanks for reply, I added my last corrections in the answer)

– Jully
Mar 24 at 19:47





Thanks for reply, I added my last corrections in the answer)

– Jully
Mar 24 at 19:47












0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55325486%2fbuild-d3-line-chart-based-on-javascript-json-variable%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55325486%2fbuild-d3-line-chart-based-on-javascript-json-variable%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Obelisk of Theodosius Contents History Description Notes Bibliography Further reading External links Navigation menuAge of spirituality : late antique and early Christian art, third to seventh centuryOver 60 picturesObelisks of the World41°00′21.24″N 28°58′31.43″E / 41.0059000°N 28.9753972°E / 41.0059000; 28.97539727724550-7235741376235741376

밀양 대씨 역사 각주 함께 보기 둘러보기 메뉴밀양 대씨

1973년 목차 사건 문화 탄생 사망 노벨상 달력 둘러보기 메뉴