Skip to content

Commit

Permalink
Performance improvement (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
hoblin authored Oct 7, 2023
1 parent 82699d4 commit 2ff54ea
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions app/decorators/tweet_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,60 @@ class TweetDecorator < Draper::Decorator
delegate_all

def combined_chart
h.area_chart combined_metrics_series, height: "20vh", library: chart_options
h.area_chart combined_metrics_series, height: "40vh", library: chart_options
end

def likes_chart
h.line_chart(
likes_metric[:data],
id: "likes-chart",
min: min_y(likes_metric),
max: max_y(likes_metric),
height: "70vh",
height: "60vh",
library: single_metric_chart_options("Likes")
)
end

def replies_chart
h.line_chart(
replies_metric[:data],
id: "replies-chart",
min: min_y(replies_metric),
max: max_y(replies_metric),
height: "70vh",
height: "60vh",
library: single_metric_chart_options("Replies")
)
end

def reposts_chart
h.line_chart(
reposts_metric[:data],
id: "reposts-chart",
min: min_y(reposts_metric),
max: max_y(reposts_metric),
height: "70vh",
height: "60vh",
library: single_metric_chart_options("Reposts")
)
end

def bookmarks_chart
h.line_chart(
bookmarks_metric[:data],
id: "bookmarks-chart",
min: min_y(bookmarks_metric),
max: max_y(bookmarks_metric),
height: "70vh",
height: "60vh",
library: single_metric_chart_options("Bookmarks")
)
end

def views_chart
h.line_chart(
views_metric[:data],
id: "views-chart",
min: min_y(views_metric),
max: max_y(views_metric),
height: "70vh",
height: "60vh",
library: single_metric_chart_options("Views")
)
end
Expand Down Expand Up @@ -84,6 +89,17 @@ def chart_options
theme: {
display: "flex"
}
},
boost: {
useGPUTranslations: true,
usePreAllocated: true
},
plotOptions: {
series: {
dataGrouping: {
enabled: true
}
}
}
}
end
Expand Down

0 comments on commit 2ff54ea

Please sign in to comment.