daru-view 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (194) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +12 -0
  3. data/.rspec +4 -0
  4. data/.rubocop.yml +122 -0
  5. data/.simplecov +3 -0
  6. data/.travis.yml +18 -0
  7. data/CHANGELOG.md +21 -0
  8. data/CODE_OF_CONDUCT.md +74 -0
  9. data/CONTRIBUTING.md +53 -0
  10. data/Gemfile +11 -0
  11. data/LICENSE.txt +21 -0
  12. data/README.md +287 -0
  13. data/Rakefile +22 -0
  14. data/_config.yml +1 -0
  15. data/daru-view.gemspec +52 -0
  16. data/lib/assets/.keep +0 -0
  17. data/lib/daru/view.rb +127 -0
  18. data/lib/daru/view/adapters/datatables.rb +90 -0
  19. data/lib/daru/view/adapters/googlecharts.rb +180 -0
  20. data/lib/daru/view/adapters/googlecharts/data_table_iruby.rb +86 -0
  21. data/lib/daru/view/adapters/googlecharts/display.rb +54 -0
  22. data/lib/daru/view/adapters/googlecharts/iruby_notebook.rb +15 -0
  23. data/lib/daru/view/adapters/highcharts.rb +114 -0
  24. data/lib/daru/view/adapters/highcharts/core_ext/string.rb +10 -0
  25. data/lib/daru/view/adapters/highcharts/display.rb +58 -0
  26. data/lib/daru/view/adapters/highcharts/iruby_notebook.rb +29 -0
  27. data/lib/daru/view/adapters/highcharts/layout_helper_iruby.rb +76 -0
  28. data/lib/daru/view/adapters/js/googlecharts_js/google_visualr.js +44 -0
  29. data/lib/daru/view/adapters/js/googlecharts_js/loader.js +226 -0
  30. data/lib/daru/view/adapters/js/highcharts_js/adapters/mootools-adapter.js +13 -0
  31. data/lib/daru/view/adapters/js/highcharts_js/adapters/prototype-adapter.js +15 -0
  32. data/lib/daru/view/adapters/js/highcharts_js/highcharts-3d.js +74 -0
  33. data/lib/daru/view/adapters/js/highcharts_js/highcharts-more.js +64 -0
  34. data/lib/daru/view/adapters/js/highcharts_js/highcharts.js +399 -0
  35. data/lib/daru/view/adapters/js/highcharts_js/highstock.js +519 -0
  36. data/lib/daru/view/adapters/js/highcharts_js/modules/accessibility.js +48 -0
  37. data/lib/daru/view/adapters/js/highcharts_js/modules/annotations.js +14 -0
  38. data/lib/daru/view/adapters/js/highcharts_js/modules/boost.js +51 -0
  39. data/lib/daru/view/adapters/js/highcharts_js/modules/broken-axis.js +15 -0
  40. data/lib/daru/view/adapters/js/highcharts_js/modules/canvas-tools.js +133 -0
  41. data/lib/daru/view/adapters/js/highcharts_js/modules/data.js +26 -0
  42. data/lib/daru/view/adapters/js/highcharts_js/modules/drilldown.js +25 -0
  43. data/lib/daru/view/adapters/js/highcharts_js/modules/exporting.js +27 -0
  44. data/lib/daru/view/adapters/js/highcharts_js/modules/funnel.js +13 -0
  45. data/lib/daru/view/adapters/js/highcharts_js/modules/heatmap.js +25 -0
  46. data/lib/daru/view/adapters/js/highcharts_js/modules/no-data-to-display.js +12 -0
  47. data/lib/daru/view/adapters/js/highcharts_js/modules/offline-exporting.js +19 -0
  48. data/lib/daru/view/adapters/js/highcharts_js/modules/solid-gauge.js +14 -0
  49. data/lib/daru/view/adapters/js/highcharts_js/modules/treemap.js +31 -0
  50. data/lib/daru/view/adapters/js/highcharts_js/stock/adapters/mootools-adapter.js +13 -0
  51. data/lib/daru/view/adapters/js/highcharts_js/stock/adapters/prototype-adapter.js +15 -0
  52. data/lib/daru/view/adapters/js/highcharts_js/stock/highcharts-more.js +64 -0
  53. data/lib/daru/view/adapters/js/highcharts_js/stock/modules/exporting.js +27 -0
  54. data/lib/daru/view/adapters/js/highcharts_js/stock/modules/funnel.js +13 -0
  55. data/lib/daru/view/adapters/js/nyaplot_js/d3-downloadable.js +129 -0
  56. data/lib/daru/view/adapters/js/nyaplot_js/d3.min.js +5 -0
  57. data/lib/daru/view/adapters/js/nyaplot_js/nyaplot.js +5294 -0
  58. data/lib/daru/view/adapters/nyaplot.rb +62 -0
  59. data/lib/daru/view/adapters/nyaplot/display.rb +9 -0
  60. data/lib/daru/view/adapters/nyaplot/iruby_notebook.rb +22 -0
  61. data/lib/daru/view/app/rails/helpers/view_helper.rb +26 -0
  62. data/lib/daru/view/app/rails/railtie.rb +15 -0
  63. data/lib/daru/view/plot.rb +106 -0
  64. data/lib/daru/view/table.rb +99 -0
  65. data/lib/daru/view/templates/googlecharts/chart_div.erb +4 -0
  66. data/lib/daru/view/templates/googlecharts/init.inline.js.erb +16 -0
  67. data/lib/daru/view/templates/highcharts/init.inline.js.erb +16 -0
  68. data/lib/daru/view/templates/highcharts/static_html.erb +7 -0
  69. data/lib/daru/view/templates/nyaplot/init.inline.js.erb +16 -0
  70. data/lib/daru/view/templates/nyaplot/init_script.erb +3 -0
  71. data/lib/daru/view/version.rb +5 -0
  72. data/lib/tasks/.keep +0 -0
  73. data/lib/tasks/google_charts.rake +25 -0
  74. data/lib/tasks/high_charts.rake +60 -0
  75. data/lib/tasks/nyaplot.rake +25 -0
  76. data/spec/adapters/datatables_spec.rb +21 -0
  77. data/spec/adapters/googlecharts_spec.rb +34 -0
  78. data/spec/adapters/highcharts_spec.rb +177 -0
  79. data/spec/adapters/nyaplot_spec.rb +447 -0
  80. data/spec/app/rails/helpers/view_helpers_spec.rb +35 -0
  81. data/spec/dummy_iruby/.ipynb_checkpoints/Daru DataFrame and DataTables-checkpoint.ipynb +16091 -0
  82. data/spec/dummy_iruby/.ipynb_checkpoints/DataTables | basic examples-checkpoint.ipynb +6 -0
  83. data/spec/dummy_iruby/.ipynb_checkpoints/Google Chart | Line Chart-checkpoint.ipynb +1389 -0
  84. data/spec/dummy_iruby/.ipynb_checkpoints/Google Chart | Area Chart-checkpoint.ipynb +606 -0
  85. data/spec/dummy_iruby/.ipynb_checkpoints/Google Chart | Bar Chart-checkpoint.ipynb +1404 -0
  86. data/spec/dummy_iruby/.ipynb_checkpoints/Google Chart | Bubble Chart-checkpoint.ipynb +866 -0
  87. data/spec/dummy_iruby/.ipynb_checkpoints/Google Chart | Candlestick Chart-checkpoint.ipynb +607 -0
  88. data/spec/dummy_iruby/.ipynb_checkpoints/Google Chart | Combo Chart-checkpoint.ipynb +478 -0
  89. data/spec/dummy_iruby/.ipynb_checkpoints/Google Chart | Histogram-checkpoint.ipynb +1182 -0
  90. data/spec/dummy_iruby/.ipynb_checkpoints/Google Chart | Org Chart-checkpoint.ipynb +6 -0
  91. data/spec/dummy_iruby/.ipynb_checkpoints/Google Chart | Pie Chart-checkpoint.ipynb +6 -0
  92. data/spec/dummy_iruby/.ipynb_checkpoints/Google Chart | Stepped Area Chart-checkpoint.ipynb +699 -0
  93. data/spec/dummy_iruby/.ipynb_checkpoints/Google Chart | Timeline-checkpoint.ipynb +1523 -0
  94. data/spec/dummy_iruby/.ipynb_checkpoints/Google Chart | Treemap-checkpoint.ipynb +650 -0
  95. data/spec/dummy_iruby/.ipynb_checkpoints/Google Chart | gauge-checkpoint.ipynb +477 -0
  96. data/spec/dummy_iruby/.ipynb_checkpoints/Google Charts | Basics-checkpoint.ipynb +1881 -0
  97. data/spec/dummy_iruby/.ipynb_checkpoints/Google Charts | Column Charts-checkpoint.ipynb +6 -0
  98. data/spec/dummy_iruby/.ipynb_checkpoints/Google Charts | Geo Charts examples-checkpoint.ipynb +791 -0
  99. data/spec/dummy_iruby/.ipynb_checkpoints/Google Charts | Scatter Chart-checkpoint.ipynb +1570 -0
  100. data/spec/dummy_iruby/.ipynb_checkpoints/GoolgeChart | Datatables-checkpoint.ipynb +1792 -0
  101. data/spec/dummy_iruby/.ipynb_checkpoints/HighCharts - Area chart-checkpoint.ipynb +1272 -0
  102. data/spec/dummy_iruby/.ipynb_checkpoints/HighCharts - Bar Chart-checkpoint.ipynb +877 -0
  103. data/spec/dummy_iruby/.ipynb_checkpoints/HighCharts - column charts-checkpoint.ipynb +1587 -0
  104. data/spec/dummy_iruby/.ipynb_checkpoints/HighCharts- Pie charts-checkpoint.ipynb +1126 -0
  105. data/spec/dummy_iruby/.ipynb_checkpoints/Highcharts - Combinations -checkpoint.ipynb +925 -0
  106. data/spec/dummy_iruby/.ipynb_checkpoints/Highcharts - Daynamic charts-checkpoint.ipynb +839 -0
  107. data/spec/dummy_iruby/.ipynb_checkpoints/Highcharts - line graphs-checkpoint.ipynb +1297 -0
  108. data/spec/dummy_iruby/.ipynb_checkpoints/Highcharts - line graphs2-checkpoint.ipynb +879 -0
  109. data/spec/dummy_iruby/.ipynb_checkpoints/Highcharts - scatter -bubble charts-checkpoint.ipynb +1071 -0
  110. data/spec/dummy_iruby/.ipynb_checkpoints/Highcharts | add_series method and highcharts examples-checkpoint.ipynb +1165 -0
  111. data/spec/dummy_iruby/.ipynb_checkpoints/Nyaplot basics | Daru Examples-checkpoint.ipynb +1383 -0
  112. data/spec/dummy_iruby/.ipynb_checkpoints/Nyaplot other examples-checkpoint.ipynb +6 -0
  113. data/spec/dummy_iruby/.ipynb_checkpoints/Nyaplot testing -checkpoint.ipynb +270 -0
  114. data/spec/dummy_iruby/.ipynb_checkpoints/Nyaplot | Creating Visualizations with DataFrame | from daru examples-checkpoint.ipynb +1716 -0
  115. data/spec/dummy_iruby/.ipynb_checkpoints/Pie Chart using HighCharts2-checkpoint.ipynb +784 -0
  116. data/spec/dummy_iruby/.ipynb_checkpoints/highcharts - Use HTML table (generated from daru) as data source-checkpoint.ipynb +956 -0
  117. data/spec/dummy_iruby/.ipynb_checkpoints/spec_testing-checkpoint.ipynb +1433 -0
  118. data/spec/dummy_iruby/Daru DataFrame and DataTables.ipynb +16091 -0
  119. data/spec/dummy_iruby/DataTables | basic examples.ipynb +15587 -0
  120. data/spec/dummy_iruby/Gemfile +33 -0
  121. data/spec/dummy_iruby/Google Chart | Line Chart.ipynb +1389 -0
  122. data/spec/dummy_iruby/Google Chart | Area Chart.ipynb +606 -0
  123. data/spec/dummy_iruby/Google Chart | Bar Chart.ipynb +1394 -0
  124. data/spec/dummy_iruby/Google Chart | Bubble Chart.ipynb +866 -0
  125. data/spec/dummy_iruby/Google Chart | Candlestick Chart.ipynb +607 -0
  126. data/spec/dummy_iruby/Google Chart | Combo Chart.ipynb +478 -0
  127. data/spec/dummy_iruby/Google Chart | Histogram.ipynb +1182 -0
  128. data/spec/dummy_iruby/Google Chart | Org Chart.ipynb +474 -0
  129. data/spec/dummy_iruby/Google Chart | Pie Chart.ipynb +1177 -0
  130. data/spec/dummy_iruby/Google Chart | Stepped Area Chart.ipynb +699 -0
  131. data/spec/dummy_iruby/Google Chart | Timeline.ipynb +1523 -0
  132. data/spec/dummy_iruby/Google Chart | Treemap.ipynb +659 -0
  133. data/spec/dummy_iruby/Google Chart | gauge.ipynb +477 -0
  134. data/spec/dummy_iruby/Google Charts | Basics.ipynb +1882 -0
  135. data/spec/dummy_iruby/Google Charts | Column Charts.ipynb +1138 -0
  136. data/spec/dummy_iruby/Google Charts | Geo Charts examples.ipynb +791 -0
  137. data/spec/dummy_iruby/Google Charts | Scatter Chart.ipynb +1570 -0
  138. data/spec/dummy_iruby/GoolgeChart | Datatables.ipynb +1801 -0
  139. data/spec/dummy_iruby/HighCharts - Area chart.ipynb +1272 -0
  140. data/spec/dummy_iruby/HighCharts - Bar Chart.ipynb +877 -0
  141. data/spec/dummy_iruby/HighCharts - column charts.ipynb +1587 -0
  142. data/spec/dummy_iruby/HighCharts- Pie charts.ipynb +1197 -0
  143. data/spec/dummy_iruby/Highcharts - Combinations .ipynb +925 -0
  144. data/spec/dummy_iruby/Highcharts - Daynamic charts.ipynb +839 -0
  145. data/spec/dummy_iruby/Highcharts - line graphs.ipynb +1297 -0
  146. data/spec/dummy_iruby/Highcharts - line graphs2.ipynb +879 -0
  147. data/spec/dummy_iruby/Highcharts - scatter -bubble charts.ipynb +1071 -0
  148. data/spec/dummy_iruby/Highcharts | add_series method and highcharts examples.ipynb +1228 -0
  149. data/spec/dummy_iruby/Nyaplot basics | Daru Examples.ipynb +1390 -0
  150. data/spec/dummy_iruby/Nyaplot other examples.ipynb +589 -0
  151. data/spec/dummy_iruby/Nyaplot testing .ipynb +270 -0
  152. data/spec/dummy_iruby/Nyaplot | Creating Visualizations with DataFrame | from daru examples.ipynb +1716 -0
  153. data/spec/dummy_iruby/Pie Chart using HighCharts2.ipynb +784 -0
  154. data/spec/dummy_iruby/highcharts - Use HTML table (generated from daru) as data source.ipynb +951 -0
  155. data/spec/dummy_iruby/spec_testing.ipynb +1433 -0
  156. data/spec/dummy_nanoc/Gemfile +12 -0
  157. data/spec/dummy_nanoc/README.md +40 -0
  158. data/spec/dummy_nanoc/Rules +90 -0
  159. data/spec/dummy_nanoc/content/googlecharts/index.html +29 -0
  160. data/spec/dummy_nanoc/content/highcharts/index.html +42 -0
  161. data/spec/dummy_nanoc/content/index.html +26 -0
  162. data/spec/dummy_nanoc/content/nyaplot/index.html +9 -0
  163. data/spec/dummy_nanoc/content/stylesheet.css +101 -0
  164. data/spec/dummy_nanoc/layouts/default.html +31 -0
  165. data/spec/dummy_nanoc/layouts/googlecharts_layout.html +30 -0
  166. data/spec/dummy_nanoc/layouts/highcharts_layout.html +30 -0
  167. data/spec/dummy_nanoc/layouts/nyaplot_layout.html +30 -0
  168. data/spec/dummy_nanoc/lib/default.rb +300 -0
  169. data/spec/dummy_nanoc/nanoc.yaml +90 -0
  170. data/spec/dummy_nanoc/output/googlecharts/index.html +390 -0
  171. data/spec/dummy_nanoc/output/highcharts/index.html +1153 -0
  172. data/spec/dummy_nanoc/output/index.html +87 -0
  173. data/spec/dummy_nanoc/output/nyaplot/index.html +135 -0
  174. data/spec/dummy_nanoc/output/stylesheet.css +101 -0
  175. data/spec/dummy_nanoc/tmp/nanoc/1029d67644815/checksums +0 -0
  176. data/spec/dummy_nanoc/tmp/nanoc/1029d67644815/compiled_content +2229 -0
  177. data/spec/dummy_nanoc/tmp/nanoc/1029d67644815/dependencies +5 -0
  178. data/spec/dummy_nanoc/tmp/nanoc/1029d67644815/outdatedness +0 -0
  179. data/spec/dummy_nanoc/tmp/nanoc/1029d67644815/rule_memory +0 -0
  180. data/spec/dummy_sinatra/Gemfile +9 -0
  181. data/spec/dummy_sinatra/README.md +15 -0
  182. data/spec/dummy_sinatra/app.rb +143 -0
  183. data/spec/dummy_sinatra/config.ru +0 -0
  184. data/spec/dummy_sinatra/views/googlecharts.erb +31 -0
  185. data/spec/dummy_sinatra/views/googlecharts_layout.erb +12 -0
  186. data/spec/dummy_sinatra/views/highcharts.erb +15 -0
  187. data/spec/dummy_sinatra/views/highcharts_layout.erb +12 -0
  188. data/spec/dummy_sinatra/views/index.erb +2 -0
  189. data/spec/dummy_sinatra/views/layout.erb +26 -0
  190. data/spec/dummy_sinatra/views/nyaplot.erb +13 -0
  191. data/spec/dummy_sinatra/views/nyaplot_layout.erb +14 -0
  192. data/spec/plot_spec.rb +86 -0
  193. data/spec/spec_helper.rb +11 -0
  194. metadata +568 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0f80dd124b93d1d6c8b4d22e41c15f9576ca0f74
4
+ data.tar.gz: 7d2d452ab2a3adeb98a89e4426b4e039c3fcd437
5
+ SHA512:
6
+ metadata.gz: 92089bbdd71659503e8bee0c7403e93588b8f68c8a7690bbde4c80ad37642eb1f156a6fa01d83ae2b7e41710eb29d4b4c872842f981e16512c5412b24ab092fa
7
+ data.tar.gz: fb23580ad917e98ae5ce36039f3be59fdbd5e54acd3319a19144ad4528d45e1f586dba07ebf0bff83380d65f69d04eff94e7c0362c05edb2bc8d80389e6624f0
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.gem
11
+ *.lock
12
+ *.ruby-version
data/.rspec ADDED
@@ -0,0 +1,4 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
4
+ --warnings
data/.rubocop.yml ADDED
@@ -0,0 +1,122 @@
1
+ AllCops:
2
+ Include:
3
+ - 'lib/**/*'
4
+ Exclude:
5
+ # - 'daru-view.gemspec'
6
+ - 'Rakefile'
7
+ - 'Gemfile'
8
+ - 'Guardfile'
9
+ - '**/*.erb'
10
+ - '**/*.js'
11
+ - 'spec/*'
12
+ - 'spec/**/*'
13
+ - 'vendor/**/*'
14
+ - 'benchmarks/*'
15
+ - 'profile/*'
16
+ - 'bin/*'
17
+ - 'daru-view.gemspec'
18
+ - '**/*.rake'
19
+ DisplayCopNames: true
20
+ TargetRubyVersion: 2.0
21
+
22
+ # Preferred codebase style ---------------------------------------------
23
+ Layout/ExtraSpacing:
24
+ AllowForAlignment: true
25
+
26
+ Style/FormatString:
27
+ EnforcedStyle: percent
28
+
29
+ Style/AndOr:
30
+ EnforcedStyle: conditionals
31
+
32
+ Layout/SpaceAroundEqualsInParameterDefault:
33
+ EnforcedStyle: no_space
34
+
35
+ Layout/SpaceInsideBlockBraces:
36
+ EnforcedStyle: space
37
+
38
+ Layout/SpaceInsideHashLiteralBraces:
39
+ EnforcedStyle: no_space
40
+
41
+ Layout/AlignParameters:
42
+ EnforcedStyle: with_fixed_indentation
43
+
44
+ Style/EmptyElse:
45
+ EnforcedStyle: empty
46
+
47
+ Metrics/LineLength:
48
+ Max: 120
49
+
50
+ Metrics/ModuleLength:
51
+ Max: 200
52
+
53
+ Metrics/ClassLength:
54
+ Max: 200
55
+
56
+ Style/ParallelAssignment:
57
+ Enabled: false
58
+
59
+ Style/DoubleNegation:
60
+ Enabled: false
61
+
62
+ Style/SingleLineBlockParams:
63
+ Enabled: false
64
+
65
+ Style/PerlBackrefs:
66
+ Enabled: false
67
+
68
+ Layout/SpaceAfterComma:
69
+ Enabled: false
70
+
71
+ Layout/SpaceAroundOperators:
72
+ Enabled: false
73
+
74
+ Style/EmptyCaseCondition:
75
+ Enabled: false
76
+
77
+ Style/MultilineBlockChain:
78
+ Enabled: false
79
+
80
+ # See https://github.com/bbatsov/rubocop/issues/4429
81
+ Style/YodaCondition:
82
+ Enabled: false
83
+
84
+ Style/PercentLiteralDelimiters:
85
+ PreferredDelimiters:
86
+ '%i': '[]'
87
+ '%w': '[]'
88
+
89
+ # Neither of prefered styles are good enough :(
90
+ Style/BlockDelimiters:
91
+ Enabled: false
92
+
93
+ # Current preferred metrics --------------------------------------------
94
+ # Better values are encouraged, but not required.
95
+ Metrics/AbcSize:
96
+ Max: 20
97
+
98
+ Metrics/MethodLength:
99
+ Max: 15
100
+
101
+ Metrics/CyclomaticComplexity:
102
+ Max: 7
103
+
104
+ # TODO -----------------------------------------------------------------
105
+
106
+ Style/Documentation:
107
+ Enabled: false
108
+
109
+ Security/MarshalLoad:
110
+ Enabled: false
111
+
112
+ Performance/RedundantMatch:
113
+ Enabled: false
114
+
115
+ # Must be removed in future
116
+
117
+ Lint/DuplicateMethods:
118
+ Enabled: false
119
+
120
+ Naming/HeredocDelimiterNaming:
121
+ Enabled: false
122
+
data/.simplecov ADDED
@@ -0,0 +1,3 @@
1
+ SimpleCov.start do
2
+ add_group "lib", "lib"
3
+ end
data/.travis.yml ADDED
@@ -0,0 +1,18 @@
1
+ language:
2
+ ruby
3
+
4
+ rvm:
5
+ - '2.0'
6
+ - '2.1'
7
+ - '2.2'
8
+ - '2.3.0'
9
+ - '2.4.0'
10
+
11
+ script:
12
+ - bundle exec rspec
13
+ - bundle exec rubocop
14
+
15
+ install:
16
+ - gem install bundler
17
+ - gem install rainbow -v '2.2.1'
18
+ - bundle install
data/CHANGELOG.md ADDED
@@ -0,0 +1,21 @@
1
+ ## 0.1.0 (2017-09-20)
2
+
3
+ **Features:**
4
+
5
+ - Generate Plot using [Nyaplot](https://github.com/SciRuby/nyaplot),
6
+ [google_visualr](https://github.com/winston/google_visualr/),
7
+ [lazy_high_charts](https://github.com/michelson/lazy_high_charts) gem with more features.
8
+
9
+ - Generate Tables using [Google Charts DataTable](https://developers.google.com/chart/interactive/docs/gallery/table) and [daru-data_tables](https://github.com/Shekharrajak/daru-data_tables) with features like pagination, sorting by column, option to choose number of rows to be displayed.
10
+
11
+ - Plotting can be done in IRuby notebook as well as any ruby web application
12
+ framework.
13
+
14
+ - Data can be in Daru::DataFrame, Daru::Vector, array of array data or
15
+ according to the formate described in [Google Charts tool](https://developers.google.com/chart/interactive/docs/gallery), [Highcharts](https://www.highcharts.com/demo).
16
+
17
+ - User can use all the features already present in google_visualr,
18
+ lazy_high_charts, nayplot by accessing the respective object using
19
+ `#chart` and tables using `#table`.
20
+
21
+ - The article written about initial features briefly : https://github.com/shekharrajak/daru-view/wiki/All-about-daru-view
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at shekharstudy@ymail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,53 @@
1
+ # Contributing guide
2
+
3
+ ## Installing daru development dependencies
4
+
5
+ Install [Daru](https://github.com/SciRuby/daru) dependencies : [installing-daru-development-dependencies](https://github.com/SciRuby/daru/blob/master/CONTRIBUTING.md#installing-daru-development-dependencies)
6
+
7
+
8
+ Then install remaining dependencies:
9
+
10
+ `bundle install`
11
+
12
+ And run the test suite (should be all green with pending tests):
13
+
14
+ `bundle exec rspec`
15
+
16
+ If you have problems installing nmatrix, please consult the [mailing list](https://groups.google.com/forum/#!forum/sciruby-dev).
17
+
18
+ While preparing your pull requests, don't forget to check your code with Rubocop:
19
+
20
+ `bundle exec rubocop`
21
+
22
+
23
+ ## Basic Development Flow
24
+
25
+ 1. Create a new branch with `git checkout -b <branch_name>`.
26
+ 2. Make your changes. Write tests covering every case how your feature will be used. If creating new files for tests, refer to the 'Testing' section [below](#Testing).
27
+ 3. Try out these changes with `rake pry`.
28
+ 4. Run the test suite with `rake spec`. (Alternatively you can use `guard` as described [here](https://github.com/SciRuby/daru/blob/master/CONTRIBUTING.md#testing). Also run Rubocop coding style guidelines with `rake cop`.
29
+ 5. Commit the changes with `git commit -am "briefly describe what you did"` and submit pull request.
30
+
31
+ [Optional] You can run rspec for all Ruby versions at once with `rake spec run all`. But remember to first have all Ruby versions installed with `ruby spec setup`.
32
+
33
+
34
+ ## Testing
35
+
36
+
37
+ `bundle exec rspec`
38
+
39
+ **NOTE**: Please make sure that you place test for your file at the same level and with same itermediatary directories. For example if code file lies in `lib/xyz/abc.rb` then its corresponding test should lie in `spec/xyz/abc_spec.rb`. This is to ensure correct working of Guard.
40
+
41
+
42
+ ## How daru-view is created
43
+
44
+ GSoc 2017 Blog posts : [http://shekharrajak.github.io/gsoc_2017_posts/](http://shekharrajak.github.io/gsoc_2017_posts/)
45
+
46
+
47
+ ## How one can add their own library for plotting
48
+
49
+ If you want to add a new library (adapter) to use it as the plotting library in `daru-view`,
50
+ then you just need to define all the methods, that are present for [`Plot` object](https://github.com/Shekharrajak/daru-view/blob/master/lib/daru/view/plot.rb). Few main methods are `div`
51
+ (to get the HTML, JS code for the chart), `init_script` (to return the all the dependent css, js files for the library which is needed to run the HTML code of the chart), `export_html_file`(to export the HTML file of the chart), `init_iruby`(this method will load the dependent JS files in IRuby notebook).
52
+
53
+ You can define these methods in [`daru/view/adapter`](https://github.com/Shekharrajak/daru-view/tree/master/lib/daru/view/adapters) (for reference see the other adapter).
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in daru-view.gemspec
4
+ gemspec
5
+
6
+ # Need the latest development version. Fetching it from the github repos.
7
+ gem "daru", git: 'https://github.com/SciRuby/daru.git'
8
+ gem "nyaplot", git: 'https://github.com/SciRuby/nyaplot.git'
9
+ gem 'google_visualr', git: 'https://github.com/winston/google_visualr.git'
10
+
11
+ gem 'daru-data_tables', git: 'https://github.com/Shekharrajak/daru-data_tables.git'
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2017 Shekhar Prasad Rajak(@shekharrajak)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,287 @@
1
+ # Daru::View
2
+
3
+ [Daru](https://github.com/sciruby/daru) (Data Analysis in RUby) is a library for analysis, manipulation and visualization of data. Daru-view is for easy and interactive plotting in web application & IRuby notebook. It can work in frameworks like Rails, Sinatra, Nanoc and hopefully in others too.
4
+
5
+ It is a plugin gem to Data Analysis in RUby([Daru](https://github.com/sciruby/daru)) for visualisation of data
6
+
7
+ ## Documentation :
8
+
9
+ [http://www.rubydoc.info/github/Shekharrajak/daru-view/](http://www.rubydoc.info/github/Shekharrajak/daru-view/)
10
+
11
+ [daru-view/wiki](https://github.com/Shekharrajak/daru-view/wiki)
12
+
13
+ ## Examples :
14
+
15
+ - [IRuby notebook examples](http://nbviewer.jupyter.org/github/shekharrajak/daru-view/tree/master/spec/dummy_iruby/)
16
+
17
+ - [Demo web applicatioons (Rails, Sinatra, Nanoc)](https://github.com/Shekharrajak/demo_daru-view)
18
+
19
+ ## Installation
20
+
21
+ Add this line to your application's Gemfile:
22
+
23
+ ```ruby
24
+ gem 'daru-view', git: 'https://github.com/Shekharrajak/daru-view.git'
25
+ ```
26
+
27
+ And then execute:
28
+
29
+ $ bundle
30
+
31
+ Or install it yourself as:
32
+
33
+ $ gem install daru-view
34
+
35
+ ## Usage
36
+
37
+ ### Use in IRuby notebook
38
+
39
+ - Create separate folder and Gemfile inside it. Add minimum these lines in it
40
+
41
+ ```ruby
42
+ source "http://rubygems.org"
43
+
44
+ # iruby dependencies
45
+ gem 'rbczmq'
46
+ gem 'ffi-rzmq'
47
+ gem 'iruby'
48
+
49
+ # fetch from the github master branch
50
+ gem "daru", git: 'https://github.com/SciRuby/daru.git'
51
+ gem "nyaplot", git: 'https://github.com/SciRuby/nyaplot.git'
52
+ gem 'daru-view', :git => 'https://github.com/shekharrajak/daru-view.git'
53
+ ```
54
+
55
+ - Now do `bundle install` and run `iruby notebook`
56
+
57
+ - You may like to try some examples that is added in specs : [spec/dummy_iruby/](http://nbviewer.jupyter.org/github/shekharrajak/daru-view/tree/master/spec/dummy_iruby/)
58
+
59
+ ### Use in web application
60
+
61
+ - Add this line in your Gemfile :
62
+ ```ruby
63
+ gem 'daru-view', :git => 'https://github.com/shekharrajak/daru-view.git'
64
+ gem "daru", git: 'https://github.com/SciRuby/daru.git'
65
+ gem "nyaplot", git: 'https://github.com/SciRuby/nyaplot.git'
66
+ ```
67
+
68
+ _Note_ : Right now, in daru-view gemspec file `daru` and `nyaplot` is not added as development_dependency. Since daru-view required the latest github version of the Daru and Nyaplot gem and we can't fetch gem from the github in the gemspec.
69
+
70
+ #### Rails application
71
+
72
+ - In controller, do the data analysis process using daru operations and get the DataFrame/Vectors.
73
+
74
+ - Set a plotting library using e.g. `Daru::View.plotting_library = :highcharts`
75
+
76
+ - In view, add the required JS files (for the plotting library), in head tag (generally) using the line , e.g. : `Daru::View.dependent_script(:highcharts)`
77
+
78
+ The line `<%=raw Daru::View.dependent_script(:highcharts) %>` for rails app , must be added in the layout file of the application.
79
+
80
+ - Plot library using by passing `data` and `options` :
81
+
82
+ HighCharts example :
83
+
84
+ ```ruby
85
+
86
+ # set the library, to plot charts
87
+ Daru::View.plotting_library = :highcharts
88
+
89
+ # options for the charts
90
+ opts = {
91
+ chart: {defaultSeriesType: 'line'},
92
+ title: {
93
+ text: 'Solar Employment Growth by Sector, 2010-2016'
94
+ },
95
+
96
+ subtitle: {
97
+ text: 'Source: thesolarfoundation.com'
98
+ },
99
+
100
+ yAxis: {
101
+ title: {
102
+ text: 'Number of Employees'
103
+ }
104
+ },
105
+ legend: {
106
+ layout: 'vertical',
107
+ align: 'right',
108
+ verticalAlign: 'middle'
109
+ },
110
+
111
+ plotOptions: {
112
+ # this is not working. Find the bug
113
+ # series: {
114
+ # pointStart: 43934
115
+ # }
116
+ },
117
+ }
118
+
119
+ # data for the charts
120
+ series_dt = ([{
121
+ name: 'Tokyo',
122
+ data: [7.0, 6.9, 9.5, 14.5, 18.4, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
123
+ }, {
124
+ name: 'London',
125
+ data: [3.9, 4.2, 5.7, 8.5, 11.9, 15.2, 17.0, 16.6, 14.2, 10.3, 6.6, 4.8]
126
+ }])
127
+
128
+ # initialize
129
+ @line_graph = Daru::View::Plot.new(series_dt, opts)
130
+
131
+ # Add this line in your view file, where you want to see you graph in web application. (It will put the html code of the line graph in web page)
132
+
133
+ <%=raw @line_graph.div %>
134
+
135
+ # Now refresh the page, you will be able to see your graph.
136
+
137
+ ```
138
+
139
+
140
+ Nyaplot example :
141
+
142
+ ```ruby
143
+
144
+ # set the library, to plot charts (Default it is nyaplot only)
145
+ Daru::View.plotting_library = :nyaplot
146
+
147
+
148
+ # options for the charts
149
+ opts = {
150
+ type: :bar
151
+ }
152
+
153
+ # Vector data for the charts
154
+ data_vector = Daru::Vector.new [:a, :a, :a, :b, :b, :c], type: :category
155
+ data_df = Daru::DataFrame.new({
156
+ a: [1, 2, 4, -2, 5, 23, 0],
157
+ b: [3, 1, 3, -6, 2, 1, 0],
158
+ c: ['I', 'II', 'I', 'III', 'I', 'III', 'II']
159
+ })
160
+ data_df.to_category :c
161
+
162
+ # initialize
163
+ @bar_graph1 = Daru::View::Plot.new(data_vector ,opts)
164
+ @bar_graph2 = Daru::View::Plot.new(data_df, type: :bar, x: :c)
165
+
166
+ # Add this line in your view file, where you want to see you graph in web application. (It will put the html code of the line graph in web page)
167
+
168
+ <%=raw @bar_graph1.div %>
169
+ <%=raw @bar_graph2.div %>
170
+
171
+ # Now refresh the page, you will be able to see your graph.
172
+
173
+ ```
174
+
175
+ - User can try examples, that is added in spec/dummy_rails. To setup the rails app, run following commands :
176
+
177
+ ```
178
+ bundle install
179
+ bundle exec rails s
180
+
181
+ ```
182
+ Now go to the http://localhost:3000/nyaplot to see the Nyaplot examples or http://localhost:3000/highcharts to see the Highcharts examples.
183
+
184
+
185
+ #### Sinatra application
186
+
187
+
188
+ - In view, add the required JS files (for the plotting library), in head tag (generally) using the line , e.g. : `Daru::View.dependent_script(:highcharts)`
189
+
190
+ The line `<%= Daru::View.dependent_script(:highcharts) %>` for sinatra app , must be added in the layout file of the application(inside the head tag).
191
+
192
+
193
+ ```ruby
194
+ # In side the `app.rb` user must do data analysis process using daru features and define the Daru::View::Plot class instance variables to pass into the webpages in the `view` files. You will understand this better, if you will try to run sinatra app present in the `spec/dummy_sinatra`
195
+
196
+ # Add this line in your view file, where you want to see you graph in web application. (It will put the html code of the line graph in web page)
197
+
198
+ <%= @line_graph.div %>
199
+
200
+ <%= @bar_graph1.div %>
201
+ <%= @bar_graph2.div %>
202
+
203
+ # Now refresh the page, you will be able to see your graph.
204
+
205
+ ```
206
+
207
+ - User can try examples, that is added in spec/dummy_sinatra. To setup the rails app, run following commands :
208
+
209
+ ```
210
+ bundle install
211
+ bundle exec ruby app.rb
212
+
213
+ ```
214
+ Now go to the http://localhost:4567/nyaplot to see the Nyaplot examples or http://localhost:4567/highcharts to see the Highcharts examples.
215
+
216
+
217
+ #### Nanoc application
218
+
219
+ Most of the things similar to Rails application (syntax of the view part of the application).
220
+
221
+ - User can try examples, that is added in spec/dummy_nanoc. To setup the rails app, run following commands :
222
+
223
+ ```
224
+ bundle install
225
+ bundle exec nanoc
226
+ bundle exec nanoc view
227
+
228
+ ```
229
+ Now go to the http://localhost:3000/nyaplot to see the Nyaplot examples or http://localhost:3000/highcharts to see the Highcharts examples.
230
+
231
+
232
+ #### Live demo links
233
+
234
+ Nanoc web application complie and generates the html code of the nanoc web application. So you can see the running Nanoc app here :
235
+
236
+ Note : There is some problem in nyaplot (in live link. It works fine locally). Some css is not working so some styling ain't working properly. You can see it properly in local setup.
237
+
238
+ [index.html](https://shekharrajak.github.io/daru-view/spec/dummy_nanoc/output/)
239
+
240
+ [nyaplot](https://shekharrajak.github.io/daru-view/spec/dummy_nanoc/output/nyaplot)
241
+
242
+ [highcharts](https://shekharrajak.github.io/daru-view/spec/dummy_nanoc/output/highcharts)
243
+
244
+ [googlecharts](https://shekharrajak.github.io/daru-view/spec/dummy_nanoc/output/googlecharts)
245
+
246
+ For now, other applications (Rails/Sinatra) you need to run it locally.
247
+
248
+
249
+ ## Update to latest js library. Additional command line
250
+
251
+ To update to the current highcharts.js directly from http://code.highcharts.com/", you can always run
252
+
253
+ rake highcharts:update
254
+
255
+ And it will be copied to your adapters/js/highcharts_js directory.
256
+
257
+ Similarly for other libraries.
258
+
259
+ To update the all libraries Javascript file, run this command :
260
+
261
+ rake update_all
262
+
263
+
264
+ ## Development
265
+
266
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
267
+
268
+ Generally I prefer to use `bundle console` for testing few codes and experimenting the gem repo.
269
+
270
+
271
+ ## Contributing
272
+
273
+ Bug reports and pull requests are welcome on GitHub at https://github.com/shekharrajak/daru-view. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
274
+
275
+ Pick a feature from the Roadmap or the issue tracker or think of your own and send me a Pull Request!
276
+
277
+ For details see [CONTRIBUTING](CONTRIBUTING.md).
278
+
279
+ ## Acknowledgments
280
+
281
+ This software has been developed by [Shekhar Prasad Rajak](https://github.com/Shekharrajak) as a product in Google Summer of Code 2017 (GSoC2017). Visit the [blog posts](http://shekharrajak.github.io/gsoc_2017_posts/) or [mailing list of SciRuby](https://groups.google.com/forum/#!forum/sciruby-dev) to see the progress of this project.
282
+
283
+ ## License
284
+
285
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
286
+
287
+ Copyright (c) 2017 Shekhar Prasad Rajak(@shekharrajak)