Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing bar in simple collumn graph #20

Closed
dnbard opened this issue Jul 28, 2014 · 12 comments
Closed

Missing bar in simple collumn graph #20

dnbard opened this issue Jul 28, 2014 · 12 comments

Comments

@dnbard
Copy link

dnbard commented Jul 28, 2014

Hello. I'm using d4 and my graph missing one bar:
example

Still it's present in data model:
data model

Code:

for(var i = window.data.length - 1; i >= 0; i --){
    graphData.push({
        x: i + 1,
        y: window.data[i].count
    });
}

var columnChart = d4.charts.column().outerWidth(900);
d3.select('#graph').datum(graphData).call(columnChart);

Any help is appreciated ;)

@heavysixer
Copy link
Owner

Would it be possible to see this as a Fiddle so that I can see the issue in action?

Thanks!

@dnbard
Copy link
Author

dnbard commented Jul 28, 2014

@heavysixer Please take a look http://jsfiddle.net/nbww6/ (I've used d3 and d4 libraries from my server, feel free to change them to some CDN or else if you need)

Also it's working fine with different declaration of x in graphData array. You can look at final graph @ http://brackets-rating.herokuapp.com/

@heavysixer
Copy link
Owner

Hey @dnbard I've started a fiddle example for you, can you flesh it out for me?

http://jsfiddle.net/558hQ/

@dnbard
Copy link
Author

dnbard commented Jul 28, 2014

I've added data to your fiddle http://jsfiddle.net/558hQ/1/ It still miss one bar.
Also, you can remove any number of objects in window.data array to watch that graph to see different missing bars.

@heavysixer
Copy link
Owner

Yes, you are right, very strange behavior indeed. I am porting this over to a test case so that I can inspect it closer and figure out what is going on.

@heavysixer
Copy link
Owner

I think it might be the way your for loop is being constructed. Check out the updated example:

http://jsfiddle.net/Qggv5/

I am still trying to understand what the difference is between the two, because the for loop you are using looks completely valid. The odd thing is that the x dimension in this case is an ordinal value, which means that its a categorical scale, not based on a linear progression. I am thinking this must have something to do with it.

@dnbard
Copy link
Author

dnbard commented Jul 28, 2014

It works this way. Still I don't understand what is wrong with loop in my example?

@heavysixer
Copy link
Owner

Yes, I have tracked the bug down and am working on a patch now. It is a coercion bug in how the key accessor is created by default. Will let you know when I've patched it, after I've tested everything again.

@heavysixer
Copy link
Owner

@dnbard Please update your copy of d4 and everything should work nicely for you. Thanks for finding and submitting this bug to me! Your fiddle example should work now too, because its bound to the latest version of d4.

@dnbard
Copy link
Author

dnbard commented Jul 29, 2014

Can i use the CDNs for d3.js and d4.js from that Fiddle in my projects ?

@heavysixer
Copy link
Owner

@dnbard I would not use the d4.js file because it is always bound to the latest master, and that should be considered unstable. I do believe that you can use the d3.js from the CDN but again I am not totally sure.

@dnbard
Copy link
Author

dnbard commented Jul 29, 2014

@heavysixer ok, I'll stick with stable version of libraries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants