lazy_high_charts 1.5.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/GEM_VERSION +1 -1
  4. data/MIT-LICENSE +1 -1
  5. data/README.md +53 -14
  6. data/lib/lazy_high_charts.rb +4 -0
  7. data/spec/dummy_nanoc/.gitignore +3 -0
  8. data/spec/dummy_nanoc/Gemfile +7 -0
  9. data/spec/dummy_nanoc/README.md +18 -0
  10. data/spec/dummy_nanoc/Rules +44 -0
  11. data/spec/dummy_nanoc/content/index.html +7 -0
  12. data/spec/dummy_nanoc/content/stylesheet.css +101 -0
  13. data/spec/dummy_nanoc/layouts/default.html +32 -0
  14. data/spec/dummy_nanoc/lib/default.rb +30 -0
  15. data/spec/dummy_nanoc/nanoc.yaml +59 -0
  16. data/spec/dummy_nanoc/output/index.html +42 -0
  17. data/spec/dummy_nanoc/output/style.css +101 -0
  18. data/spec/dummy_rails/.gitignore +20 -0
  19. data/spec/dummy_rails/Gemfile +20 -0
  20. data/spec/dummy_rails/README.md +9 -0
  21. data/spec/dummy_rails/Rakefile +7 -0
  22. data/spec/dummy_rails/app/assets/javascripts/application.js +20 -0
  23. data/spec/dummy_rails/app/assets/stylesheets/application.css.scss +13 -0
  24. data/spec/dummy_rails/app/controllers/application_controller.rb +83 -0
  25. data/spec/dummy_rails/app/helpers/application_helper.rb +3 -0
  26. data/spec/dummy_rails/app/mailers/.gitkeep +0 -0
  27. data/spec/dummy_rails/app/views/application/charts.erb +10 -0
  28. data/spec/dummy_rails/app/views/layouts/application.html.erb +12 -0
  29. data/spec/dummy_rails/config.ru +4 -0
  30. data/spec/dummy_rails/config/application.rb +25 -0
  31. data/spec/dummy_rails/config/boot.rb +11 -0
  32. data/spec/dummy_rails/config/database.yml +13 -0
  33. data/spec/dummy_rails/config/environment.rb +6 -0
  34. data/spec/dummy_rails/config/environments/development.rb +23 -0
  35. data/spec/dummy_rails/config/environments/production.rb +80 -0
  36. data/spec/dummy_rails/config/environments/test.rb +36 -0
  37. data/spec/dummy_rails/config/initializers/backtrace_silencers.rb +8 -0
  38. data/spec/dummy_rails/config/initializers/inflections.rb +16 -0
  39. data/spec/dummy_rails/config/initializers/mime_types.rb +6 -0
  40. data/spec/dummy_rails/config/initializers/secret_token.rb +8 -0
  41. data/spec/dummy_rails/config/initializers/session_store.rb +9 -0
  42. data/spec/dummy_rails/config/initializers/wrap_parameters.rb +15 -0
  43. data/spec/dummy_rails/config/locales/devise.en.yml +58 -0
  44. data/spec/dummy_rails/config/locales/en.yml +5 -0
  45. data/spec/dummy_rails/config/locales/simple_form.en.yml +26 -0
  46. data/spec/dummy_rails/config/routes.rb +6 -0
  47. data/spec/dummy_rails/db/migrate/20140224051640_create_users.rb +11 -0
  48. data/spec/dummy_rails/db/migrate/20140224063709_add_last_name_to_user.rb +5 -0
  49. data/spec/dummy_rails/db/migrate/20140225014314_create_log_data.rb +12 -0
  50. data/spec/dummy_rails/db/migrate/20140227015551_create_posts.rb +9 -0
  51. data/spec/dummy_rails/db/schema.rb +39 -0
  52. data/spec/dummy_rails/db/schema_migrations.json +1 -0
  53. data/spec/dummy_rails/lib/assets/.gitkeep +0 -0
  54. data/spec/dummy_rails/lib/templates/erb/scaffold/_form.html.erb +13 -0
  55. data/spec/dummy_rails/log/.gitkeep +0 -0
  56. data/spec/dummy_rails/public/404.html +26 -0
  57. data/spec/dummy_rails/public/422.html +26 -0
  58. data/spec/dummy_rails/public/500.html +25 -0
  59. data/spec/dummy_rails/public/favicon.ico +0 -0
  60. data/spec/dummy_rails/script/rails +6 -0
  61. data/spec/dummy_rails/test/fixtures/log_data.yml +9 -0
  62. data/spec/dummy_rails/test/fixtures/posts.yml +11 -0
  63. data/spec/dummy_rails/test/fixtures/users.yml +11 -0
  64. data/spec/dummy_rails/test/models/log_data_test.rb +7 -0
  65. data/spec/dummy_rails/test/models/post_test.rb +7 -0
  66. data/spec/dummy_rails/test/models/user_test.rb +7 -0
  67. data/spec/dummy_sinatra/Gemfile +7 -0
  68. data/spec/dummy_sinatra/README.md +9 -0
  69. data/spec/dummy_sinatra/app.rb +36 -0
  70. data/spec/dummy_sinatra/config.ru +0 -0
  71. data/spec/dummy_sinatra/views/index.erb +2 -0
  72. data/spec/dummy_sinatra/views/layout.erb +13 -0
  73. data/spec/spec_helper.rb +1 -0
  74. metadata +68 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 808215e1935a22655c03ca1471e0432ada0f2fc5
4
- data.tar.gz: c4ccbc09f28b8e503286276d30ac440fa843229b
3
+ metadata.gz: 9b7f95d1ee5bcbdf67651b6b00d8e84931ac40c5
4
+ data.tar.gz: 3854dc699812d374aea0bb7147732a1c45445de2
5
5
  SHA512:
6
- metadata.gz: 966f51166c0f7c21cf3674d61c1fed7c1a63e6e44ff8d83b46cb8e528d0fee581c9d0f66f070bd281c8c9b32a69f69348fa1f47ce85808d4dfa53cd1d3832cf5
7
- data.tar.gz: 2aa336210b28078a084d9ac93d8f891fa033c7c4d4aedbf6b3aac9d5c561b2c25f439dec73489ad1d271d9d0f442ef1d2b24c04914ecbaff1aff31c7429e3f7c
6
+ metadata.gz: e5735e8b7ff7d0728724d700e975d93d9134aac7081c50d2f9d7d8a2c9306a00361b6c23fbaacdf016594c7d0c7f4c7813f3f9ba6eb84067291627a0f925cd7d
7
+ data.tar.gz: bdb7421200c933c14b3af885ca63db543daa77fc8611211f3e0ab4a43712a2488ce192fe95fb451af362662220b7880089b11eeade22e55f18aee0831b06ac53
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # VERSION 1.5.2
2
+ * Sun Mar 11, 2014
3
+ 1. Merge some requirement tweaks to use gem in NON-Rails contexts
4
+
1
5
  # VERSION 1.5.1
2
6
  * Sun Dec 22, 2013
3
7
  1. Share highcharts:update rake task for gem and rails host app
data/GEM_VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.1
1
+ 1.5.2
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2008-2010 Miguel Michelson Martinez
1
+ Copyright (c) 2008-2014 Miguel Michelson Martinez / Deshi Xiao
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,15 +1,25 @@
1
- # LazyHighCharts - Official gem repository
1
+ # LazyHighCharts
2
2
 
3
- Easily include HighCharts in your project with this gem
4
- [![Build Status](https://secure.travis-ci.org/michelson/lazy_high_charts.png)](http://travis-ci.org/michelson/lazy_high_charts)
3
+ This gem provides a simple and extremely flexible way to use HighCharts from ruby code.
4
+ Tested on Ruby on Rails, Sinatra and Nanoc, but it should work with others too.
5
+
6
+
7
+ [![Build Status](https://travis-ci.org/michelson/lazy_high_charts.png?branch=master)](http://travis-ci.org/michelson/lazy_high_charts)
8
+ [![Code Climate](https://codeclimate.com/github/michelson/lazy_high_charts.png)](https://codeclimate.com/github/michelson/lazy_high_charts)
5
9
 
6
- ## Notice
7
- [![Gem
8
- Version](https://badge.fury.io/rb/lazy_high_charts.png)](http://badge.fury.io/rb/lazy_high_charts)
9
- Current
10
10
  [VERSION](https://github.com/michelson/lazy_high_charts/blob/master/GEM_VERSION)
11
11
  [ChangeLog](https://github.com/michelson/lazy_high_charts/blob/master/CHANGELOG.md)
12
12
 
13
+ ## Information
14
+
15
+ * RDoc documentation [available on RubyDoc.info](http://rubydoc.info/gems/lazy_high_charts/frames)
16
+ * Source code [available on GitHub](http://github.com/michelson/lazy_high_charts)
17
+ * More information, known limitations, and how-tos [available on the wiki](https://github.com/michelson/lazy_high_charts/wiki)
18
+
19
+ ## Getting Help
20
+
21
+ * Please report bugs on the [issue tracker](http://github.com/michelson/lazy_high_charts/issues) but read the "getting help" section in the wiki first.
22
+
13
23
  ## Installation
14
24
 
15
25
  ### Installation with rubygems
@@ -17,11 +27,11 @@ Current
17
27
  To install it, you just need to add it to your Gemfile:
18
28
 
19
29
  ```ruby
20
- gem 'lazy_high_charts'
30
+ gem 'lazy_high_charts'
21
31
  ```
22
32
  edge version on trial
23
33
  ```ruby
24
- gem 'lazy_high_charts' --pre
34
+ gem 'lazy_high_charts' --pre
25
35
  ```
26
36
 
27
37
  then run
@@ -32,11 +42,38 @@ bundle install
32
42
 
33
43
  to install it.
34
44
 
35
- ## Lazy_high_charts User Guide
45
+ ## Usage:
36
46
 
37
- See [project WIKI page](https://github.com/michelson/lazy_high_charts/wiki)
47
+ ### Controller code:
48
+ ```ruby
49
+ @chart2 = LazyHighCharts::HighChart.new('graph') do |f|
50
+ f.title(:text => "Population vs GDP For 5 Big Countries [2009]")
51
+ f.xAxis(:categories => ["United States", "Japan", "China", "Germany", "France"])
52
+ f.series(:name => "GDP in Billions", :yAxis => 0, :data => [14119, 5068, 4985, 3339, 2656])
53
+ f.series(:name => "Population in Millions", :yAxis => 1, :data => [310, 127, 1340, 81, 65])
54
+
55
+ f.yAxis [
56
+ {:title => {:text => "GDP in Billions", :margin => 70} },
57
+ {:title => {:text => "Population in Millions"}, :opposite => true},
58
+ ]
59
+
60
+ f.legend(:align => 'right', :verticalAlign => 'top', :y => 75, :x => -50, :layout => 'vertical',)
61
+ f.chart({:defaultSeriesType=>"column"})
62
+ end
63
+ ```
38
64
 
39
- [Demo Project](https://github.com/xiaods/highcharts-bootstrap)
65
+ ### View Helpers:
66
+ ```ruby
67
+ <%= high_chart("my_id4", @chart4) %>
68
+ ```
69
+
70
+ ###Demo projects:
71
+
72
+ [Nanoc App](spec/dummy_nanoc/README.md)
73
+
74
+ [Rails App](spec/dummy_rails/README.md)
75
+
76
+ [Sinatra App](spec/dummy_sinatra/README.md)
40
77
 
41
78
 
42
79
  ### Update to latest js library. Aditional command line
@@ -47,7 +84,9 @@ See [project WIKI page](https://github.com/michelson/lazy_high_charts/wiki)
47
84
 
48
85
  And HC will be copied to your vendor/assets directory on your app
49
86
 
50
- ### Deprecation notice: if you use rails 2.3.x or 3.0.x or 3.1.x, please use versions less than 1.3.3.
87
+ ### Deprecation notice:
88
+
89
+ If you use rails 2.3.x or 3.0.x or 3.1.x, please use versions less than 1.3.3.
51
90
 
52
91
  ## Contributing
53
92
 
@@ -65,4 +104,4 @@ Thanks for all [contributers](https://github.com/michelson/lazy_high_charts/cont
65
104
  * Miguel Michelson [github/michelson](https://github.com/michelson)
66
105
 
67
106
  ## License
68
- * Copyright (c) 2013 [Deshi Xiao](http://xiaods.mit-license.org) - Miguel Michelson Martinez, released under the MIT license
107
+ * Copyright (c) 2008-2014 [MIT LICENSE](MIT-LICENSE)
@@ -1,3 +1,7 @@
1
+ require 'action_view'
2
+ include ActionView::Helpers::TagHelper
3
+ require 'json'
4
+
1
5
  require File.join(File.dirname(__FILE__), *%w[lazy_high_charts core_ext string])
2
6
  require File.join(File.dirname(__FILE__), *%w[lazy_high_charts options_key_filter])
3
7
  require File.join(File.dirname(__FILE__), *%w[lazy_high_charts layout_helper])
@@ -0,0 +1,3 @@
1
+ Gemfile.lock
2
+ *.log
3
+ tmp*
@@ -0,0 +1,7 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'nanoc', '3.6.7'
4
+ # gem 'just_high_charts', github: 'StevenClontz/just_high_charts'
5
+ gem 'actionview'
6
+ gemspec :path => '../../'
7
+ gem 'nokogiri'
@@ -0,0 +1,18 @@
1
+ nanoc lazy high charts example
2
+ ==============================
3
+
4
+ ##Autor:
5
+
6
+ Steven Clontz
7
+
8
+ A very simple proof-of-concept of using [lazy_high_charts](https://github.com/michelson/lazy_high_charts) with a [nanoc](http://nanoc.ws) site
9
+ (that is, without Rails)
10
+
11
+ ### The example
12
+
13
+ <http://stevenclontz.github.io/nanoc_just_high_charts_example/>
14
+
15
+
16
+ ## USAGE:
17
+
18
+ bundle exec nanoc compile
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # A few helpful tips about the Rules file:
4
+ #
5
+ # * The string given to #compile and #route are matching patterns for
6
+ # identifiers--not for paths. Therefore, you can’t match on extension.
7
+ #
8
+ # * The order of rules is important: for each item, only the first matching
9
+ # rule is applied.
10
+ #
11
+ # * Item identifiers start and end with a slash (e.g. “/about/” for the file
12
+ # “content/about.html”). To select all children, grandchildren, … of an
13
+ # item, use the pattern “/about/*/”; “/about/*” will also select the parent,
14
+ # because “*” matches zero or more characters.
15
+
16
+ compile '/stylesheet/' do
17
+ # don’t filter or layout
18
+ end
19
+
20
+ compile '*' do
21
+ if item.binary?
22
+ # don’t filter binary items
23
+ else
24
+ filter :erb
25
+ layout 'default'
26
+ filter :relativize_paths, type: :html
27
+ end
28
+ end
29
+
30
+ route '/stylesheet/' do
31
+ '/style.css'
32
+ end
33
+
34
+ route '*' do
35
+ if item.binary?
36
+ # Write item with identifier /foo/ to /foo.ext
37
+ item.identifier.chop + '.' + item[:extension]
38
+ else
39
+ # Write item with identifier /foo/ to /foo/index.html
40
+ item.identifier + 'index.html'
41
+ end
42
+ end
43
+
44
+ layout '*', :erb
@@ -0,0 +1,7 @@
1
+ ---
2
+ title: Home
3
+ ---
4
+
5
+ <h1>A Brand New nanoc Site with a HighChart</h1>
6
+
7
+ <%= highchart_example %>
@@ -0,0 +1,101 @@
1
+ * {
2
+ margin: 0;
3
+ padding: 0;
4
+
5
+ font-family: Georgia, Palatino, serif;
6
+ }
7
+
8
+ body {
9
+ background: #fff;
10
+ }
11
+
12
+ a {
13
+ text-decoration: none;
14
+ }
15
+
16
+ a:link,
17
+ a:visited {
18
+ color: #f30;
19
+ }
20
+
21
+ a:hover {
22
+ color: #f90;
23
+ }
24
+
25
+ #main {
26
+ position: absolute;
27
+
28
+ top: 40px;
29
+ left: 280px;
30
+
31
+ width: 500px;
32
+ }
33
+
34
+ #main h1 {
35
+ font-size: 40px;
36
+ font-weight: normal;
37
+
38
+ line-height: 40px;
39
+
40
+ letter-spacing: -1px;
41
+ }
42
+
43
+ #main p {
44
+ margin: 20px 0;
45
+
46
+ font-size: 15px;
47
+
48
+ line-height: 20px;
49
+ }
50
+
51
+ #main ul, #main ol {
52
+ margin: 20px;
53
+ }
54
+
55
+ #main li {
56
+ font-size: 15px;
57
+
58
+ line-height: 20px;
59
+ }
60
+
61
+ #main ul li {
62
+ list-style-type: square;
63
+ }
64
+
65
+ #sidebar {
66
+ position: absolute;
67
+
68
+ top: 40px;
69
+ left: 20px;
70
+ width: 200px;
71
+
72
+ padding: 20px 20px 0 0;
73
+
74
+ border-right: 1px solid #ccc;
75
+
76
+ text-align: right;
77
+ }
78
+
79
+ #sidebar h2 {
80
+ text-transform: uppercase;
81
+
82
+ font-size: 13px;
83
+
84
+ color: #333;
85
+
86
+ letter-spacing: 1px;
87
+
88
+ line-height: 20px;
89
+ }
90
+
91
+ #sidebar ul {
92
+ list-style-type: none;
93
+
94
+ margin: 20px 0;
95
+ }
96
+
97
+ #sidebar li {
98
+ font-size: 14px;
99
+
100
+ line-height: 20px;
101
+ }
@@ -0,0 +1,32 @@
1
+ <!DOCTYPE HTML>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <title>A Brand New nanoc Site - <%= @item[:title] %></title>
6
+ <link rel="stylesheet" href="/style.css">
7
+
8
+ <!-- you don't need to keep this, but it's cool for stats! -->
9
+ <meta name="generator" content="nanoc <%= Nanoc::VERSION %>">
10
+
11
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
12
+ <script type="text/javascript" src="http://code.highcharts.com/highcharts.js"></script>
13
+ </head>
14
+ <body>
15
+ <div id="main">
16
+ <%= yield %>
17
+ </div>
18
+ <div id="sidebar">
19
+ <h2>Documentation</h2>
20
+ <ul>
21
+ <li><a href="http://nanoc.ws/docs/">Documentation</a></li>
22
+ <li><a href="http://nanoc.ws/docs/tutorial/">Getting Started</a></li>
23
+ </ul>
24
+ <h2>Community</h2>
25
+ <ul>
26
+ <li><a href="http://groups.google.com/group/nanoc/">Discussion Group</a></li>
27
+ <li><a href="irc://chat.freenode.net/#nanoc">IRC Channel</a></li>
28
+ <li><a href="http://github.com/nanoc/nanoc/wiki/">Wiki</a></li>
29
+ </ul>
30
+ </div>
31
+ </body>
32
+ </html>
@@ -0,0 +1,30 @@
1
+ # All files in the 'lib' directory will be loaded
2
+ # before nanoc starts compiling.
3
+
4
+ require 'lazy_high_charts'
5
+ include LazyHighCharts::LayoutHelper
6
+
7
+ def highchart_example
8
+ # https://github.com/michelson/lazy_high_charts/wiki/Combination-Chart
9
+ chart = LazyHighCharts::HighChart.new('graph') do |f|
10
+ f.title({ text: "Combination chart"})
11
+ f.options[:xAxis][:categories] =
12
+ ['Apples', 'Oranges', 'Pears', 'Bananas', 'Plums']
13
+ f.labels(:items=>
14
+ [:html=>"Total fruit consumption",
15
+ :style=>{:left=>"40px", :top=>"8px", :color=>"black"} ])
16
+ f.series(:type=> 'column',:name=> 'Jane',:data=> [3, 2, 1, 3, 4])
17
+ f.series(:type=> 'column',:name=> 'John',:data=> [2, 3, 5, 7, 6])
18
+ f.series(:type=> 'column', :name=> 'Joe',:data=> [4, 3, 3, 9, 0])
19
+ f.series(:type=> 'spline',:name=> 'Average',
20
+ :data=> [3, 2.67, 3, 6.33, 3.33])
21
+ f.series(:type=> 'pie',:name=> 'Total consumption',
22
+ :data=> [
23
+ {:name=> 'Jane', :y=> 13, :color=> 'red'},
24
+ {:name=> 'John', :y=> 23,:color=> 'green'},
25
+ {:name=> 'Joe', :y=> 19,:color=> 'blue'}
26
+ ],
27
+ :center=> [100, 80], :size=> 100, :showInLegend=> false)
28
+ end
29
+ high_chart("some_id", chart)
30
+ end
@@ -0,0 +1,59 @@
1
+ # A list of file extensions that nanoc will consider to be textual rather than
2
+ # binary. If an item with an extension not in this list is found, the file
3
+ # will be considered as binary.
4
+ text_extensions: [ 'coffee', 'css', 'erb', 'haml', 'handlebars', 'hb', 'htm', 'html', 'js', 'less', 'markdown', 'md', 'ms', 'mustache', 'php', 'rb', 'sass', 'scss', 'txt', 'xhtml', 'xml' ]
5
+
6
+ # The path to the directory where all generated files will be written to. This
7
+ # can be an absolute path starting with a slash, but it can also be path
8
+ # relative to the site directory.
9
+ output_dir: output
10
+
11
+ # A list of index filenames, i.e. names of files that will be served by a web
12
+ # server when a directory is requested. Usually, index files are named
13
+ # “index.html”, but depending on the web server, this may be something else,
14
+ # such as “default.htm”. This list is used by nanoc to generate pretty URLs.
15
+ index_filenames: [ 'index.html' ]
16
+
17
+ # Whether or not to generate a diff of the compiled content when compiling a
18
+ # site. The diff will contain the differences between the compiled content
19
+ # before and after the last site compilation.
20
+ enable_output_diff: false
21
+
22
+ prune:
23
+ # Whether to automatically remove files not managed by nanoc from the output
24
+ # directory. For safety reasons, this is turned off by default.
25
+ auto_prune: false
26
+
27
+ # Which files and directories you want to exclude from pruning. If you version
28
+ # your output directory, you should probably exclude VCS directories such as
29
+ # .git, .svn etc.
30
+ exclude: [ '.git', '.hg', '.svn', 'CVS' ]
31
+
32
+ # The data sources where nanoc loads its data from. This is an array of
33
+ # hashes; each array element represents a single data source. By default,
34
+ # there is only a single data source that reads data from the “content/” and
35
+ # “layout/” directories in the site directory.
36
+ data_sources:
37
+ -
38
+ # The type is the identifier of the data source. By default, this will be
39
+ # `filesystem_unified`.
40
+ type: filesystem_unified
41
+
42
+ # The path where items should be mounted (comparable to mount points in
43
+ # Unix-like systems). This is “/” by default, meaning that items will have
44
+ # “/” prefixed to their identifiers. If the items root were “/en/”
45
+ # instead, an item at content/about.html would have an identifier of
46
+ # “/en/about/” instead of just “/about/”.
47
+ items_root: /
48
+
49
+ # The path where layouts should be mounted. The layouts root behaves the
50
+ # same as the items root, but applies to layouts rather than items.
51
+ layouts_root: /
52
+
53
+ # Whether to allow periods in identifiers. When turned off, everything
54
+ # past the first period is considered to be the extension, and when
55
+ # turned on, only the characters past the last period are considered to
56
+ # be the extension. For example, a file named “content/about.html.erb”
57
+ # will have the identifier “/about/” when turned off, but when turned on
58
+ # it will become “/about.html/” instead.
59
+ allow_periods_in_identifiers: false