Git Product home page Git Product logo

nvd3-rails's Introduction

NVD3 Rails - reusable charts for rails 3

Install

To include nvd3-rails into your rails project add

gem "nvd3-rails", :git => "[email protected]:adeven/nvd3-rails.git", :submodules => true

To your Projects Gemfile.

To add the necessary javascript files into your asset pipeline add

//= require nvd3-rails

in app/assets/javascripts/application.js

also add

*= require nvd3-rails

in app/assets/stylesheets/application.css

Note as of today nvd3 clutters the model naming e.g. lineWithFisheyeChart.js and lineChart.js export their model both as lineChart. If you only need a subset of models e.g. lineChart you can add

//= require nvd3/lib/d3.v2
//= require nvd3/src/core
//= require nvd3/src/tooltip
//= require nvd3/src/utils.js
//= require nvd3/src/models/lineChart
//= require nvd3/src/models/legend.js
//= require nvd3/src/models/axis.js
//= require nvd3/src/models/scatter.js
//= require nvd3/src/models/line.js

to your application.js

Contribution Guide

Updating Submodules

The repository uses submodules following are the steps to manually get the submodules:

git clone https://github.com/adeven/nvd3-rails.git
cd nvd3-rails
git submodule init
git submodule update

Or:

git clone https://github.com/adeven/nvd3-rails.git
cd nvd3-rails
git submodule update --init

Or:

git clone --recursive https://github.com/adeven/nvd3-rails.git
cd nvd3-rails

If you want to work inside a submodule, it is possible, but first you need to checkout a branch:

cd vendor/assets/javascripts/nvd3
git checkout master

After you've committed your changes to the submodule, you'll update the nvd3-rails project to point to the new commit, but remember to push the submodule changes before pushing the new nvd3-rails commit:

cd vendor/assets/javascripts/nvd3
git push origin master
cd ..
git add vendor/assets/javascripts/nvd3
git commit

cleaning

If you want to purge your working directory back to the status of upstream, following commands can be used (remember everything you've worked on is gone after these):

git reset --hard upstream/master git clean -fdx

Using a local copy during development

Nvd3-rails gets added as a Rails::Engine to your project.

Generally during development you want your main application to include a local development copy of your engine. You should be able to add gem groups for each Rails environment to your Gemfile, like this:

group :development do
    gem "nvd3-rails", :path => "../nvd3-rails"
end

group :production do
    gem "nvd3-rails", :git => "git://github.com/adeven/nvd3-rails.git"
end

In Bundler 1.1 and earlier, that generates this error message: "You cannot specify the same gem twice coming from different sources." This should be fixed in 1.2 rubygems/bundler#751

There are several work arounds for this, however I sugest to update to the latest version of bundle.

nvd3-rails's People

Contributors

n0nick avatar omnikron avatar rapimo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.