timelyportfolio / searchtree Goto Github PK
View Code? Open in Web Editor NEWThis project forked from yonicd/d3tree
This project forked from yonicd/d3tree
ggtree(
list(
root = d3r::d3_nest(
Titanic%>%data.frame%>%mutate(value=NA)%>%distinct,
),
layout = "collapse"
),
name="name"
)
Our servers are still running older R versions (3.2.3)
I dont think it should make much difference to the widget for it to be from 3.2.0
#Doesnt give the value column in the leaves when branch fully grown
Titanic%>%as.data.frame
#Does give the value column in the leaves when branch fully grown
Titanic%>%data.frame%>%mutate(value=NA)%>%distinct
#Current Call
#d3_nest doesnt nest in the correct order for ggtree.js making the links float to the last open parent
ggtree(
list(
root = d3r::d3_nest(
Titanic%>%data.frame%>%mutate(value=NA)%>%distinct,
value_cols = "Freq"
),
layout = "collapse"
),
name = "id",
value = "colname"
)
#Call with old df2tree function
#df2tree nests in the correct order for ggtree.js giving a unique parent for each child
ggtree(
list(
root=df2tree(Titanic%>%data.frame%>%mutate(value=NA)%>%distinct),
layout = "collapse"
),
name = "name",
value = "value"
)
#Compare different nesting orders visually
jsonedit(d3r::d3_nest(
Titanic%>%data.frame%>%mutate(value=NA)%>%distinct,
value_cols = "Freq",
json = F
))
jsonedit(df2tree(Titanic%>%data.frame%>%mutate(value=NA)%>%distinct))
can you add this function to the js code to have text wrap on the tree? or switch out the .text()
attr for .html()
attr so users can input to names <br/>
?
http://bl.ocks.org/mbostock/7555321
function wrap(text, width) {
text.each(function() {
var text = d3.select(this),
words = text.text().split(/\s+/).reverse(),
word,
line = [],
lineNumber = 0,
lineHeight = 1.1, // ems
y = text.attr("y"),
dy = parseFloat(text.attr("dy")),
tspan = text.text(null).append("tspan").attr("x", 0).attr("y", y).attr("dy", dy + "em");
while (word = words.pop()) {
line.push(word);
tspan.text(line.join(" "));
if (tspan.node().getComputedTextLength() > width) {
line.pop();
tspan.text(line.join(" "));
line = [word];
tspan = text.append("tspan").attr("x", 0).attr("y", y).attr("dy", ++lineNumber * lineHeight + dy + "em").text(word);
}
}
});
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.