apexcharts 0.1.7 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +138 -71
  3. data/lib/apex_charts/charts.rb +17 -0
  4. data/lib/{apexcharts/charts/area.rb → apex_charts/charts/area_chart.rb} +1 -1
  5. data/lib/{apexcharts/charts/bar.rb → apex_charts/charts/bar_chart.rb} +1 -1
  6. data/lib/{apexcharts/charts/base.rb → apex_charts/charts/base_chart.rb} +6 -4
  7. data/lib/apex_charts/charts/box_plot_chart.rb +8 -0
  8. data/lib/{apexcharts/charts/bubble.rb → apex_charts/charts/bubble_chart.rb} +2 -2
  9. data/lib/{apexcharts/charts/candlestick.rb → apex_charts/charts/candlestick_chart.rb} +1 -1
  10. data/lib/{apexcharts/charts/cartesian.rb → apex_charts/charts/cartesian_chart.rb} +9 -9
  11. data/lib/{apexcharts/charts/column.rb → apex_charts/charts/column_chart.rb} +3 -1
  12. data/lib/{apexcharts/charts/donut.rb → apex_charts/charts/donut_chart.rb} +1 -1
  13. data/lib/{apexcharts → apex_charts}/charts/features/annotations.rb +7 -5
  14. data/lib/{apexcharts → apex_charts}/charts/features/mixable.rb +1 -1
  15. data/lib/{apexcharts/charts/heatmap.rb → apex_charts/charts/heatmap_chart.rb} +2 -2
  16. data/lib/{apexcharts/charts/line.rb → apex_charts/charts/line_chart.rb} +1 -1
  17. data/lib/{apexcharts/charts/mixed.rb → apex_charts/charts/mixed_charts.rb} +13 -7
  18. data/lib/{apexcharts/charts/pie.rb → apex_charts/charts/pie_chart.rb} +1 -1
  19. data/lib/apex_charts/charts/polar_chart.rb +9 -0
  20. data/lib/{apexcharts/charts/radar.rb → apex_charts/charts/radar_chart.rb} +2 -2
  21. data/lib/{apexcharts/charts/radial_bar.rb → apex_charts/charts/radial_bar_chart.rb} +1 -1
  22. data/lib/{apexcharts/charts/range_bar.rb → apex_charts/charts/range_bar_chart.rb} +1 -1
  23. data/lib/{apexcharts/charts/scatter.rb → apex_charts/charts/scatter_chart.rb} +1 -1
  24. data/lib/{apexcharts/charts/syncing.rb → apex_charts/charts/syncing_charts.rb} +2 -2
  25. data/lib/{apexcharts → apex_charts}/colors.rb +2 -1
  26. data/lib/apex_charts/config/default_options.rb +16 -0
  27. data/lib/apex_charts/config/schema.rb +20 -0
  28. data/lib/apex_charts/configuration.rb +27 -0
  29. data/lib/{apexcharts → apex_charts}/helper.rb +25 -24
  30. data/lib/apex_charts/options/default/annotations_options.rb +14 -0
  31. data/lib/apex_charts/options/default/chart_options.rb +33 -0
  32. data/lib/apex_charts/options/default/data_labels_options.rb +18 -0
  33. data/lib/apex_charts/options/default/fill_options.rb +14 -0
  34. data/lib/apex_charts/options/default/grid_options.rb +17 -0
  35. data/lib/apex_charts/options/default/helper_options.rb +22 -0
  36. data/lib/apex_charts/options/default/legend_options.rb +33 -0
  37. data/lib/apex_charts/options/default/markers_options.rb +26 -0
  38. data/lib/apex_charts/options/default/no_data_options.rb +14 -0
  39. data/lib/apex_charts/options/default/plot_options.rb +19 -0
  40. data/lib/apex_charts/options/default/root_options.rb +38 -0
  41. data/lib/apex_charts/options/default/states_options.rb +11 -0
  42. data/lib/apex_charts/options/default/stroke_options.rb +14 -0
  43. data/lib/apex_charts/options/default/theme_options.rb +11 -0
  44. data/lib/apex_charts/options/default/title_subtitle_options.rb +15 -0
  45. data/lib/apex_charts/options/default/tooltip_options.rb +25 -0
  46. data/lib/apex_charts/options/default/x_axis_options.rb +27 -0
  47. data/lib/apex_charts/options/default/y_axis_options.rb +28 -0
  48. data/lib/apex_charts/options/dry_schema/annotations_options.rb +22 -0
  49. data/lib/apex_charts/options/dry_schema/annotations_options/annotation_label.rb +24 -0
  50. data/lib/apex_charts/options/dry_schema/annotations_options/image_annotations.rb +15 -0
  51. data/lib/apex_charts/options/dry_schema/annotations_options/point_annotations.rb +33 -0
  52. data/lib/apex_charts/options/dry_schema/annotations_options/text_annotations.rb +26 -0
  53. data/lib/apex_charts/options/dry_schema/annotations_options/x_axis_annotations.rb +20 -0
  54. data/lib/apex_charts/options/dry_schema/annotations_options/y_axis_annotations.rb +21 -0
  55. data/lib/apex_charts/options/dry_schema/chart_options.rb +35 -0
  56. data/lib/apex_charts/options/dry_schema/data_labels_options.rb +37 -0
  57. data/lib/apex_charts/options/dry_schema/fill_options.rb +34 -0
  58. data/lib/apex_charts/options/dry_schema/general_schema/drop_shadow.rb +14 -0
  59. data/lib/apex_charts/options/dry_schema/general_schema/function.rb +12 -0
  60. data/lib/apex_charts/options/dry_schema/grid_options.rb +19 -0
  61. data/lib/apex_charts/options/dry_schema/helper_options.rb +22 -0
  62. data/lib/apex_charts/options/dry_schema/legend_options.rb +61 -0
  63. data/lib/apex_charts/options/dry_schema/markers_options.rb +34 -0
  64. data/lib/apex_charts/options/dry_schema/markers_options/discrete_point.rb +13 -0
  65. data/lib/apex_charts/options/dry_schema/no_data_options.rb +16 -0
  66. data/lib/apex_charts/options/dry_schema/plot_options.rb +231 -0
  67. data/lib/apex_charts/options/dry_schema/root_options.rb +42 -0
  68. data/lib/apex_charts/options/dry_schema/schema.rb +32 -0
  69. data/lib/apex_charts/options/dry_schema/states_options.rb +22 -0
  70. data/lib/apex_charts/options/dry_schema/states_options/filter.rb +10 -0
  71. data/lib/apex_charts/options/dry_schema/stroke_options.rb +21 -0
  72. data/lib/apex_charts/options/dry_schema/theme_options.rb +18 -0
  73. data/lib/apex_charts/options/dry_schema/title_subtitle_options.rb +22 -0
  74. data/lib/apex_charts/options/dry_schema/tooltip_options.rb +27 -0
  75. data/lib/apex_charts/options/dry_schema/x_axis_options.rb +30 -0
  76. data/lib/apex_charts/options/dry_schema/y_axis_options.rb +30 -0
  77. data/lib/{apexcharts → apex_charts}/options_builder.rb +63 -40
  78. data/lib/{apexcharts → apex_charts}/prefix_with_apex.rb +3 -1
  79. data/lib/{apexcharts → apex_charts}/prefixer.rb +2 -0
  80. data/lib/apex_charts/renderer.rb +113 -0
  81. data/lib/apex_charts/series.rb +7 -0
  82. data/lib/{apexcharts/series/bubble.rb → apex_charts/series/bubble_series.rb} +4 -2
  83. data/lib/{apexcharts/series/cartesian.rb → apex_charts/series/cartesian_series.rb} +4 -2
  84. data/lib/{apexcharts/series/polar.rb → apex_charts/series/polar_series.rb} +4 -2
  85. data/lib/{apexcharts → apex_charts}/support/rails.rb +0 -0
  86. data/lib/{apexcharts → apex_charts}/support/sinatra.rb +0 -0
  87. data/lib/{apexcharts → apex_charts}/theme.rb +2 -18
  88. data/lib/{apexcharts → apex_charts}/utils.rb +0 -0
  89. data/lib/{apexcharts → apex_charts}/utils/copy.rb +2 -0
  90. data/lib/{apexcharts → apex_charts}/utils/date_time.rb +7 -2
  91. data/lib/{apexcharts → apex_charts}/utils/hash.rb +2 -0
  92. data/lib/{apexcharts → apex_charts}/version.rb +2 -1
  93. data/lib/apexcharts.rb +3 -3
  94. data/vendor/assets/javascripts/apexcharts.js +11 -3
  95. metadata +103 -74
  96. data/lib/apexcharts/charts.rb +0 -13
  97. data/lib/apexcharts/charts/polar.rb +0 -7
  98. data/lib/apexcharts/config.rb +0 -25
  99. data/lib/apexcharts/config/default_options.rb +0 -12
  100. data/lib/apexcharts/options/annotations.rb +0 -10
  101. data/lib/apexcharts/options/axis.rb +0 -17
  102. data/lib/apexcharts/options/chart.rb +0 -26
  103. data/lib/apexcharts/options/data_labels.rb +0 -14
  104. data/lib/apexcharts/options/div_attributes.rb +0 -9
  105. data/lib/apexcharts/options/fill.rb +0 -12
  106. data/lib/apexcharts/options/grid.rb +0 -15
  107. data/lib/apexcharts/options/legend.rb +0 -27
  108. data/lib/apexcharts/options/markers.rb +0 -18
  109. data/lib/apexcharts/options/no_data.rb +0 -12
  110. data/lib/apexcharts/options/plot_options.rb +0 -12
  111. data/lib/apexcharts/options/root.rb +0 -44
  112. data/lib/apexcharts/options/states.rb +0 -9
  113. data/lib/apexcharts/options/stroke.rb +0 -12
  114. data/lib/apexcharts/options/subtitle.rb +0 -9
  115. data/lib/apexcharts/options/theme.rb +0 -8
  116. data/lib/apexcharts/options/title.rb +0 -13
  117. data/lib/apexcharts/options/tooltip.rb +0 -22
  118. data/lib/apexcharts/options/x_axis.rb +0 -12
  119. data/lib/apexcharts/options/y_axis.rb +0 -15
  120. data/lib/apexcharts/renderer.rb +0 -68
  121. data/lib/apexcharts/series.rb +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 54ad80f2d5b534d005e140000f3accfb846be669b5ead95ba608a7bf98b31561
