Sha256: 78f690ffaa75c06f73c1026e12abb2bfa6234d14fec03f5baae913c72b15ce29
Contents?: true
Size: 1.97 KB
Versions: 1
Compression:
Stored size: 1.97 KB
Contents
# Kitechart A data formatter and highcharts drilldown wrapper gem Sponsored by [tworedkites](http://tworedkites.com/). ## Installation Add this line to your application's Gemfile: ```ruby gem 'kitechart', '~> 0.1.0' ``` And then execute: $ bundle Or install it yourself as: $ gem install kitechart Then add this line to your application.js file ``` //= require kitechart ``` ## Useage To setup a two level drilldown highchart add the following code to your project. This is the code contained in the view file ``` <div id="container" class="ui container" style="min-width: 310px; height: 400px; margin: 0 auto"></div> ``` This is the code contained in the views javascript file ``` $(function () { 'use strict'; window.Kites = { getData: function () { $.getJSON($(location).attr('href')+'kites.json').then(function (data) { Chart.generateChart('Kites By Color', 'Count', 'column', data['colors'], data['size'], data['material']); }); } }; }); ``` This is the code contained in the controller file ``` class KitesController < ApplicationController def index @kites = Kite.all respond_to do |format| format.html format.json do colors, size, material = get_json_data render json: { colors: colors, size: size, material: material } end end end private def get_json_data Kitechart::DataFormatter.new(@kites, 'color', 'size', 'material').get_data end end ``` ## Demo The demo app webpage for the kitechart gem is viewable [here](https://protected-shore-59130.herokuapp.com/) The demo app codebase can also be viewed [here](https://github.com/Mbuckley0/kitechart) ## Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/mbuckley0/kitechart. ## License The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kitechart-0.1.0 | README.md |