Bar graph not within axis
up vote
0
down vote
favorite
I'm having trouble having the bar graph contained within the axis. I tried adjusting the margin but it's still below the x-axis. Any suggestions would be appreciated. Thankyou
this is my margin:
margin = {
top: 70,
right: 20,
bottom: 70,
left: 70
},
width = 600 - margin.left - margin.right,
height = 400 - margin.top - margin.bottom,
padding = 15;
d3.js graph
New contributor
Madeline is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
0
down vote
favorite
I'm having trouble having the bar graph contained within the axis. I tried adjusting the margin but it's still below the x-axis. Any suggestions would be appreciated. Thankyou
this is my margin:
margin = {
top: 70,
right: 20,
bottom: 70,
left: 70
},
width = 600 - margin.left - margin.right,
height = 400 - margin.top - margin.bottom,
padding = 15;
d3.js graph
New contributor
Madeline is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
@Robert Andersson Thank you for your quick response. if I'm understanding you correctly. I should replace this code:var y_domain = d3.extent(NestbyDate, function(d) { return d.values;
For thi ` var y_domain = d3.max(NestbyDate, function(d) { return d.values.length;` Right? Sorry if for my lack of knowledge question.
– Madeline
Nov 19 at 11:52
Rober Andersson's solution: But you need to adjust your y_domain variable so that it calculates the max value in your dataset, again because you're nesting the data it would look like this:var y_domain = d3.max(NestbyDate, function(d) { return d.values.length; });
and in youry.domain()
you sety.domain([0, y_domain])
– @Robert Andersson Thank you very much Robert. I learn a lot from you today.
– Madeline
2 days ago
No problem! If you solved it you can delete the question, otherwise please post all the code as either a snippet here on stackoverflow or on plunker/jsfiddle (for example) so we can help you more easily.
– Robert Andersson
2 days ago
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm having trouble having the bar graph contained within the axis. I tried adjusting the margin but it's still below the x-axis. Any suggestions would be appreciated. Thankyou
this is my margin:
margin = {
top: 70,
right: 20,
bottom: 70,
left: 70
},
width = 600 - margin.left - margin.right,
height = 400 - margin.top - margin.bottom,
padding = 15;
d3.js graph
New contributor
Madeline is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I'm having trouble having the bar graph contained within the axis. I tried adjusting the margin but it's still below the x-axis. Any suggestions would be appreciated. Thankyou
this is my margin:
margin = {
top: 70,
right: 20,
bottom: 70,
left: 70
},
width = 600 - margin.left - margin.right,
height = 400 - margin.top - margin.bottom,
padding = 15;
d3.js graph
d3.js graph
New contributor
Madeline is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Madeline is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Madeline is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked Nov 19 at 11:34
Madeline
105
105
New contributor
Madeline is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
Madeline is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Madeline is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
@Robert Andersson Thank you for your quick response. if I'm understanding you correctly. I should replace this code:var y_domain = d3.extent(NestbyDate, function(d) { return d.values;
For thi ` var y_domain = d3.max(NestbyDate, function(d) { return d.values.length;` Right? Sorry if for my lack of knowledge question.
– Madeline
Nov 19 at 11:52
Rober Andersson's solution: But you need to adjust your y_domain variable so that it calculates the max value in your dataset, again because you're nesting the data it would look like this:var y_domain = d3.max(NestbyDate, function(d) { return d.values.length; });
and in youry.domain()
you sety.domain([0, y_domain])
– @Robert Andersson Thank you very much Robert. I learn a lot from you today.
– Madeline
2 days ago
No problem! If you solved it you can delete the question, otherwise please post all the code as either a snippet here on stackoverflow or on plunker/jsfiddle (for example) so we can help you more easily.
– Robert Andersson
2 days ago
add a comment |
@Robert Andersson Thank you for your quick response. if I'm understanding you correctly. I should replace this code:var y_domain = d3.extent(NestbyDate, function(d) { return d.values;
For thi ` var y_domain = d3.max(NestbyDate, function(d) { return d.values.length;` Right? Sorry if for my lack of knowledge question.
– Madeline
Nov 19 at 11:52
Rober Andersson's solution: But you need to adjust your y_domain variable so that it calculates the max value in your dataset, again because you're nesting the data it would look like this:var y_domain = d3.max(NestbyDate, function(d) { return d.values.length; });
and in youry.domain()
you sety.domain([0, y_domain])
– @Robert Andersson Thank you very much Robert. I learn a lot from you today.
– Madeline
2 days ago
No problem! If you solved it you can delete the question, otherwise please post all the code as either a snippet here on stackoverflow or on plunker/jsfiddle (for example) so we can help you more easily.
– Robert Andersson
2 days ago
@Robert Andersson Thank you for your quick response. if I'm understanding you correctly. I should replace this code:
var y_domain = d3.extent(NestbyDate, function(d) { return d.values;
For thi ` var y_domain = d3.max(NestbyDate, function(d) { return d.values.length;` Right? Sorry if for my lack of knowledge question.– Madeline
Nov 19 at 11:52
@Robert Andersson Thank you for your quick response. if I'm understanding you correctly. I should replace this code:
var y_domain = d3.extent(NestbyDate, function(d) { return d.values;
For thi ` var y_domain = d3.max(NestbyDate, function(d) { return d.values.length;` Right? Sorry if for my lack of knowledge question.– Madeline
Nov 19 at 11:52
Rober Andersson's solution: But you need to adjust your y_domain variable so that it calculates the max value in your dataset, again because you're nesting the data it would look like this:
var y_domain = d3.max(NestbyDate, function(d) { return d.values.length; });
and in your y.domain()
you set y.domain([0, y_domain])
– @Robert Andersson Thank you very much Robert. I learn a lot from you today.– Madeline
2 days ago
Rober Andersson's solution: But you need to adjust your y_domain variable so that it calculates the max value in your dataset, again because you're nesting the data it would look like this:
var y_domain = d3.max(NestbyDate, function(d) { return d.values.length; });
and in your y.domain()
you set y.domain([0, y_domain])
– @Robert Andersson Thank you very much Robert. I learn a lot from you today.– Madeline
2 days ago
No problem! If you solved it you can delete the question, otherwise please post all the code as either a snippet here on stackoverflow or on plunker/jsfiddle (for example) so we can help you more easily.
– Robert Andersson
2 days ago
No problem! If you solved it you can delete the question, otherwise please post all the code as either a snippet here on stackoverflow or on plunker/jsfiddle (for example) so we can help you more easily.
– Robert Andersson
2 days ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Madeline is a new contributor. Be nice, and check out our Code of Conduct.
Madeline is a new contributor. Be nice, and check out our Code of Conduct.
Madeline is a new contributor. Be nice, and check out our Code of Conduct.
Madeline is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53373774%2fbar-graph-not-within-axis%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
@Robert Andersson Thank you for your quick response. if I'm understanding you correctly. I should replace this code:
var y_domain = d3.extent(NestbyDate, function(d) { return d.values;
For thi ` var y_domain = d3.max(NestbyDate, function(d) { return d.values.length;` Right? Sorry if for my lack of knowledge question.– Madeline
Nov 19 at 11:52
Rober Andersson's solution: But you need to adjust your y_domain variable so that it calculates the max value in your dataset, again because you're nesting the data it would look like this:
var y_domain = d3.max(NestbyDate, function(d) { return d.values.length; });
and in youry.domain()
you sety.domain([0, y_domain])
– @Robert Andersson Thank you very much Robert. I learn a lot from you today.– Madeline
2 days ago
No problem! If you solved it you can delete the question, otherwise please post all the code as either a snippet here on stackoverflow or on plunker/jsfiddle (for example) so we can help you more easily.
– Robert Andersson
2 days ago