4
- data.tar.gz: 5f26699fcd55813b799a5834ffae901a12f25fd768aadb814599715bd030afaa
3
+ metadata.gz: 709e9e394138ca8ede2eec0fa33a175b3e08ccaa764907c53fc6c72db067e3d5
4
+ data.tar.gz: ea1a5e008282d9edc581da80d06a61c743fbf130f91cdbfea659bb450489d5a9
5
5
  SHA512:
6
- metadata.gz: 1f9bb66bf223bbc14f2b00789968324940488a860abdaa8a4128dc416b60110da4fcf9148d16845ca86c02c9835b3abb73d5071d38075eab2890f6f4d21aec48
7
- data.tar.gz: ce976c0c8a8ac057f92ef0680cdfd3e5ab79af6b2d00f52d482704efc1146dbcb3bad8a0fcc330d89fa97d9618442dc6f78361b570e71835fbc9df96be43d445
6
+ metadata.gz: 561565108337e05159effd5c8c353765b6f4ac1b4741d2b8f520d3a3c8698f697ec0abb359debcaca14ae1ff32fa2ae8c8efe7ab2171377356a3293a2e81a0f2
7
+ data.tar.gz: 79413ca860115ccf2e9e729b40af747865bf93252ac7ae90c29260a33be0702f05c9780b32ac65fd34e43005c84aabf5c1265d9551ddfc6835212f7338cfc5ab
data/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  <p align="center">
2
- <img src="images/placeholder.png" height="80">
2
+ <img src="images/apexcharts.rb.png" height="150" />
3
3
  </p>
