Comments (3)
// 显示数据0 如果只是不想手动加数据0 这个函数希望可以帮到你。
var not_repeat=function(arr,f){ var ret={}; arr.forEach(o=>{ ret[o]=0; }); return Object.keys(ret); };
var data_value_0=function(data){
var name_type={},name_list=[],date_list=[],ret_data=data;
data.forEach(o=>{ name_type[o.name]=o.type; });
name_list=Object.keys(name_type);
date_list=not_repeat(data.map(o=>o.date));
date_list.forEach(date=>{
var _name_list={};
data.forEach(d=>{ if(d.date==date){ _name_list[d.name]=1; } });
name_list.forEach(name=>{
if(_name_list[name]!=1){ ret_data.push({name:name,type:name_type[name],value:0,date:date}); }
})
});
return ret_data;
};
from historical-ranking-data-visualization-based-on-d3.js.
你可以添加一行0值的数据达到这种效果
from historical-ranking-data-visualization-based-on-d3.js.
事实上目的就是不希望添加这一行0,这样操作有点麻烦
from historical-ranking-data-visualization-based-on-d3.js.
Related Issues (20)
- 如果数据是精确到年的,请问如何设置数据值和config.js HOT 1
- 嘿兄弟,我需要你的帮助。印度尼西亚及以下的所有条形图都必须在黑色箭头上,而不是绿色箭头上。请解决我的问题
- 不做历史排名怎么考这个框架实现呢?
- 存在颜色没有正常上色的情况 HOT 2
- 有折线图版本的吗
- 如果都是非常小的浮点数,横坐标一直是10,不会自适应,视野里条形图非常非常短
- 请教大佬,可以实现不同条目随机配色不出现重复颜色吗? HOT 1
- 有关 MacOS Chrome 兼容性问题 HOT 2
- 标记长度问题 HOT 1
- 这个能用python的Bokeh实现吗?
- 请问最新版本的要如何将横向的柱状图改为竖向的啊? HOT 1
- 如何改造成可以体现正负值
- 图片消失时会径直下坠,而不是跟着Bar 缩短然后消失,导致二者分离。 HOT 2
- 请问怎么把图片调大一点?How can I make the picture bigger?
- baragrph 出问题了 HOT 1
- Is it possible to describe another CSV format? HOT 1
- BUG,柱子动画有重复 HOT 2
- 选择example无任何反应 HOT 5
- 为什么选择文件之后没有反应 HOT 2
- TypeError: Cannot read property 'toString' of undefined HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from historical-ranking-data-visualization-based-on-d3.js.