Sha256: a0bd332aff2503597db0ef0e68500f2a7e54cab3af04c357651074be5d8adcff

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

# MyChart.js

generate chart.js html with ruby

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'my_chart'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install my_chart

## Usage

suppose you want to have some statistic on mail files:

```ruby
MyChart.js do

  material do
    # load mail objects here
  end

  select :fail do |m|
    m.fail?
  end

  line :day, :fail?, w: 1280, h: 500, asc: :key

  bar :day, w: 1280, h: 500

  bar :day, w: 1280, h: 500, from: :fail

  output './mail_statistic.htm'
end
```

execute the script:

```sh
    $ mychart.js mail_st.rb
```

## Supported charts

bar, doughnut, line, pie, polar_area, radar are built-in with basic style

if you would like to add custom style, this is for your reference:

```ruby
class Bar < MyChartType::Proto

  def concrete_type
    :bar
  end

  def concrete_options
    {
       scales: {
         yAxes: [{
             ticks: {
                 beginAtZero:true
             }
         }]
       }
     }
  end

end
```

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
my_chart-0.1.3 README.md