4
4
 
5
5
  <p align="center">
6
6
  <a href="https://rubygems.org/gems/apexcharts">
7
7
  <img src="https://img.shields.io/gem/v/apexcharts.svg?label=apexcharts" alt="Gem Version" />
8
8
  </a>
9
- <a href="https://travis-ci.org/styd/apexcharts.rb">
10
- <img src="https://travis-ci.org/styd/apexcharts.rb.svg?branch=master" alt="Build Status" />
9
+ <a href="https://github.com/styd/apexcharts.rb/actions">
10
+ <img src="https://github.com/styd/apexcharts.rb/workflows/build-test/badge.svg?branch=master" alt="Build Test Status" />
11
11
  </a>
12
12
  <a href="https://rubygems.org/gems/apexcharts">
13
13
  <img alt="Downloads" src="https://img.shields.io/gem/dt/apexcharts">
@@ -19,8 +19,8 @@
19
19
  <a href="https://codeclimate.com/github/styd/apexcharts.rb/maintainability">
20
20
  <img src="https://api.codeclimate.com/v1/badges/07a4f59e67abfeae21cb/maintainability" />
21
21
  </a>
22
- <a href='https://coveralls.io/github/styd/apexcharts.rb?branch=master'>
23
- <img src='https://coveralls.io/repos/github/styd/apexcharts.rb/badge.svg?branch=master' alt='Coverage Status' />
22
+ <a href="https://codebeat.co/projects/github-com-styd-apexcharts-rb-master">
23
+ <img alt="codebeat badge" src="https://codebeat.co/badges/7be581d6-e74a-406b-ae76-65605a2bff78" />
24
24
  </a>
