1

Tributary (a rapid prototyping environment for d3.js) has some really great features. One of which is the tributary object which gives you easy access to your data files. For example, to load a json file (example.json) in tributary I can do something like:

var example = tributary.example;

My question is, how can I "extract" a tributary example that is using the tributary object into HTML and Javascript code. For example, I tried with this demo, by wrapping it in the following functions, but couldn't find success:

 d3.json("costofliving.json", function(col) {
  d3.json("worldcountries.json", function(countries) {
  });
 });

Any advice on how to go from a tributary demo that loads external json files to a HTML/Javascript demo would be greatly appreciated.

diasks2
  • 2,033
  • 2
  • 36
  • 61

1 Answers1

2

Append the svg to the dom and the width and height attributes... Moreover make the variables col and countries accessible ....I have tried the demo and it worked fine for me..

selvagsz
  • 3,852
  • 1
  • 24
  • 34
  • Thanks for your answer. I tried but I am still not having success. Your fiddle doesn't show any HTML. Should I have an empty body, or should I put in the following elements? ` ` – diasks2 Nov 23 '12 at 14:40
  • just try adding a empty body to the html... in my fiddle i would have used d3.select("body").append("svg") ... this appends the svg to the body... You can even try appending it to div or span or anything... – selvagsz Nov 23 '12 at 14:48
  • Thanks, I got it to work. I had an Illegal token error. I think I had picked up some whitespace copying and pasting from your jsfiddle (http://stackoverflow.com/questions/4404526/unexpected-token-illegal-in-webkit). – diasks2 Nov 23 '12 at 14:53