fzaninotto / CodeFlower

Source code visualization utility written in JavaScript with d3.js. Does your code look beautiful?
http://www.redotheweb.com/CodeFlower
MIT License
694 stars 321 forks source link

index.html file is not showing code flower #4

Closed YellowBlueFrog closed 11 years ago

YellowBlueFrog commented 11 years ago

Hi, I would love to use your code flower on my site but when I try to make my own the
<div id="visualization"></div> remains blank. I came across the same error when trying out your index.html file. I know this is not a rare file corruption issue because I downloaded and unzipped your code twice but came across the same problem.

Since I am contacting you now I suppose I can also tell you that the example CodeFlower() instance on your webpage says "myflower" instead of "myFlower". ;)

Lastly, is "jasonData" on the same page the String address to the .json file?

Thank you for helping!

fzaninotto commented 11 years ago

Do you have a fork I can test?

YellowBlueFrog commented 11 years ago

I do, but I have not been testing off of my fork; so my fork will look like your original code. I have noticed that the code flower appears when I go to your page, but is does not run from the downloaded zip. Feel free to use my fork if you wish.

fzaninotto commented 11 years ago

Did you look at the JS logs in your browser console?

I believe there might be one cause: d3.json() data loader (used in https://github.com/fzaninotto/CodeFlower/blob/master/index.html#L144) needs a server, it doesn't accept to serve files with relative path names. So my advice would be to start a server from the CodeFlower root (e.g. using jekyll) and try again

YellowBlueFrog commented 11 years ago

You were right about that, and when I put the folder on a server that error went away. However, now the console is throwing two errors: GET mysite.com/code_flower/code_flower/data.json 404 (Not Found) d3.js:421 Uncaught TypeError: Cannot read property 'children' of null

The second error is probably caused from the first error.

YellowBlueFrog commented 11 years ago

Never mind, I found out what the problem was. The server we used did not have json imported onto it. Thank you for your help, it is working now. :)