stats: turn satisfaction into a stacked area chart
This commit is contained in:
parent
351f2872a5
commit
34a2dc6b97
2 changed files with 8 additions and 6 deletions
|
@ -129,9 +129,9 @@ class StatsController < ApplicationController
|
||||||
|
|
||||||
def satisfaction_usagers
|
def satisfaction_usagers
|
||||||
legend = {
|
legend = {
|
||||||
Feedback.ratings.fetch(:happy) => "Satisfaits",
|
Feedback.ratings.fetch(:unhappy) => "Mécontents",
|
||||||
Feedback.ratings.fetch(:neutral) => "Neutres",
|
Feedback.ratings.fetch(:neutral) => "Neutres",
|
||||||
Feedback.ratings.fetch(:unhappy) => "Mécontents"
|
Feedback.ratings.fetch(:happy) => "Satisfaits"
|
||||||
}
|
}
|
||||||
|
|
||||||
number_of_weeks = 6
|
number_of_weeks = 6
|
||||||
|
@ -139,7 +139,7 @@ class StatsController < ApplicationController
|
||||||
.group_by_week(:created_at, last: number_of_weeks, current: false)
|
.group_by_week(:created_at, last: number_of_weeks, current: false)
|
||||||
.count
|
.count
|
||||||
|
|
||||||
Feedback.ratings.values.map do |rating|
|
legend.keys.map do |rating|
|
||||||
data = Feedback
|
data = Feedback
|
||||||
.where(rating: rating)
|
.where(rating: rating)
|
||||||
.group_by_week(:created_at, last: number_of_weeks, current: false)
|
.group_by_week(:created_at, last: number_of_weeks, current: false)
|
||||||
|
|
|
@ -25,8 +25,10 @@
|
||||||
|
|
||||||
.chart-container
|
.chart-container
|
||||||
.chart
|
.chart
|
||||||
= line_chart @satisfaction_usagers,
|
= area_chart @satisfaction_usagers,
|
||||||
colors: ["#15AD70", "#F28900", "rgba(161, 0, 5, 0.9)"]
|
stacked: true,
|
||||||
|
max: 100,
|
||||||
|
colors: ["#BD0107", "#F28900", "#15AD70"]
|
||||||
|
|
||||||
.stat-card.stat-card-half.pull-left
|
.stat-card.stat-card-half.pull-left
|
||||||
%span.stat-card-title
|
%span.stat-card-title
|
||||||
|
|
Loading…
Reference in a new issue