Skip to content

Commit

Permalink
fix: hover legend bug (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
shafy authored Jul 15, 2022
1 parent 475bd0c commit 8841a00
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 99 deletions.
146 changes: 74 additions & 72 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,67 +1,67 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (7.0.3)
actionpack (= 7.0.3)
activesupport (= 7.0.3)
actioncable (7.0.3.1)
actionpack (= 7.0.3.1)
activesupport (= 7.0.3.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (7.0.3)
actionpack (= 7.0.3)
activejob (= 7.0.3)
activerecord (= 7.0.3)
activestorage (= 7.0.3)
activesupport (= 7.0.3)
actionmailbox (7.0.3.1)
actionpack (= 7.0.3.1)
activejob (= 7.0.3.1)
activerecord (= 7.0.3.1)
activestorage (= 7.0.3.1)
activesupport (= 7.0.3.1)
mail (>= 2.7.1)
net-imap
net-pop
net-smtp
actionmailer (7.0.3)
actionpack (= 7.0.3)
actionview (= 7.0.3)
activejob (= 7.0.3)
activesupport (= 7.0.3)
actionmailer (7.0.3.1)
actionpack (= 7.0.3.1)
actionview (= 7.0.3.1)
activejob (= 7.0.3.1)
activesupport (= 7.0.3.1)
mail (~> 2.5, >= 2.5.4)
net-imap
net-pop
net-smtp
rails-dom-testing (~> 2.0)
actionpack (7.0.3)
actionview (= 7.0.3)
activesupport (= 7.0.3)
actionpack (7.0.3.1)
actionview (= 7.0.3.1)
activesupport (= 7.0.3.1)
rack (~> 2.0, >= 2.2.0)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (7.0.3)
actionpack (= 7.0.3)
activerecord (= 7.0.3)
activestorage (= 7.0.3)
activesupport (= 7.0.3)
actiontext (7.0.3.1)
actionpack (= 7.0.3.1)
activerecord (= 7.0.3.1)
activestorage (= 7.0.3.1)
activesupport (= 7.0.3.1)
globalid (>= 0.6.0)
nokogiri (>= 1.8.5)
actionview (7.0.3)
activesupport (= 7.0.3)
actionview (7.0.3.1)
activesupport (= 7.0.3.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (7.0.3)
activesupport (= 7.0.3)
activejob (7.0.3.1)
activesupport (= 7.0.3.1)
globalid (>= 0.3.6)
activemodel (7.0.3)
activesupport (= 7.0.3)
activerecord (7.0.3)
activemodel (= 7.0.3)
activesupport (= 7.0.3)
activestorage (7.0.3)
actionpack (= 7.0.3)
activejob (= 7.0.3)
activerecord (= 7.0.3)
activesupport (= 7.0.3)
activemodel (7.0.3.1)
activesupport (= 7.0.3.1)
activerecord (7.0.3.1)
activemodel (= 7.0.3.1)
activesupport (= 7.0.3.1)
activestorage (7.0.3.1)
actionpack (= 7.0.3.1)
activejob (= 7.0.3.1)
activerecord (= 7.0.3.1)
activesupport (= 7.0.3.1)
marcel (~> 1.0)
mini_mime (>= 1.1.0)
activesupport (7.0.3)
activesupport (7.0.3.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
Expand Down Expand Up @@ -139,14 +139,15 @@ GEM
foreman (0.87.2)
globalid (1.0.0)
activesupport (>= 5.0)
i18n (1.10.0)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
importmap-rails (1.0.3)
actionpack (>= 6.0.0)
railties (>= 6.0.0)
jbuilder (2.11.5)
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
json (2.6.2)
listen (3.7.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
Expand All @@ -160,8 +161,8 @@ GEM
matrix (0.4.2)
method_source (1.0.0)
mini_mime (1.1.2)
minitest (5.15.0)
msgpack (1.5.2)
minitest (5.16.2)
msgpack (1.5.3)
multi_json (1.15.0)
multipart-post (2.2.3)
net-imap (0.2.3)
Expand All @@ -179,44 +180,44 @@ GEM
net-protocol
timeout
nio4r (2.5.8)
nokogiri (1.13.6-x86_64-darwin)
nokogiri (1.13.7-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.13.6-x86_64-linux)
nokogiri (1.13.7-x86_64-linux)
racc (~> 1.4)
orm_adapter (0.5.0)
parallel (1.22.1)
parser (3.1.2.0)
ast (~> 2.4.1)
pg (1.3.5)
pg (1.4.1)
public_suffix (4.0.7)
puma (5.6.4)
nio4r (~> 2.0)
racc (1.6.0)
rack (2.2.3.1)
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (7.0.3)
actioncable (= 7.0.3)
actionmailbox (= 7.0.3)
actionmailer (= 7.0.3)
actionpack (= 7.0.3)
actiontext (= 7.0.3)
actionview (= 7.0.3)
activejob (= 7.0.3)
activemodel (= 7.0.3)
activerecord (= 7.0.3)
activestorage (= 7.0.3)
activesupport (= 7.0.3)
rack (2.2.4)
rack-test (2.0.2)
rack (>= 1.3)
rails (7.0.3.1)
actioncable (= 7.0.3.1)
actionmailbox (= 7.0.3.1)
actionmailer (= 7.0.3.1)
actionpack (= 7.0.3.1)
actiontext (= 7.0.3.1)
actionview (= 7.0.3.1)
activejob (= 7.0.3.1)
activemodel (= 7.0.3.1)
activerecord (= 7.0.3.1)
activestorage (= 7.0.3.1)
activesupport (= 7.0.3.1)
bundler (>= 1.15.0)
railties (= 7.0.3)
railties (= 7.0.3.1)
rails-dom-testing (2.0.3)
activesupport (>= 4.2.0)
nokogiri (>= 1.6)
rails-html-sanitizer (1.4.3)
loofah (~> 2.3)
railties (7.0.3)
actionpack (= 7.0.3)
activesupport (= 7.0.3)
railties (7.0.3.1)
actionpack (= 7.0.3.1)
activesupport (= 7.0.3.1)
method_source
rake (>= 12.2)
thor (~> 1.0)
Expand All @@ -226,13 +227,14 @@ GEM
rb-fsevent (0.11.1)
rb-inotify (0.10.1)
ffi (~> 1.0)
redis (4.6.0)
redis (4.7.1)
regexp_parser (2.5.0)
responders (3.0.1)
actionpack (>= 5.0)
railties (>= 5.0)
rexml (3.2.5)
rubocop (1.30.1)
rubocop (1.31.2)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.1.0.0)
rainbow (>= 2.2.2, < 4.0)
Expand All @@ -241,19 +243,19 @@ GEM
rubocop-ast (>= 1.18.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.18.0)
rubocop-ast (1.19.1)
parser (>= 3.1.1.0)
rubocop-performance (1.14.2)
rubocop (>= 1.7.0, < 2.0)
rubocop-ast (>= 0.4.0)
rubocop-rails (2.14.2)
rubocop-rails (2.15.2)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.7.0, < 2.0)
ruby-progressbar (1.11.0)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
selenium-webdriver (4.2.1)
selenium-webdriver (4.3.0)
childprocess (>= 0.5, < 5.0)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
Expand All @@ -272,7 +274,7 @@ GEM
shoulda-matchers (5.1.0)
activesupport (>= 5.2.0)
spring (4.0.0)
sprockets (4.0.3)
sprockets (4.1.1)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
sprockets-rails (3.4.2)
Expand All @@ -287,9 +289,9 @@ GEM
multi_json (~> 1.0)
stripe (> 5, < 6)
strscan (3.0.3)
tailwindcss-rails (2.0.8-x86_64-darwin)
tailwindcss-rails (2.0.10-x86_64-darwin)
railties (>= 6.0.0)
tailwindcss-rails (2.0.8-x86_64-linux)
tailwindcss-rails (2.0.10-x86_64-linux)
railties (>= 6.0.0)
thor (1.2.1)
timeout (0.3.0)
Expand All @@ -298,7 +300,7 @@ GEM
railties (>= 6.0.0)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
unicode-display_width (2.1.0)
unicode-display_width (2.2.0)
warden (1.2.9)
rack (>= 2.0.9)
web-console (4.2.0)
Expand All @@ -316,7 +318,7 @@ GEM
websocket-extensions (0.1.5)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.5.4)
zeitwerk (2.6.0)

PLATFORMS
x86_64-darwin-20
Expand Down
6 changes: 3 additions & 3 deletions app/controllers/funnels_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,13 @@ def set_funnel_event_names
def show_test_funnel_creation_alert
return unless params[:test] == "true"

flash.now[:info] = "You are creating a funnel in test mode. "\
"This means that you can only select events tracked in test mode. "\
flash.now[:info] = "You are creating a funnel in test mode. " \
"This means that you can only select events tracked in test mode. " \
"Unlike test events, test funnels are not deleted after 14 days."
end

def show_no_events_alert
flash.now[:alert] = "You haven't tracked any events in the current mode. "\
flash.now[:alert] = "You haven't tracked any events in the current mode. " \
"Make sure to track events before creating a funnel."
end
end
2 changes: 1 addition & 1 deletion app/helpers/event_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def agg_select_options(url_params, aggregation, possible_aggregations)
disabled = "disabled" if possible_aggregations.exclude?(k)
selected = "selected" if k == aggregation
agg_url = build_agg_url(url_params.permit(*Event::EVENT_PARAMS), k)
"<option data-url='#{agg_url}' data-name='#{k}' #{disabled} #{selected}>#{v.capitalize}"\
"<option data-url='#{agg_url}' data-name='#{k}' #{disabled} #{selected}>#{v.capitalize}" \
"</option>"
end
end
Expand Down
12 changes: 9 additions & 3 deletions app/javascript/controllers/chart_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export default class extends Controller {
}

showChart() {
console.log(this.eventsValue)
const data = {
labels: formatDates(this.datesValue, this.aggValue),
datasets: Object.keys(this.eventsValue).map((e, i) => this.createDataSet(e, this.eventsValue[e], i))
Expand Down Expand Up @@ -93,9 +94,14 @@ export default class extends Controller {
);
}

createDataSet(label, data, index) {
createDataSet(labelData, data, index) {
let label = ""
if (labelData !== "") {
label = `${htmlDecode(labelData)} (${data["total_count"]})`
}

return {
label: `${htmlDecode(label)} (${data["total_count"]})`,
label,
backgroundColor: this.colorPalette[index % this.colorPalette.length],
borderColor: this.colorPalette[index % this.colorPalette.length],
borderJointStyle: "round",
Expand All @@ -107,7 +113,7 @@ export default class extends Controller {
hoverBorderWidth: 4,
data: data["data"],
//hidden: !data["visible"]
hidden: !this.visiblePropValues.includes(htmlDecode(label))
hidden: !this.visiblePropValues.includes(htmlDecode(labelData))
}
}

Expand Down
13 changes: 7 additions & 6 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,8 @@ def excluded_property_names
return unless (properties.keys.map(&:downcase) & excluded_names).any?

errors.add(:properties,
"You've used a property name that's prohibited by Fugu (such as 'all')."\
" Learn more about property constraints in the Fugu docs: https://docs.fugu.lol")
"You've used a property name that's prohibited by Fugu (such as 'all'). " \
"Learn more about property constraints in the Fugu docs: https://docs.fugu.lol")
end

def excluded_property_values
Expand All @@ -284,8 +284,9 @@ def excluded_property_values
return unless contains_excluded_values

errors.add(:properties,
"You've used a property value that's prohibited by Fugu (such as an email address)."\
" Learn more about property constraints in the Fugu docs: https://docs.fugu.lol")
"You've used a property value that's prohibited by Fugu " \
"(such as an email address). " \
"Learn more about property constraints in the Fugu docs: https://docs.fugu.lol")
end

def limit_property_name_length
Expand All @@ -296,8 +297,8 @@ def limit_property_name_length
return unless properties.keys.map(&:length).any? { |l| l > 15 }

errors.add(:properties,
"You've used a property name that's too long (> 15 characters)."\
" Please choose a shorter name.")
"You've used a property name that's too long (> 15 characters). " \
"Please choose a shorter name.")
end
end
# rubocop: enable Metrics/ClassLength
Loading

0 comments on commit 8841a00

Please sign in to comment.