Sha256: a9751f2190c5fe422dde86b486e9a11b891d5f57dbf8d24d6a2ccf52089fafd8

Contents?: true

Size: 1.38 KB

Versions: 3

Compression:

Stored size: 1.38 KB

Contents

# Chart JS

[Chart JS](http://www.chartjs.org/) is a simple yet flexible JavaScript charting library. This [gem](https://rubygems.org/) is a Ruby [Domain Specific Language](https://en.wikipedia.org/wiki/Domain-specific_language) which allows you to easily build charts without touching a single line of JavaScript or HTML.

## Installation

    $ gem install chart_js

## Usage

A simple example to generate a static html file.

```ruby
require "chart_js"

ChartJS.line do
  file "example.html"
  data do
    labels ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
    dataset "Cats" do
      color :random
      data [12, 19, 3, 5, 2, 3]
    end 
    dataset "Dogs" do
      color :random
      data [10, 12, 3, 4, 5, 3]
    end 
  end
end
```

## Web Framework Integration

`chart_js` plays well with others.

```ruby
require "chart_js"
require "sinatra"

get "/" do
  chart = ChartJS.line do
    data do
      labels ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
      dataset "Cats" do
        color :random
        data [12, 19, 3, 5, 2, 3]
      end 
      dataset "Dogs" do
        color :random
        data [10, 12, 3, 4, 5, 3]
      end 
    end
  end
  chart.to_html
end
```

## Screenshot

![example](https://i.imgur.com/kFl4efW.png)

## License

The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chart_js-1.1.1 README.md
chart_js-1.1.0 README.md
chart_js-1.0.0 README.md