Example displaying a chart using Ruby and Sinatra
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
views
README.md
server.rb

README.md

Ruby > Sinatra

Making a Chart from a URL

  1. Download or clone this repo.

  2. From inside this directory, run ruby server.rb in the command line.

  3. Naviage to this example in your favorite browser. If a chart appears, you're set!

  4. Change the title parameter in the path to be equal to My+New+Chart. The pluses get interpretted as spaces on the client side. Your path should now look like this... localhost:4567/?title=My+New+Chart&type=line&series=[[1,4,3,12,33,16,42,97]] Did the title update in your chart? Whoa! Cool!

  5. Change the type parameter in the path to equal bar. The path should now look like this... localhost:4567/?title=My+New+Chart&type=bar&series=[[1,4,3,12,33,16,42,97]] Did the chart change to a bar chart? How slick!

  6. Try adding a new array of values to the path. It should look like this... localhost:4567/?title=My+New+Chart&type=bar&series=[[1,4,3,12,33,16,42,97],[* NEW VALUES GO IN HERE *]] Your chart should now have a second series of data. Coolio!

Using Already Formatted JSON

  1. Download or clone this repo.

  2. From inside that directory, run ruby server.rb in the command line.

  3. Naviage to this JSON example in your favorite browser. If a chart appears, you're set!

  4. Want to use your own chart? Copy your JSON (or any JSON your find on our site and paste into this form. It will take the JSON and URI encode it.

  5. Replace the existing info after localhost:4567/json/ with the formatted info. Navigate to that address.

  6. If everything worked, you should have a new chart!