Skip to content

Sample app that takes user entered numbers and generates a slick D3 chart for it.

Notifications You must be signed in to change notification settings

jessewaites/rails_d3_demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a Rails / D3 Demo.

![Image]()

Pull it down or git clone it, then bundle install, then hit localhost:3000 - Add a new “Favorite” with comma separated numbers, such as:

Numbers: 7,4,8,3,9,22

Color: Blue

Movie: Pulp Fiction

You will then be redirected to the show page and can see your fancy D3 chart.

The magic happens in this method in the controller:

def make_jsonish(array)

elements = array.each_with_index.map { |num, i|
  { key: i, value: num}
}

end

And by using this in the javascript:

var dataset = <%= raw JSON.pretty_generate @jsonish %> ;

About

Sample app that takes user entered numbers and generates a slick D3 chart for it.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published