This example shows how to use Anychart library with the Groovy programming language, Grails framework and MySQL database.
To use this sample you must have Groovy, Gradle, Grails installed on your computer; You can use SDKMAN to install them:
$ curl -s get.sdkman.io | bash
$ source "$HOME/.sdkman/bin/sdkman-init.sh"
$ sdk install groovy
$ sdk install gradle
$ sdk install grails
Also you must have MySQL installed and running (if not please check out https://dev.mysql.com/downloads/installer/ and follow instructions http://dev.mysql.com/doc/refman/5.7/en/installing.html)
To check your installations, run the following command in the command line:
$ groovy -version
Groovy Version: 2.4.12 JVM: 1.8.0_131 Vendor: Oracle Corporation OS: Linux
$ gradle -version
------------------------------------------------------------
Gradle 4.0.2
..
$ grails -version
| Grails Version: 3.3.0
| Groovy Version: 2.4.11
| JVM Version: 1.8.0_13
$ mysql --version
mysql Ver 14.14 Distrib 5.5.52, for debian-linux-gnu (x86_64) using readline 6. # sample output
To start this example run commands listed below.
Clone the repository from github.com:
$ git clone git@github.com:anychart-integrations/groovy-grails-mysql-template.git
Navigate to the repository folder:
$ cd groovy-grails-mysql-template
Set up MySQL database, use -u -p flags to provide username and password:
$ mysql < database_backup.sql
Run template:
$ grails run-app
Open browser at http://localhost:8080/
Your workspace should look like:
groovy-grails-mysql-template/
... some stuff created by grails new-app
grails-app/
assets/
...
stylesheets/
chart.css # css style
conf/
...
application.yml # base application and MySQL database settings
controllers/
groovy.grails.mysql.template/
ChartController.groovy # controller to display chart
UrlMappings.groovy # app routes
domain/
groovy.grails.mysql.template/
Fruit.groovy # base model
...
views/
chart/
index.gsp # html template for chart displaying
build.gradle #gradle settings
database_backup.sql # MySQL database dump
gradle.properties
gradlew
gradlew.bat
grails-wrapper.jar
grailsw
grailsw.bat
README.md
LICENSE
Language - Groovy
Framework - Grails
Build tool - Gradle
Database - MySQL
Database mapping GORM
© AnyChart.com - JavaScript charts. Released under the Apache 2.0 License.