25
25
  <a href='http://clayallsopp.github.io/readme-score/?url=styd/apexcharts.rb'>
26
26
  <img src='http://readme-score-api.herokuapp.com/score.svg?url=styd/apexcharts.rb' alt='README Score' />
@@ -39,31 +39,28 @@
39
39
 
40
40
  ## Trusted By
41
41
 
42
- <img src="images/users/ventrata.png" title="Use case: ticket sales for clients (visitor attractions and tour operators)" width="180" height="40" />
42
+ Organization/Company | Use Case
43
+ -----------------------------------------------------------------------|------------------------------------------------------------------
44
+ <img src="/images/users/copient-health.png" width="143" height="40" /> | Reports/charts related to Operating Room utilization statistics
45
+ <img src="/images/users/bilendo.png" width="202" height="40" /> | Enterprise dashboards to visualize account receivables data
46
+ <img src="/images/users/ventrata.png" width="180" height="40" /> | Ticket sales for clients (visitor attractions and tour operators)
43
47
 
44
48
  > If your organization/company uses ApexCharts.RB in production, please comment on
45
49
  > [this issue](https://github.com/styd/apexcharts.rb/issues/34).
46
50
 
47
51
 
48
- ## Supported By
49
-
50
- <a href="https://www.jetbrains.com/?from=ApexCharts.RB">
51
- <img src="images/supporters/jetbrains.svg" title="Grants 1 License for All Products Pack (worth US$649.00/year)" width="120" height="120" />
52
- </a>
53
-
54
-
55
52
  ## README Versions
56
53
 
57
54
  This README might not be for the version you use.
58
55
  Choose the right README:
59
56
 
60
- > [v0.1.7] | [v0.1.6] | [v0.1.5] | [v0.1.4] | [v0.1.3] | [v0.1.2] | [v0.1.1]
57
+ > [v0.1.11] | [v0.1.10] | [v0.1.9] | [v0.1.8] | [v0.1.7] | [v0.1.6] |
58
+ > [v0.1.5] | [v0.1.4] | [v0.1.3] | [v0.1.2] | [v0.1.1]
61
59
 
62
60
  ## Table of Contents
63
61
 
64
62
  - [About](#about)
65
63
  - [Trusted By](#trusted-by)
66
- - [Supported By](#supported-by)
67
64
  - [README Versions](#readme-versions)
68
65
  - [Table of Contents](#table-of-contents)
69
66
  - [Usage](#usage)
@@ -76,6 +73,7 @@ Choose the right README:
76
73
  - [Range Bar Chart](#range-bar-chart)
77
74
  - [Scatter Chart](#scatter-chart)
78
75
  - [Candlestick Chart](#candlestick-chart)
76
+ - [Box Plot Chart](#box-plot-chart)
79
77
  - [Mixed Charts](#mixed-charts)
80
78
  - [Syncing Charts](#syncing-charts)
81
79
  - [Brush Chart](#brush-chart)
@@ -90,6 +88,7 @@ Choose the right README:
90
88
  - [Data Formats](#data-formats)
91
89
  - [Cartesian Charts](#cartesian-charts-1)
92
90
  - [Candlestick Chart](#candlestick-chart-1)
91
+ - [Box Plot Chart](#box-plot-chart-1)
93
92
  - [Heatmap Chart](#heatmap-chart-1)
94
93
  - [Radar Chart](#radar-chart-1)
95
94
  - [Bubble Chart](#bubble-chart-1)
@@ -97,9 +96,9 @@ Choose the right README:
97
96
  - [Options](#options)
98
97
  - [Global Options](#global-options)
99
98
  - [Formatter Function](#formatter-function)
99
+ - [Defer Chart Rendering](#defer-chart-rendering)
100
+ - [Schema](#schema)
100
101
  - [Reusable Custom Palette](#reusable-custom-palette)
101
- - [Global Palette](#global-palette)
102
- - [Local Palette](#local-palette)
103
102
  - [Use Alongside Other Charting Libraries](#use-alongside-other-charting-libraries)
104
103
  - [Alongside Chartkick](#alongside-chartkick)
105
104
  - [Chartkick (Chart.js) and ApexCharts](#chartkick-chartjs-and-apexcharts)
@@ -110,7 +109,6 @@ Choose the right README:
110
109
  - [Rails](#rails)
111
110
  - [Sinatra](#sinatra)
112
111
  - [Plain HTML+ERB (Without Framework)](#plain-htmlerb-without-framework)
113
- - [Roadmap](#roadmap)
114
112
  - [Contributing](#contributing)
115
113
  - [License](#license)
116
114
  - [Like the charts?](#like-the-charts)
@@ -248,13 +246,18 @@ Given:
248
246
  <%
249
247
  require 'date'
250
248
 
251
- def ohlc(ary)
252
- [rand(ary.min..ary.max), ary.max, ary.min, rand(ary.min..ary.max)]
249
+ def candlestick_data
250
+ @acc = rand(6570..6650)
251
+ 60.times.map {|i| [Date.today - 60 + i, ohlc] }.to_h
253
252
  end
254
253
 
255
- candlestick_data = 50.times.map do |i|
256
- [Date.today - 50 + i, ohlc(Array.new(2){ rand(6570..6650) })]
257
- end.to_h
254
+ def ohlc
255
+ open = @acc + rand(-20..20)
256
+ high = open + rand(0..100)
257
+ low = open - rand(0..100)
258
+ @acc = close = open + rand(-((high-low)/3)..((high-low)/2))
259
+ [open, high, low, close]
260
+ end
258
261
 
259
262
  candlestick_options = {
260
263
  plot_options: {
@@ -274,8 +277,45 @@ You can make candlestick chart with this:
274
277
  ```
275
278
  ![Example Candlestick Chart](images/candlestick_chart.gif)
276
279
 
277
- Real life candlestick chart probably don't look like that.
278
- That's because I just use random sets of numbers as the data.
280
+
281
+ #### Box Plot Chart
282
+
283
+ Given:
284
+ ```erb
285
+ <%
286
+ require 'date'
287
+
288
+ def box_plot_data
289
+ 20.times.map {|i| [Date.today - 20 + i, box_plot_datum] }.to_h
290
+ end
291
+
292
+ def box_plot_datum
293
+ level = 1000
294
+ max = level + rand(50..300)
295
+ min = level - rand(50..300)
296
+ q1 = min + rand(10..50)
297
+ q3 = max - rand(10..50)
298
+ median = (min + q1 + q3 + max)/4
299
+ [min, q1, median, q3, max]
300
+ end
301
+
302
+ box_plot_options = {
303
+ plot_options: {
304
+ boxPlot: {
305
+ colors: {
306
+ upper: '#aaffaa',
307
+ lower: '#ffaaFF'
308
+ }
309
+ }
310
+ }
311
+ }
312
+ %>
313
+ ```
314
+ You can make box plot chart with this:
315
+ ```erb
316
+ <%= box_plot_chart(box_plot_data, box_plot_options) %>
317
+ ```
318
+ ![Example Box Plot Chart](images/box_plot_chart.gif)
279
319
 
280
320
 
281
321
  #### Mixed Charts
@@ -483,6 +523,29 @@ or this:
483
523
  ]
484
524
  ```
485
525
 
526
+ #### Box Plot Chart
527
+
528
+ Box plot chart is similar to candlestick chart, only the y value is
529
+ an array of 5 members (Minimum-First Quartile-Median-Third Quartile-Maximum):
530
+
531
+ ```ruby
532
+ {
533
+ <x value> => [<Min>, <Q1>, <Median>, <Q3>, <Max>],
534
+ <x value> => [<Min>, <Q1>, <Median>, <Q3>, <Max>],
535
+ ...
536
+ }
537
+ ```
538
+
539
+ or this:
540
+
541
+ ```ruby
542
+ [
543
+ [<x value>, [<Min>, <Q1>, <Median>, <Q3>, <Max>]],
544
+ [<x value>, [<Min>, <Q1>, <Median>, <Q3>, <Max>]],
545
+ ...
546
+ ]
547
+ ```
548
+
486
549
  ### Heatmap Chart
487
550
 
488
551
  The data format for heatmap chart **per-series** is similar to cartesian
@@ -625,14 +688,42 @@ use it like so:
625
688
  <%= area_chart series, tooltip: {y: {formatter: function(val) { return '$' + parseFloat(val).toLocaleString() }}} %>
626
689
  ```
627
690
 
691
+ Or, without the _functionable-json_ gem, use function as object as follows:
628
692
 
629
- ## Reusable Custom Palette
693
+ ```erb
694
+ <%= area_chart series, tooltip: {y: {formatter: {function: {args: "val", body: "return '$' + parseFloat(val).toLocaleString();"}} }} %>
695
+ ```
630
696
 
631
- You can create custom palette that works globally or locally.
632
697
 
633
- ### Global Palette
698
+ ### Defer Chart Rendering
699
+
700
+ It's possible to defer chart rendering by passing the argument `defer: true` as options.
701
+
702
+ ```erb
703
+ <%= line_chart series, defer: true %>
704
+ ```
705
+
706
+
707
+ ## Schema
708
+
709
+ To use [dry-schema] as an alternative options schema, you can specify the following config
710
+ before calling your charts:
711
+
712
+ ```ruby
713
+ ApexCharts.config.schema = :dry_schema
714
+ ```
715
+
716
+ or
717
+
718
+ ```ruby
719
+ ApexCharts.configure do |config|
720
+ config.schema = :dry_schema
721
+ end
722
+ ```
723
+
724
+ ## Reusable Custom Palette
634
725
 
635
- To create global palettes to be used anywhere on your any parts of your app, you can use
726
+ To create palettes to be used anywhere on your any parts of your app, you can use
636
727
  `ApexCharts::Theme.create`.
637
728
 
638
729
  For example, in rails app, you would write it in initializers:
@@ -657,26 +748,6 @@ If later for some reason I don't know you want to destroy the palette you can us
657
748
  ApexCharts::Theme.destroy "rainbow"
658
749
  ```
659
750
 
660
- ### Local Palette
661
-
662
- To create local palettes to be used only for current thread (usually for the duration
663
- of a request), you can use the `create_palette` helper. The theme will only be available
664
- on that page and inside its partials after the palette created.
665
-
666
- For example:
667
-
668
- ```ruby
669
- create_palette "ephemeral", ["#ab356d", "#12cdf3", "#665572", "#ababac"]
670
- ```
671
-
672
- To destroy the palette:
673
-
674
- ```ruby
675
- destroy_palette "ephemeral"
676
- ```
677
-
678
- on the same page or in its partials. Otherwise, nothing will happen.
679
-
680
751
 
681
752
  ## Use Alongside Other Charting Libraries
682
753
 
@@ -684,14 +755,13 @@ You can prefix the helper methods name with your chosen words to avoid name clas
684
755
  other charting libraries (e.g. chartkick, google_charts, etc.) you already use. Just set
685
756
  the `APEXCHARTS_PREFIX` environment variable to a string before you start your app server,
686
757
  say, 'awesome\_' and then on your views/templates use the chart helpers as `awesome_line_chart`,
687
- `awesome_area_chart`, and so on. `create_palette` and `destroy_palette` are left as is (not
688
- prefixed) as other libraries don't seem to have anything similar to them.
758
+ `awesome_area_chart`, and so on.
689
759
 
690
760
  Besides setting the environtment variable, if you just want a quick prefix, you can instead
691
761
  do this on your _Gemfile_:
692
762
 
693
763
  ```ruby
694
- gem 'apexcharts', require: 'apexcharts/prefix_with_apex'
764
+ gem 'apexcharts', require: 'apex_charts/prefix_with_apex'
695
765
  ```
696
766
 
697
767
  and you'll get `apex_line_chart`, `apex_area_chart`, etc.
@@ -794,7 +864,13 @@ $ yarn add apexcharts
794
864
  ```
795
865
  and then require it in your `app/javascript/packs/application.js`.
796
866
  ```js
797
- require("apexcharts")
867
+ // AMD
868
+ window.ApexCharts = require("apexcharts") // expose to window
869
+
870
+ // or
871
+ // ES6
872
+ import ApexCharts from 'apexcharts'
873
+ window.ApexCharts = ApexCharts
798
874
  ```
799
875
 
800
876
  ### Sinatra
@@ -844,17 +920,6 @@ $ erb sample.html.erb > sample.html
844
920
  ```
845
921
 
846
922
 
847
- ## Roadmap
848
-
849
- - Support other ruby frameworks (hanami, roda, cuba, middleman, etc.)
850
- - v0.1.x
851
- - Add more features (e.g. gradient line, background image, etc.)
852
- - v0.2.x
853
- - Replace dependency `smart_kv` with `dry-schema`
854
- - Display warnings on browser console on development instead of error page when
855
- schema doesn't meet
856
-
857
-
858
923
  ## Contributing
859
924
 
860
925
  Everyone is encouraged to help improve this project by:
@@ -862,7 +927,6 @@ Everyone is encouraged to help improve this project by:
862
927
  - Fixing bugs and submiting pull requests
863
928
  - Fixing documentation
864
929
  - Suggesting new features
865
- - Implementing todos on Roadmap above
866
930
 
867
931
 
868
932
  ## License
@@ -871,18 +935,21 @@ The gem is available as open source under the terms of the
871
935
  [MIT License](https://opensource.org/licenses/MIT).
872
936
 
873
937
 
874
- ## Like the charts?
875
-
876
- Consider donating to the author of [ApexCharts.JS] to support his awesome library.
877
- This project wouldn't be possible without it.
938
+ ## Articles
878
939
 
879
- Become a sponsor on [Patreon](https://patreon.com/junedchhipa).
880
- One time donation on [PayPal](https://paypal.me/junedchhipa)
940
+ - [Rails em 8 minutos: Criando gráficos incríveis com ApexCharts](https://onebitcode.com/graficos-incriveis-no-ruby-on-rails/)
941
+ - [【Rails】 5分でApexChart.jsを導入する方法](https://qiita.com/syukan3/items/aa741df278f628087a3c)
881
942
 
882
943
 
883
944
  [ApexCharts.JS]: https://github.com/apexcharts/apexcharts.js
945
+ [dry-schema]: https://github.com/dry-rb/dry-schema
884
946
 
885
947
 
948
+ [Unreleased]: https://github.com/styd/apexcharts.rb/compare/v0.1.11...HEAD
949
+ [v0.1.11]: https://github.com/styd/apexcharts.rb/blob/v0.1.11/README.md
950
+ [v0.1.10]: https://github.com/styd/apexcharts.rb/blob/v0.1.10/README.md
951
+ [v0.1.9]: https://github.com/styd/apexcharts.rb/blob/v0.1.9/README.md
952
+ [v0.1.8]: https://github.com/styd/apexcharts.rb/blob/v0.1.8/README.md
886
953
  [v0.1.7]: https://github.com/styd/apexcharts.rb/blob/v0.1.7/README.md
887
954
  [v0.1.6]: https://github.com/styd/apexcharts.rb/blob/v0.1.6/README.md
888
955
  [v0.1.5]: https://github.com/styd/apexcharts.rb/blob/v0.1.5/README.md
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ApexCharts::Charts
4
+ %w[
5
+ base cartesian line area bar column scatter
6
+ candlestick heatmap bubble radar polar pie donut
7
+ ].each do |type|
8
+ autoload :"#{type.capitalize}Chart", "apex_charts/charts/#{type}_chart.rb"
9
+ end
10
+
11
+ autoload :BoxPlotChart, 'apex_charts/charts/box_plot_chart.rb'
12
+ autoload :RangeBarChart, 'apex_charts/charts/range_bar_chart.rb'
13
+ autoload :RadialBarChart, 'apex_charts/charts/radial_bar_chart.rb'
14
+
15
+ autoload :MixedCharts, 'apex_charts/charts/mixed_charts.rb'
16
+ autoload :SyncingCharts, 'apex_charts/charts/syncing_charts.rb'
17
+ end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module ApexCharts
3
+ module ApexCharts::Charts
4
4
  class AreaChart < CartesianChart
5
5
  def chart_type
6
6
  'area'
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module ApexCharts
3
+ module ApexCharts::Charts
4
4
  class BarChart < CartesianChart
5
5
  def chart_type
6
6
  'bar'
@@ -1,6 +1,8 @@
1
- module ApexCharts
1
+ # frozen_string_literal: true
2
+
3
+ module ApexCharts::Charts
2
4
  class BaseChart
3
- include Utils::Hash
5
+ include ApexCharts::Utils::Hash
4
6
 
5
7
  attr_reader :options, :series, :sample
6
8
 
@@ -10,7 +12,7 @@ module ApexCharts
10
12
  end
11
13
 
12
14
  def render
13
- Renderer.render_default(options)
15
+ ApexCharts::Renderer.render(options)
14
16
  end
15
17
 
16
18
  def chart_type; end
@@ -25,7 +27,7 @@ module ApexCharts
25
27
 
26
28
  def build_options(options)
27
29
  deep_merge(
28
- OptionsBuilder.new(sample, options).build_options,
30
+ ApexCharts::OptionsBuilder.new(sample, options).build_options,
29
31
  camelize_keys(
30
32
  {**@series, chart: {type: chart_type}}.compact
31
33
  )
@@ -0,0 +1,8 @@
1
+
2
+ module ApexCharts::Charts
3
+ class BoxPlotChart < CartesianChart
4
+ def chart_type
5
+ 'boxPlot'
6
+ end
7
+ end
8
+ end
@@ -1,13 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module ApexCharts
3
+ module ApexCharts::Charts
4
4
  class BubbleChart < BaseChart
5
5
  def chart_type
6
6
  'bubble'
7
7
  end
8
8
 
9
9
  def series_type
10
- BubbleSeries
10
+ ApexCharts::Series::BubbleSeries
11
11
  end
12
12
  end
13
13
  end