Git Product home page Git Product logo

chart_rails's Introduction

TradingView Chart Library Rails Gem

version : 1.1.0

date : Dec. 26,2014

Description

This gem provides a simple way to use TradingView Chart Library for Ruby on Rails application.

Installation

Add this line to your application's Gemfile:

gem 'tv_chart_rails', :git => '[email protected]:bobstar6/tv_chart_rails.git'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install tv_chart_rails

Usage

  1. First of all, ensure your app include jquery.

  2. Add <%= javascript_include_tag 'trading_view_chart' %> to the template where need to insert tradingview chart.

  3. Use showTradingViewChart() to initialize a chart.

    <script type="text/javascript">
      showTradingViewChart();
    </script>
    

    You can find default params in tv_chart/vendor/javascripts/trading_view_chart.js. Initialize your chart by sending hash params to showTradingViewChart(). It will overwrite the default params.

  4. Put this line to your html page where you want to insert chart.

    <div id="tv_chart_container"></div>

    You can change the id with hash params.

    eg.

    showTradingViewChart({ container_id: 'my_own_chart' })

    then add this line

    <div id="my_own_chart"></div>

  5. If you want to use your own datafeed.js, you can replace it at tv_chart/vendor/javascritps/charting_library/datafeed/datafeed.js

Note

  1. when develop your own datafeed, do not use the word 'config' as a method name for route like 'demo_feed.tradingview.com/config', change the word or remap route.

  2. if your use the default datafeed.js, you should know this datafeed will use Json.parse to parse the response from ajax request.

chart_rails's People

Contributors

noname2001 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.