Facebook Pixel

Ruby and MySQL Integration Template

This example shows how to use AnyChart library with the Ruby on Rails and MySQL database.
View on GitHub


To use this sample you must have Ruby installed, as described at Ruby installation page; Rails installed, if not, you can visit official Rails guide or if you don't have both ruby and rails, you can follow this tutorial; MySQL installed and running, if not please check out MySQL download page and follow instructions;

To check your installations, run the following command in the command line:

$ ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux] # sample output

$ mysql --version
mysql  Ver 14.14 Distrib 5.5.52, for debian-linux-gnu (x86_64) using readline 6. # sample output

$ rails -v
Rails # sample output

To start this example run commands listed below.

Clone the repository from github.com:

$ git clone git@github.com:anychart-integrations/ruby-rails-mysql-template.git

Navigate to the repository folder:

$ cd ruby-rails-mysql-template

Set up MySQL database, use -u -p flags to provide username and password:

$  mysql < database_backup.sql

Run example:

$ rails server

Open browser at http://localhost:3000/


Your workspace should look like:

            main_controller.rb  # main web controller
            fruit.rb    # model for fruit item
                index.html.erb  # html template to render chart
        database.yml    # database settings
        routes.rb       # web routes
            style.css       # css style
    database_backup.sql     # MySQL database dump

You can view additional information about Rails here http://guides.rubyonrails.org/


Further Learning


AnyChart Ruby on Rails/MySQL integration sample includes two parts:

  • Code of the integration sample that allows to use Javascript library (in this case, AnyChart) with Ruby on Rails and MySQL database. You can use, edit, modify it, use it with other Javascript libraries without any restrictions. It is released under Apache 2.0 License.
  • AnyChart JavaScript library. It is released under Commercial license. You can test this plugin with the trial version of AnyChart. Our trial version is not limited by time and doesn't contain any feature limitations. Check details here.

If you have any questions regarding licensing - please contact us. sales@anychart.com