关于在哪里开始使用d3制作小提琴图表的任何想法?它已经存在了吗?
我环顾四周,已经想出如何使用ggplot2做这件事,并希望有一个现成的例子,我可以从中学到但还没有找到.
我想我可以做一个非常痛苦的过程,在彼此之上制作各种尺寸的条形图,或者进行分布,旋转并镜像它.但肯定有更好的方法.
我正在使用d3.nest()来从CSV文件创建分层对象.
你能帮我理解为什么以下代码不起作用.我没有设法在循环中使用嵌套函数,如下所述.
我有以下CSV文件,取自d3网站上的示例:
"type1","type2","type3","type4","type5","size"
"flare","analytics","cluster","AgglomerativeCluster","","3938"
"flare","analytics","cluster","CommunityStructure","","3812"
"flare","analytics","cluster","MergeEdge","","743"
"flare","analytics","graph","BetweennessCentrality","","3534"
"flare","analytics","graph","LinkDistance","","5731"
Run Code Online (Sandbox Code Playgroud)
这个基本的嵌套工作原理:
data = data.entries(csv)
.key(function(d) {return d.type1; })
.key(function(d) {return d.type2; })
.key(function(d) {return d.type3; })
.entries(csv);
Run Code Online (Sandbox Code Playgroud)
我想使用一个值数组来指定我的键,以便动态地修改它们.
这有效:
var data = d3.nest();
var nesting = ["type1","type2","type3"];
data = data.key(function(d) {return d[nesting[0]]; });
data = data.key(function(d) {return d[nesting[1]]; });
data = data.key(function(d) {return d[nesting[2]]; });
data = data.entries(csv);
Run Code Online (Sandbox Code Playgroud)
但它不适用于循环......
var data = d3.nest();
for(var i=0;i<nesting.length;i++)
{
data = data.key(function(d) {return d[nesting[i]]; });
}
data = data.entries(csv);
Run Code Online (Sandbox Code Playgroud)
我无法理解为什么循环版本不起作用...也许我想念d3.nest()功能...
此外,我想知道是否有一种方法可以"跳过"嵌套级别,如果此级别没有任何内容填充(即:上面提取的所有行中的"type5"级别).我怎么能这样做?
非常感谢阅读!
I am using d3 to make a chart with multiple paths. I am displaying the path(s) description on the left hand side. The data & descriptions are dynamic so the size of the legend is naturally also dynamic, since it is not a big deal as long as I know the size of the text (just a minor adjustment to the domain/range). The problem is that I do not see an easy way to find the size of the text …
操作系统启动时是否有一种简单的启动Fuseki的方法,或多或少像我们可以从/etc/init.d/tomcat7 start或/etc/init.d/elasticsearch start启动 Tomcat或ElasticSearch实例?
据我所知,Fuseki似乎没有状态方法,而且它似乎没有类似于这个/etc/init.d/技巧.
我正在使用D3和JSON数据,其功能类似于:
d3.json("http://api.json", function(jsondata) {
var data = jsondata.map(function(d) { return d.number; });
Run Code Online (Sandbox Code Playgroud)
这导致数据相等 ["2", "5", "8", "12"]
然后,如果我使用:
var x = d3.scale.linear()
.domain([0, d3.max(data)])
返回的最大值是8而不是12.我意识到这是因为8大于1中的1,但我不知道如何解决这个问题.谢谢!
最近我一直在阅读有关javascript模式,以及如何使用模块模式来避免全局变量.当我查看d3.js 层次结构布局源代码时,我不确定下面是否有意.
d3.layout.hierarchy 是使用模块模式,但最后,我看到它外面的许多方法,我想这只适用于布局及其派生对象(分区,树..).
d3_layout_hierarchyRebind
d3_layout_hierarchyChildren
d3_layout_hierarchyValue
..
Run Code Online (Sandbox Code Playgroud)
这是故意的,还是应该在模块中捕获?
与旋转相结合的过渡具有奇怪的结果.
这是我的问题的小提琴:http://jsfiddle.net/emperorz/E3G3z/1/ 尝试点击每个方块以查看不同的行为.
请原谅被黑客入侵的代码,但如果我使用带有旋转的转换(和x/y放置),那么它就会循环.
我试过了:
1)所有在变换(旋转然后翻译),这似乎大多没关系.有点不稳定.
2)只需在变换中旋转,使用x/y属性定位.飞到各处,但最终到达正确的位置.很奇怪.
3)所有在变换中(平移然后旋转),飞走,并最终在(完全)错误的地方.
嗯.奇怪.
是否有正确的方法来旋转带有过渡的形状?
直观地说,如果第二种选择有效,那就太好了.
谢谢