-
Notifications
You must be signed in to change notification settings - Fork 55
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
How can I use this #1
Comments
Hi, To help you further, could you help me understand your situation a bit better? |
Thx for answering.
thx |
You have to include SentenTree javascript file in the html. <!DOCTYPE html>
<html>
<body>
<div id="vis"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.9.1/d3.min.js"></script>
+ <script src="https://rawgit.com/twitter/SentenTree/master/dist/sententree.min.js"></script>
<script>
d3.tsv("why_lost.tsv", function(error, data) {
+ const model = new SentenTree.SentenTreeBuilder()
.buildModel(data);
+ new SentenTree.SentenTreeVis('#vis')
// change the number to limit number of output
.data(model.getRenderedGraphs(3))
.on('nodeClick', node => {
console.log('node', node);
});
});
</script>
</body>
</html> Please give it a try and let me know. |
Those are the errors left:
|
Umm, SentenTree has 5 dependencies. (See package.json) You already include d3, but you will also need these packages.
|
Thx for the patience :) |
What I meant was you will need to add
|
Here is my code:
and I get the following error message in console:
What am I doing wrong? EDIT: Perhaps webpack is messing with the heap library? I tried to load the non minified SentenTree.js and this seems to be happening at line 1654 when creating the heap in the function expandSeqTree Also, I'm not sure I'm loading a file in the right format |
Any news on this? |
I just add another bundle that bundle all dependencies. Let's give the code below a try. <!DOCTYPE html>
<html>
<body>
<div id="vis"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.9.1/d3.min.js"></script>
<script src="https://rawgit.com/twitter/SentenTree/master/dist/sententree-standalone.min.js"></script>
<script>
d3.tsv("goal.tsv", function(error, data) {
const model = new SentenTree.SentenTreeBuilder().buildModel(data);
new SentenTree.SentenTreeVis('#vis')
.data(model.getRenderedGraphs(3))
.on('nodeClick', node => {
console.log('node', node);
});
});
</script>
</body>
</html> |
It doesn't work either for me.
|
Is there any error in the javascript console? |
No there are no errors in the console. |
I found the issue. <!DOCTYPE html>
<html>
<body>
<div id="vis"></div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/4.9.1/d3.min.js"></script>
<script src="https://rawgit.com/twitter/SentenTree/master/dist/sententree-standalone.min.js"></script>
<script>
d3.tsv("demo.tsv", function(error, data) {
data.forEach(d => {
d.count = +d.count;
})
const model = new SentenTree.SentenTreeBuilder().buildModel(data);
new SentenTree.SentenTreeVis('#vis')
.data(model.getRenderedGraphs(3))
.on('nodeClick', node => {
console.log('node', node);
});
});
</script>
</body>
</html> |
Why was this closed there still no working example ?:/ |
Did you try the latest comment above? |
Consider it close this thing is working for me:
|
I have the same problem with etrabelsi. The final code etrabelsi offers also works for me.
Here is my code:
What should I do TAT |
@Vvvickie Please add header row to your data file
https://github.com/twitter/SentenTree/blob/master/demo/data/demo.tsv |
@kristw It works now. Thank you for your reply! |
Hi,
I cant manage to use that cool tool.
I have installed it , now what? even if i clone the repo and run the demo it doesnt seem to work like in the site.
The text was updated successfully, but these errors were encountered: