supercharts-bullet_train 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f028c4e4c0144a3cc864dc7dfbfe3b04fe80462c1e602325e4520746a1c7e85
4
- data.tar.gz: e1871658b39073aed06174cca8dc9528939b89a6cd6560259d9bfddd80f993d8
3
+ metadata.gz: 4e811c023b43cfac138f37ad0cab28985d10a22732cb31222d64ada7566f7e2f
4
+ data.tar.gz: 129ebeb5e7114f83260850f5575292ca36fa93c4b8ae12af58c088a4245fdf47
5
5
  SHA512:
6
- metadata.gz: c4eaf6186a0186806bfaa6f616305bf00f8140a9543fb355237b2d37c0954abf4fc9a10ad6d1f9cb3175bbd4a532813afe3a784ff3625a03945d5d8c4104f707
7
- data.tar.gz: 53d1ef43b3227b868443a9bb5c845d23caaa6432d0b955959f8fe44d9a6260a5eb8d265f69ac7b82d8ceeb12c6d60a87dde9d72cade2bb803062a2832ca051df
6
+ metadata.gz: b0e757aa845f016496c787282abfee6ae47792de9d6bbca3b3c4b1b4b6495228423215614e5596652589c752b1a7a8b976efa22f6257eb02ae175b81ff4ede2b
7
+ data.tar.gz: 3de0a84b61460b609434a1cca51016fc303943d4cefd0f49140e6b9fb225c473b45214d2f886823a33b1748a3195d2d58c8cc90a624d9faf99b2911be1c64b53
data/README.md CHANGED
@@ -90,30 +90,35 @@ This will generated some new files and modify some files like inserting a `turbo
90
90
 
91
91
  ### Generate some test data
92
92
 
93
- We'll use a FactoryBot `trait` to randomize the `created_at` property for the test data we'll create. This is the change I suggest you make to your `factories/click_throughs.rb` file:
93
+ We'll use a new seed file create `click_throughs` with random-looking `created_at` properties (in this case creating a log normal spike and long-tail curve typical of a launch).
94
94
 
95
95
  ```ruby
96
- # test/factories/click_throughs.rb
97
- FactoryBot.define do
98
- factory :click_through do
99
- association :team
100
- # add the following lines if the file was already created
101
- trait :created_last_2_months do
102
- created_at { Time.at(2.months.ago + rand * (Time.now.to_f - 2.months.ago.to_f)) }
103
- end
96
+ # db/seeds/click_throughs.rb
97
+ team = Team.first
98
+
99
+ if team.present?
100
+ ClickThrough.delete_all # start fresh
101
+
102
+ # Rubystats::LognormalDistribution.new(1, 4.0)
103
+ sample_logn_days_since_launch = [0.374752478249304,2.573715367349214,8.205364533794372,0.018758139772852223,0.007503724554433451,9.795277947976652,8.920746829981699,0.10551189188869997,1.764721845714895,0.16013475895174034,0.09656162234229956,1.051545673721908,3.4605465909422444,0.5284662248320162,12.552059342378902,0.802742590175781,0.02109366834525422,0.02664778128443366,4.390318514353362,0.09774971155444112,1.2046433918447472,6.842861969154294,0.011979372791258703,0.064030764714403,0.254580889613002,0.8375254371675241,6.645595256049555,0.004578324225909655,7.645897327323974,3.8198662350854358,2.5433159804484093,12.23258356052949,8.590508575839966,0.36652090412334615,0.11151312341555021,0.17233489061676868,0.2146532779238352,0.14245752689762017,0.19342953572076568,0.1529907988439447,0.00750514011797885,0.4518938917044475,2.824609604776437,0.9950891711469877,1.0656326056125578,0.1261305417548888,0.009966388079746133,11.001041702449946,0.0013675811570916427,0.02367451456093704,0.01894224395588477,4.440315660471336,0.09493622122995193,0.07657312652331208,1.4874835063144172,0.13842079252030612,2.1017802510726815,4.196227775076141,0.054093691138304485,0.0051252791552137186,3.0245345093639773,0.00032997376067659843,0.006931535931463956,1.78040031800141,1.2156342429038396,1.7978965235819222,0.818322573101528,0.08369936871534746,0.16412718021762976,9.844260419603875,5.14537997872604,10.644277259959916,2.516432067417657,0.02670462498452867,0.009043612354757327,2.481241138462057,1.9882680498827123,0.11922535105626798,0.20284489863820995,0.1274031773301022,0.35779282006366203,1.0571276594384351,1.0249771657735456,0.6552185634235514,0.7524783523736271,0.2539575382334551,0.5439132099545871]
104
+
105
+ sample_logn_days_since_launch.each do |days_offset|
106
+ created_at = 2.weeks.ago + days_offset.days
107
+
108
+ team.click_throughs.create!(created_at: created_at)
104
109
  end
105
110
  end
106
111
  ```
107
112
 
108
- Then from the `rails console`:
113
+ Then run:
109
114
 
110
- ```ruby
111
- FactoryBot.create_list(:click_through, 450, :created_last_2_months, team_id: 1)
115
+ ```sh
116
+ bin/rails r db/seeds/click_throughs.rb
112
117
  ```
113
118
 
114
119
  Visit your app in `localhost:3000` and you should see your new chart.
115
120
 
116
- ![Example chart inside a Bullet Train app showing Click Throughs in the last 30 days](https://user-images.githubusercontent.com/104179/198366639-cd73eba5-eeb7-4654-bb35-8b0415b964c8.gif)
121
+ ![Example chart inside a Bullet Train app showing Click Throughs in the last 30 days](https://user-images.githubusercontent.com/104179/222187945-1ff4a8c5-96d1-40e8-b421-d48c6cc4425d.gif)
117
122
 
118
123
  ## Modifying the chart
119
124
 
@@ -147,12 +152,12 @@ For the following types of changes, you'll need to create your own Stimulus cont
147
152
  If you just want to make aesthetic changes, you can change the following css variables found at the top of your scaffolded `show.html.erb`. In this case, these are all TailwindCSS classes that set the appropriate custom CSS properties scoped to just that chart.
148
153
 
149
154
  ```html
150
- [--axis-color:theme('colors.gray.300')] dark:[--axis-color:theme('colors.darkPrimary.500')]
151
- [--grid-color:theme('colors.gray.100')] dark:[--grid-color:theme('colors.darkPrimary.800')]
155
+ [--axis-color:theme('colors.gray.300')] dark:[--axis-color:theme('colors.slate.500')]
156
+ [--grid-color:theme('colors.gray.100')] dark:[--grid-color:theme('colors.slate.800')]
152
157
  [--line-color:#a86fe7]
153
158
  [--point-color:theme('colors.gray.800')] dark:[--point-color:theme('colors.white')]
154
- [--point-stroke-color:theme('colors.white')] dark:[--point-stroke-color:theme('colors.darkPrimary.700')]
155
- [--point-stroke-color-hover:theme('colors.gray.100')] dark:[--point-stroke-color-hover:theme('colors.darkPrimary.800')]
159
+ [--point-stroke-color:theme('colors.white')] dark:[--point-stroke-color:theme('colors.slate.700')]
160
+ [--point-stroke-color-hover:theme('colors.gray.100')] dark:[--point-stroke-color-hover:theme('colors.slate.800')]
156
161
  [--bar-fill-color:var(--line-color)]
157
162
  [--bar-hover-fill-color:var(--point-color)]
158
163
  [--point-radius:4] md:[--point-radius:6]
@@ -1,12 +1,12 @@
1
1
  <%= turbo_frame_tag :charts_tangible_things do %>
2
2
  <div class="p-8 rounded-md shadow
3
- bg-white dark:bg-darkPrimary-700
4
- [--axis-color:theme('colors.gray.300')] dark:[--axis-color:theme('colors.darkPrimary.500')]
5
- [--grid-color:theme('colors.gray.100')] dark:[--grid-color:theme('colors.darkPrimary.800')]
6
- [--line-color:#a86fe7]
3
+ bg-white dark:bg-slate-900
4
+ [--axis-color:theme('colors.gray.300')] dark:[--axis-color:theme('colors.slate.500')]
5
+ [--grid-color:theme('colors.gray.100')] dark:[--grid-color:theme('colors.slate.800')]
6
+ [--line-color:theme('colors.primary.400')] dark:[--line-color:theme('colors.primary.600')]
7
7
  [--point-color:theme('colors.gray.800')] dark:[--point-color:theme('colors.white')]
8
- [--point-stroke-color:theme('colors.white')] dark:[--point-stroke-color:theme('colors.darkPrimary.700')]
9
- [--point-stroke-color-hover:theme('colors.gray.100')] dark:[--point-stroke-color-hover:theme('colors.darkPrimary.800')]
8
+ [--point-stroke-color:theme('colors.white')] dark:[--point-stroke-color:theme('colors.slate.900')]
9
+ [--point-stroke-color-hover:theme('colors.gray.100')] dark:[--point-stroke-color-hover:theme('colors.slate.800')]
10
10
  [--bar-fill-color:var(--line-color)]
11
11
  [--bar-hover-fill-color:var(--point-color)]
12
12
  [--point-radius:4] md:[--point-radius:6]
@@ -1,5 +1,4 @@
1
- <div class="p-8 rounded-md shadow
2
- bg-white dark:bg-darkPrimary-700">
1
+ <div class="p-8 rounded-md shadow bg-white dark:bg-slate-900">
3
2
  <h2 class="text-xs uppercase dark:text-white/50 mb-4">
4
3
  <%= yield %>
5
4
  </h2>
@@ -1,5 +1,5 @@
1
1
  module BulletTrain
2
2
  module Supercharts
3
- VERSION = "1.2.0"
3
+ VERSION = "1.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: supercharts-bullet_train
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pascal Laliberté
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-10 00:00:00.000000000 Z
11
+ date: 2023-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails