堆积的条形图逆转 [英] Stacked bar chart reversed
本文介绍了堆积的条形图逆转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我创建了一个条形图,您可以在此链接中看到它:
解决方案
d3.csv(fullpath.csv,function(error,data){data.forEach(function(d){
arr [d.User_ID] = 0;
});
var margin = {
//...rest of code ...
I have little problem. I created a bar chart , you can see it on this link: Stacked Bar Chart
The problem is that if you refresh 2-3 times this page , it will reverse the bar charts like that:
why it's happen? and how can I solve it?
Thanks!!
and the CSV file in this link: CSV file
解决方案
You need to put all your processing inside the asynchronous d3.csv() call.
See this PLUNK.
d3.csv("fullpath.csv", function(error, data) {
data.forEach(function(d) {
arr[d.User_ID] = 0;
});
var margin = {
//...rest of code...
这篇关于堆积的条形图逆转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文