apexcharts 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +248 -52
  3. data/lib/apexcharts.rb +2 -1
  4. data/lib/apexcharts/charts.rb +11 -18
  5. data/lib/apexcharts/charts/base.rb +19 -18
  6. data/lib/apexcharts/charts/bubble.rb +2 -8
  7. data/lib/apexcharts/charts/cartesian.rb +30 -29
  8. data/lib/apexcharts/charts/donut.rb +0 -1
  9. data/lib/apexcharts/charts/features/annotations.rb +16 -17
  10. data/lib/apexcharts/charts/features/mixable.rb +1 -2
  11. data/lib/apexcharts/charts/heatmap.rb +2 -4
  12. data/lib/apexcharts/charts/mixed.rb +42 -32
  13. data/lib/apexcharts/charts/pie.rb +0 -1
  14. data/lib/apexcharts/charts/polar.rb +2 -9
  15. data/lib/apexcharts/charts/radar.rb +2 -4
  16. data/lib/apexcharts/charts/radial_bar.rb +0 -1
  17. data/lib/apexcharts/charts/syncing.rb +39 -25
  18. data/lib/apexcharts/colors.rb +4 -6
  19. data/lib/apexcharts/config.rb +25 -0
  20. data/lib/apexcharts/config/default_options.rb +12 -0
  21. data/lib/apexcharts/helper.rb +151 -87
  22. data/lib/apexcharts/options/annotations.rb +5 -5
  23. data/lib/apexcharts/options/axis.rb +12 -12
  24. data/lib/apexcharts/options/chart.rb +21 -21
  25. data/lib/apexcharts/options/data_labels.rb +9 -7
  26. data/lib/apexcharts/options/div_attributes.rb +4 -5
  27. data/lib/apexcharts/options/fill.rb +7 -7
  28. data/lib/apexcharts/options/grid.rb +10 -10
  29. data/lib/apexcharts/options/legend.rb +22 -19
  30. data/lib/apexcharts/options/markers.rb +13 -13
  31. data/lib/apexcharts/options/no_data.rb +7 -7
  32. data/lib/apexcharts/options/plot_options.rb +7 -7
  33. data/lib/apexcharts/options/root.rb +30 -30
  34. data/lib/apexcharts/options/states.rb +4 -4
  35. data/lib/apexcharts/options/stroke.rb +7 -7
  36. data/lib/apexcharts/options/subtitle.rb +3 -1
  37. data/lib/apexcharts/options/theme.rb +3 -3
  38. data/lib/apexcharts/options/title.rb +8 -8
  39. data/lib/apexcharts/options/tooltip.rb +17 -17
  40. data/lib/apexcharts/options/x_axis.rb +5 -5
  41. data/lib/apexcharts/options/y_axis.rb +8 -8
  42. data/lib/apexcharts/options_builder.rb +49 -60
  43. data/lib/apexcharts/prefix_with_apex.rb +5 -0
  44. data/lib/apexcharts/prefixer.rb +19 -0
  45. data/lib/apexcharts/renderer.rb +64 -17
  46. data/lib/apexcharts/series.rb +5 -3
  47. data/lib/apexcharts/series/bubble.rb +33 -22
  48. data/lib/apexcharts/series/cartesian.rb +63 -49
  49. data/lib/apexcharts/series/polar.rb +31 -17
  50. data/lib/apexcharts/support/rails.rb +1 -1
  51. data/lib/apexcharts/support/sinatra.rb +9 -0
  52. data/lib/apexcharts/theme.rb +5 -6
  53. data/lib/apexcharts/utils.rb +1 -0
  54. data/lib/apexcharts/utils/copy.rb +9 -0
  55. data/lib/apexcharts/utils/date_time.rb +50 -44
  56. data/lib/apexcharts/utils/hash.rb +2 -3
  57. data/lib/apexcharts/version.rb +1 -1
  58. data/vendor/assets/javascripts/apexcharts.js +2 -2
  59. metadata +27 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 691f5a61767a709faa0a664940bd1c3fd151ce3704bc4e8d611e0be89b24867b
4
- data.tar.gz: e7a6816de1ad3ac93511aee84f0b2217f98f9ebf1c57e5c4e00bf51b21c4ee73
3
+ metadata.gz: 54ad80f2d5b534d005e140000f3accfb846be669b5ead95ba608a7bf98b31561
4
+ data.tar.gz: 5f26699fcd55813b799a5834ffae901a12f25fd768aadb814599715bd030afaa
5
5
  SHA512:
6
- metadata.gz: 2cc56083d7c1a92157f27836ffdeec621951f67c4cc979850f4482a028a1433983f18d6fcd80a2ab847e1af34033c78b8a43fb32aff9a9bdefd4f0b7aa0305f2
7
- data.tar.gz: 79363b03e25c694ddba264375ca41a08853510fd27ef5d7533c73c99442cdd8d3aab68015016d5dfe597938189354493ecdb9ad44f582098b6add1197a913e9d
6
+ metadata.gz: 1f9bb66bf223bbc14f2b00789968324940488a860abdaa8a4128dc416b60110da4fcf9148d16845ca86c02c9835b3abb73d5071d38075eab2890f6f4d21aec48
7
+ data.tar.gz: ce976c0c8a8ac057f92ef0680cdfd3e5ab79af6b2d00f52d482704efc1146dbcb3bad8a0fcc330d89fa97d9618442dc6f78361b570e71835fbc9df96be43d445
data/README.md CHANGED
@@ -1,23 +1,55 @@
1
1
  <p align="center">
2
- <img src="images/placeholder.png" height="120">
2
+ <img src="images/placeholder.png" height="80">
3
3
  </p>
4
4
 
5
5
  <p align="center">
6
- <a href="https://rubygems.org/gems/apexcharts"><img src="https://img.shields.io/gem/v/apexcharts.svg?label=apexcharts" alt="Gem Version" /></a>
7
- <a href="https://travis-ci.org/styd/apexcharts.rb"><img src="https://travis-ci.org/styd/apexcharts.rb.svg?branch=master" alt="Build Status" /></a>
8
- <a href="https://rubygems.org/gems/apexcharts"><img alt="Downloads" src="https://img.shields.io/gem/dt/apexcharts"></a>
6
+ <a href="https://rubygems.org/gems/apexcharts">
7
+ <img src="https://img.shields.io/gem/v/apexcharts.svg?label=apexcharts" alt="Gem Version" />
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" />
11
+ </a>
12
+ <a href="https://rubygems.org/gems/apexcharts">
13
+ <img alt="Downloads" src="https://img.shields.io/gem/dt/apexcharts">
14
+ </a>
9
15
  <img src="https://img.shields.io/github/commit-activity/m/styd/apexcharts.rb.svg?label=commits" alt="Commits" />
10
- <a href="https://github.com/styd/apexcharts.rb/blob/master/LICENSE"><img src="https://img.shields.io/badge/License-MIT-brightgreen.svg" alt="License"></a>
11
- <a href="https://codeclimate.com/github/styd/apexcharts.rb/maintainability"><img src="https://api.codeclimate.com/v1/badges/07a4f59e67abfeae21cb/maintainability" /></a>
12
- <a href='https://coveralls.io/github/styd/apexcharts.rb?branch=master'><img src='https://coveralls.io/repos/github/styd/apexcharts.rb/badge.svg?branch=master' alt='Coverage Status' /></a>
16
+ <a href="https://github.com/styd/apexcharts.rb/blob/master/LICENSE">
17
+ <img src="https://img.shields.io/badge/License-MIT-brightgreen.svg" alt="License">
18
+ </a>
19
+ <a href="https://codeclimate.com/github/styd/apexcharts.rb/maintainability">
20
+ <img src="https://api.codeclimate.com/v1/badges/07a4f59e67abfeae21cb/maintainability" />
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' />
24
+ </a>
25
+ <a href='http://clayallsopp.github.io/readme-score/?url=styd/apexcharts.rb'>
26
+ <img src='http://readme-score-api.herokuapp.com/score.svg?url=styd/apexcharts.rb' alt='README Score' />
27
+ </a>
13
28
  </p>
14
29
 
15
30
 
16
- ## What is this?
31
+ ## About
17
32
 
18
- ApexCharts.RB is a ruby gem that wraps a JavaScript charting library called with the same name,
19
- [ApexCharts.JS](https://github.com/apexcharts/apexcharts.js), that's going to give you
20
- beautiful, interactive, and responsive charts for your ruby app.
33
+ > ApexCharts.RB is a ruby charting library that's going to give your ruby app beautiful,
34
+ > interactive, and responsive charts powered by [ApexCharts.JS]. On top of those sweet
35
+ > advantages, you'll also get extra features that you can't get by just including ApexCharts.JS
36
+ > to your ruby app, namely **view/template helpers for creating charts**, **options shortcuts**,
37
+ > **application wide default options**, **reusable custom theme palette**, and so on.
38
+
39
+
40
+ ## Trusted By
41
+
42
+ <img src="images/users/ventrata.png" title="Use case: ticket sales for clients (visitor attractions and tour operators)" width="180" height="40" />
43
+
44
+ > If your organization/company uses ApexCharts.RB in production, please comment on
45
+ > [this issue](https://github.com/styd/apexcharts.rb/issues/34).
46
+
47
+
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>
21
53
 
22
54
 
23
55
  ## README Versions
@@ -25,15 +57,15 @@ beautiful, interactive, and responsive charts for your ruby app.
25
57
  This README might not be for the version you use.
26
58
  Choose the right README:
27
59
 
28
- - [v0.1.6](https://github.com/styd/apexcharts.rb/blob/v0.1.6/README.md)
29
- - [v0.1.5](https://github.com/styd/apexcharts.rb/blob/v0.1.5/README.md)
30
- - [v0.1.4](https://github.com/styd/apexcharts.rb/blob/v0.1.4/README.md)
31
- - [v0.1.3](https://github.com/styd/apexcharts.rb/blob/v0.1.3/README.md)
32
- - [v0.1.2](https://github.com/styd/apexcharts.rb/blob/v0.1.2/README.md)
33
- - [v0.1.1](https://github.com/styd/apexcharts.rb/blob/v0.1.1/README.md)
60
+ > [v0.1.7] | [v0.1.6] | [v0.1.5] | [v0.1.4] | [v0.1.3] | [v0.1.2] | [v0.1.1]
34
61
 
35
62
  ## Table of Contents
36
63
 
64
+ - [About](#about)
65
+ - [Trusted By](#trusted-by)
66
+ - [Supported By](#supported-by)
67
+ - [README Versions](#readme-versions)
68
+ - [Table of Contents](#table-of-contents)
37
69
  - [Usage](#usage)
38
70
  - [Cartesian Charts](#cartesian-charts)
39
71
  - [Line Chart](#line-chart)
@@ -64,12 +96,19 @@ Choose the right README:
64
96
  - [Polar Charts](#polar-charts-1)
65
97
  - [Options](#options)
66
98
  - [Global Options](#global-options)
67
- - [Installation](#installation)
99
+ - [Formatter Function](#formatter-function)
68
100
  - [Reusable Custom Palette](#reusable-custom-palette)
69
101
  - [Global Palette](#global-palette)
70
102
  - [Local Palette](#local-palette)
103
+ - [Use Alongside Other Charting Libraries](#use-alongside-other-charting-libraries)
104
+ - [Alongside Chartkick](#alongside-chartkick)
105
+ - [Chartkick (Chart.js) and ApexCharts](#chartkick-chartjs-and-apexcharts)
106
+ - [Chartkick (Google Charts) and ApexCharts](#chartkick-google-charts-and-apexcharts)
107
+ - [Chartkick (Highcharts) and ApexCharts](#chartkick-highcharts-and-apexcharts)
108
+ - [Installation](#installation)
71
109
  - [Web Support](#web-support)
72
110
  - [Rails](#rails)
111
+ - [Sinatra](#sinatra)
73
112
  - [Plain HTML+ERB (Without Framework)](#plain-htmlerb-without-framework)
74
113
  - [Roadmap](#roadmap)
75
114
  - [Contributing](#contributing)
@@ -265,7 +304,8 @@ you can do this:
265
304
 
266
305
  #### Syncing Charts
267
306
 
268
- You can synchronize charts by using `syncing_charts` or `synchronized_charts` methods. For example:
307
+ You can synchronize charts by using `syncing_charts` or `synchronized_charts` methods. For
308
+ example:
269
309
  ```erb
270
310
  <%= syncing_charts(chart: {toolbar: false}, height: 250, style: 'display: inline-block; width: 32%;') do %>
271
311
  <% mixed_charts(theme: 'palette4', data_labels: false) do %>
@@ -513,10 +553,29 @@ just any single value of type Numeric.
513
553
 
514
554
  ## Options
515
555
 
516
- ApexCharts.RB supports [all options from apexcharts.js](https://apexcharts.com/docs/options/), but instead of camelCase, you can write them in snake_case.
556
+ ApexCharts.RB supports [all options from ApexCharts.JS](https://apexcharts.com/docs/options/),
557
+ but instead of *camelCase*, you can write them in *snake_case*.
558
+
559
+ ApexCharts.RB also provides shortcuts to some ApexCharts.JS options, such as `title`. In
560
+ ApexCharts.JS you would have to write
561
+
562
+ ```ruby
563
+ title: { text: "Some title" }
564
+ ```
565
+ In ApexCharts.RB you can write
566
+ ```ruby
567
+ title: "Some title"
568
+ ```
569
+ if you just want to add the text.
517
570
 
518
- ApexCharts.RB also provides shortcuts to some ApexCharts.js options, such as `title`. In ApexCharts.js you would have to write `title: { text: "Some title" }`. In ApexCharts.rb you can write `title: "Some title"` if you just want to add the text.
519
- `xtitle` and `ytitle` are even greater shortcuts. Instead of `xaxis: { title: { text: "x title" } }` you can write `xtitle: "x title"`."
571
+ `xtitle` and `ytitle` are even greater shortcuts. Instead of
572
+ ```ruby
573
+ xaxis: { title: { text: "x title" } }
574
+ ```
575
+ you can write
576
+ ```ruby
577
+ xtitle: "x title"
578
+ ```
520
579
 
521
580
  ```ruby
522
581
  options = {
@@ -540,35 +599,30 @@ These options can be passed to any chart helper like `<%= line_chart(series, opt
540
599
 
541
600
  ### Global Options
542
601
 
543
- To change options globally, you can manipulate the `Apex` JavaScript object directly:
602
+ To use default options globally, you can specify config for default options before calling
603
+ your charts. In Rails, put it in `initializers` directory. For example:
544
604
 
545
- ```javascript
546
- require("apexcharts")
605
+ ```ruby
606
+ # config/initializers/apexcharts.rb
547
607
 
548
- const apexGlobalOptions = {
549
- chart: {
550
-
551
- },
552
-
608
+ ApexCharts.config.default_options = {
609
+ data_labels: false,
610
+ tootip: true,
611
+ theme: 'my-theme'
553
612
  }
554
-
555
- Object.assign(Apex, apexGlobalOptions)
556
613
  ```
557
614
 
558
- All charts will then be created with these global options, which can be overwritten individually by any ApexCharts.RB helper method.
615
+ All charts will then automatically pick up these global options, which can be overwritten
616
+ individually by any options passed to the relevant chart helper.
559
617
 
618
+ ### Formatter Function
560
619
 
561
- ## Installation
562
- Add this line to your application's Gemfile:
620
+ To use a _simple_ formatter function (e.g. formatter in `tooltip`, `data_labels`, and `labels`),
621
+ you can add [functionable-json](https://github.com/styd/functionable-json) to your Gemfile and
622
+ use it like so:
563
623
 
564
- ```ruby
565
- gem 'groupdate' # optional
566
- gem 'apexcharts'
567
- ```
568
-
569
- And then execute:
570
- ```bash
571
- $ bundle
624
+ ```erb
625
+ <%= area_chart series, tooltip: {y: {formatter: function(val) { return '$' + parseFloat(val).toLocaleString() }}} %>
572
626
  ```
573
627
 
574
628
 
@@ -624,11 +678,112 @@ destroy_palette "ephemeral"
624
678
  on the same page or in its partials. Otherwise, nothing will happen.
625
679
 
626
680
 
681
+ ## Use Alongside Other Charting Libraries
682
+
683
+ You can prefix the helper methods name with your chosen words to avoid name clashing with
684
+ other charting libraries (e.g. chartkick, google_charts, etc.) you already use. Just set
685
+ the `APEXCHARTS_PREFIX` environment variable to a string before you start your app server,
686
+ 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.
689
+
690
+ Besides setting the environtment variable, if you just want a quick prefix, you can instead
691
+ do this on your _Gemfile_:
692
+
693
+ ```ruby
694
+ gem 'apexcharts', require: 'apexcharts/prefix_with_apex'
695
+ ```
696
+
697
+ and you'll get `apex_line_chart`, `apex_area_chart`, etc.
698
+
699
+ The prefix you set only applies to the outer chart helpers. The inner chart helpers is not
700
+ prefixed. For example:
701
+
702
+ ```erb
703
+ <%= awesome_syncing_chart(syncing_options) do %>
704
+ <% combo_chart(mixed_options) do %>
705
+ <% line_chart(line_series) %>
706
+ <% area_chart(area_series) %>
707
+ <% end %>
708
+ <% end %>
709
+ ```
710
+
711
+ ### Alongside Chartkick
712
+
713
+ Given:
714
+
715
+ ```erb
716
+ <% series = [
717
+ {name: 'Verified', data: @verified_users},
718
+ {name: 'Unverified', data: @unverified_users}
719
+ ] %>
720
+ <% options = {
721
+ legend: 'bottom', title: 'Users Grouped By Week For The Last 1 Year',
722
+ ytitle: 'Users', width: '100%', height: '300px'
723
+ } %>
724
+ ```
725
+
726
+ #### Chartkick (Chart.js) and ApexCharts
727
+
728
+ ```erb
729
+ <div style="display: inline-block; width: 48%;">
730
+ <%= area_chart(series, {**options, adapter: 'chartjs'}) %>
731
+ </div>
732
+ <div style="display: inline-block; width: 48%;">
733
+ <%= apex_area_chart(series, options) %>
734
+ </div>
735
+ ```
736
+
737
+ ![Chartkick (Chart.js) And ApexCharts](images/chartkick-chartjs-and-apexcharts.gif)
738
+
739
+ #### Chartkick (Google Charts) and ApexCharts
740
+
741
+ ```erb
742
+ <div style="display: inline-block; width: 48%;">
743
+ <%= area_chart(series, {**options, adapter: 'google'}) %>
744
+ </div>
745
+
746
+ <div style="display: inline-block; width: 48%;">
747
+ <%= apex_area_chart(series, options) %>
748
+ </div>
749
+ ```
750
+
751
+ ![Chartkick (Google Charts) And ApexCharts](images/chartkick-google-and-apexcharts.gif)
752
+
753
+ #### Chartkick (Highcharts) and ApexCharts
754
+
755
+ ```erb
756
+ <div style="display: inline-block; width: 48%;">
757
+ <%= area_chart(series, {**options, adapter: 'highcharts'}) %>
758
+ </div>
759
+
760
+ <div style="display: inline-block; width: 48%;">
761
+ <%= apex_area_chart(series, options) %>
762
+ </div>
763
+ ```
764
+
765
+ ![Chartkick (Highcharts) And ApexCharts](images/chartkick-highcharts-and-apexcharts.gif)
766
+
767
+
768
+ ## Installation
769
+ Add this line to your application's Gemfile:
770
+
771
+ ```ruby
772
+ gem 'groupdate' # optional
773
+ gem 'apexcharts'
774
+ ```
775
+
776
+ And then execute:
777
+ ```bash
778
+ $ bundle
779
+ ```
780
+
781
+
627
782
  ## Web Support
628
783
 
629
784
  ### Rails
630
785
 
631
- After installing the gem, require it in your `app/assets/javascripts/application.js`.
786
+ Require it in your `app/assets/javascripts/application.js`.
632
787
  ```js
633
788
  //= require apexcharts
634
789
  ```
@@ -642,20 +797,48 @@ and then require it in your `app/javascript/packs/application.js`.
642
797
  require("apexcharts")
643
798
  ```
644
799
 
800
+ ### Sinatra
801
+
802
+ Require it after you `require 'sinatra/base'` and add helper `Sinatra::ApexCharts` in the
803
+ class that inherits from `Sinatra::Base`.
804
+
805
+ ```ruby
806
+ require 'sinatra/base'
807
+ require 'apexcharts'
808
+
809
+ class SimpleApp < Sinatra::Base
810
+ helpers Sinatra::ApexCharts
811
+ end
812
+ ```
813
+
814
+ To add the asset (ApexCharts.JS), include a script tag in your template
815
+ as follows:
816
+
817
+ ```ruby
818
+ template :index do
819
+ <<~INDEX
820
+ <script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
821
+ <% series = {...} %>
822
+ <%= pie_chart(series, legend: "left") %>
823
+ INDEX
824
+ end
825
+ ```
826
+
827
+ For more details, [see example](examples/sinatra/sample.rb).
828
+
829
+
645
830
  ### Plain HTML+ERB (Without Framework)
646
831
 
647
- After installing the gem, insert this to the top of your .html.erb files:
832
+ Insert this to the top of your .html.erb files:
648
833
 
649
- ```html+erb
834
+ ```erb
650
835
  <script src="https://cdn.jsdelivr.net/npm/apexcharts"></script>
651
- <% require 'set' %>
652
836
  <% require 'apexcharts' %>
653
837
  <% include ApexCharts::Helper %>
654
838
  ```
655
- `require 'set'` is needed because of an issue in the dependency used, but not needed
656
- in v0.2.x release of ApexCharts.RB.
657
839
 
658
840
  You can then generate the static html page with e.g.
841
+
659
842
  ```bash
660
843
  $ erb sample.html.erb > sample.html
661
844
  ```
@@ -663,7 +846,7 @@ $ erb sample.html.erb > sample.html
663
846
 
664
847
  ## Roadmap
665
848
 
666
- - Support other ruby frameworks (sinatra, hanami, etc.)
849
+ - Support other ruby frameworks (hanami, roda, cuba, middleman, etc.)
667
850
  - v0.1.x
668
851
  - Add more features (e.g. gradient line, background image, etc.)
669
852
  - v0.2.x
@@ -684,13 +867,26 @@ Everyone is encouraged to help improve this project by:
684
867
 
685
868
  ## License
686
869
 
687
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
870
+ The gem is available as open source under the terms of the
871
+ [MIT License](https://opensource.org/licenses/MIT).
688
872
 
689
873
 
690
874
  ## Like the charts?
691
875
 
692
- Consider donating to the author of ApexCharts.JS to support his awesome library.
876
+ Consider donating to the author of [ApexCharts.JS] to support his awesome library.
693
877
  This project wouldn't be possible without it.
694
878
 
695
879
  Become a sponsor on [Patreon](https://patreon.com/junedchhipa).
696
880
  One time donation on [PayPal](https://paypal.me/junedchhipa)
881
+
882
+
883
+ [ApexCharts.JS]: https://github.com/apexcharts/apexcharts.js
884
+
885
+
886
+ [v0.1.7]: https://github.com/styd/apexcharts.rb/blob/v0.1.7/README.md
887
+ [v0.1.6]: https://github.com/styd/apexcharts.rb/blob/v0.1.6/README.md
888
+ [v0.1.5]: https://github.com/styd/apexcharts.rb/blob/v0.1.5/README.md
889
+ [v0.1.4]: https://github.com/styd/apexcharts.rb/blob/v0.1.4/README.md
890
+ [v0.1.3]: https://github.com/styd/apexcharts.rb/blob/v0.1.3/README.md
891
+ [v0.1.2]: https://github.com/styd/apexcharts.rb/blob/v0.1.2/README.md
892
+ [v0.1.1]: https://github.com/styd/apexcharts.rb/blob/v0.1.1/README.md
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'apexcharts/support/rails' if defined? Rails
4
3
  require 'apexcharts/helper'
4
+ require 'apexcharts/support/rails' if defined? Rails
5
+ require 'apexcharts/support/sinatra' if defined? Sinatra
@@ -1,20 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative 'charts/base'
4
- require_relative 'charts/cartesian'
5
- require_relative 'charts/line'
6
- require_relative 'charts/area'
7
- require_relative 'charts/bar'
8
- require_relative 'charts/column'
9
- require_relative 'charts/scatter'
10
- require_relative 'charts/candlestick'
11
- require_relative 'charts/range_bar'
12
- require_relative 'charts/heatmap'
13
- require_relative 'charts/bubble'
14
- require_relative 'charts/radar'
15
- require_relative 'charts/mixed'
16
- require_relative 'charts/syncing'
17
- require_relative 'charts/polar'
18
- require_relative 'charts/pie'
19
- require_relative 'charts/donut'
20
- require_relative 'charts/radial_bar'
3
+ module ApexCharts
4
+ %w(
5
+ base cartesian line area bar column scatter candlestick
6
+ heatmap bubble radar mixed syncing polar pie donut
7
+ ).each do |type|
8
+ autoload :"#{type.capitalize}Chart", "apexcharts/charts/#{type}.rb"
9
+ end
10
+
11
+ autoload :RangeBarChart, 'apexcharts/charts/range_bar.rb'
12
+ autoload :RadialBarChart, 'apexcharts/charts/radial_bar.rb'
13
+ end