Socket
Book a DemoInstallSign in
Socket

ncr-lazy_high_charts

Package Overview
Dependencies
Maintainers
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ncr-lazy_high_charts

1.1.1
bundlerRubygems
Version published
Maintainers
3
Created
Source

LazyHighCharts

  • Test Environment ruby 1.8.7 (2009-12-24 patchlevel 248) [i686-linux], MBARI 0x8770, Ruby Enterprise Edition 2010.01 rspec 2.0.0.beta.22 rails 3.0.0

plugin support for rails 2.3.5 and rails 3

gem support in branch gem_support , only for rails 3

Usage

Usage in Controller:

 @h = HighChart.new('graph') do |f|
    f.series(:name=>'John', :data=>[3, 20, 3, 5, 4, 10, 12 ,3, 5,6,7,7,80,9,9])
    f.series(:name=>'Jane', :data=> [1, 3, 4, 3, 3, 5, 4,-46,7,8,8,9,9,0,0,9] )
  end

Without overriding entire option , (only change a specific option index):

 @h = HighChart.new('graph') do |f|
  .....
      f.options[:chart][:defaultSeriesType] = "area"
      f.options[:chart][:inverted] = true
      f.options[:legend][:layout] = "horizontal"
      f.options[:x_axis][:categories] = ["uno" ,"dos" , "tres" , "cuatro"]
 ......

Overriding entire option:

 @h = HighChart.new('graph') do |f|
   .....
      f.x_axis(:categories => @days.reverse! , :labels=>{:rotation=>-45 , :align => 'right'})
      f.chart({:defaultSeriesType=>"spline" , :renderTo => "myRenderArea" , :inverted => true})
   .....

Usage in layout:

<%= javascript_include_tag 'highcharts' %>

Usage in view:

<%= high_chart("my_id", @h) %>

Passing formatting options in the view to the helper block , because all the helper options declared in the controller are converted in strict/valid json (quoted key); so we need to extend the json object with some js.

  <% high_chart("my_id", @h) do |c| %>
     	<%= "options.tooltip.formatter = function() { return '<b>HEY!!!'+ this.series.name +'</b><br/>'+ this.x +': '+ this.y +' units';}" %>
     	<%= "options.xAxis.labels.formatter = function() { return 'ho';}" %>
     	<%= "options.yAxis.labels.formatter = function() { return 'hey';}" %>
   <%end %> 
  

Option reference:

 http://www.highcharts.com/ref/



Contributors

deshi(xiaods@gmail.com)

Copyright (c) 2010 Miguel Michelson Martinez, released under the MIT license

FAQs

Package last updated on 14 Jun 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.