FIX: better legend labels for stacked-charts (#6914)

FIX: better legend labels for stacked-charts (#6914)

diff --git a/app/assets/javascripts/admin/components/admin-report-stacked-chart.js.es6 b/app/assets/javascripts/admin/components/admin-report-stacked-chart.js.es6
index dbc310b..fc9d7da 100644
--- a/app/assets/javascripts/admin/components/admin-report-stacked-chart.js.es6
+++ b/app/assets/javascripts/admin/components/admin-report-stacked-chart.js.es6
@@ -50,7 +50,7 @@ export default Ember.Component.extend({
       labels: chartData[0].data.map(cd => cd.x),
       datasets: chartData.map(cd => {
         return {
-          label: cd.req,
+          label: cd.label,
           stack: "pageviews-stack",
           data: cd.data.map(d => Math.round(parseFloat(d.y))),
           backgroundColor: cd.color
diff --git a/app/assets/javascripts/admin/components/admin-report.js.es6 b/app/assets/javascripts/admin/components/admin-report.js.es6
index 2f647f6..541d77e 100644
--- a/app/assets/javascripts/admin/components/admin-report.js.es6
+++ b/app/assets/javascripts/admin/components/admin-report.js.es6
@@ -396,6 +396,7 @@ export default Ember.Component.extend({
           return {
             data: collapseWeekly(chartData.data),
             req: chartData.req,
+            label: chartData.label,
             color: chartData.color
           };
         } else {
diff --git a/app/assets/javascripts/admin/models/report.js.es6 b/app/assets/javascripts/admin/models/report.js.es6
index ae0205b..21caf4a 100644
--- a/app/assets/javascripts/admin/models/report.js.es6
+++ b/app/assets/javascripts/admin/models/report.js.es6
@@ -478,6 +478,7 @@ Report.reopenClass({
         report[filledField] = report[dataField].map(rep => {
           return {
             req: rep.req,
+            label: rep.label,
             color: rep.color,
             data: fillMissingDates(
               JSON.parse(JSON.stringify(rep.data)),
diff --git a/app/models/report.rb b/app/models/report.rb
index a89e988..8ee3db8 100644
--- a/app/models/report.rb
+++ b/app/models/report.rb
@@ -221,6 +221,7 @@ class Report
 
       {
         req: filter,
+        label: I18n.t("reports.consolidated_page_views.xaxis.#{filter}"),
         color: color,
         data: ApplicationRequest.where(req_type: ApplicationRequest.req_types[filter])
       }
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 5dc09aa..001d300 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -969,9 +969,17 @@ en:
       description: "Number of users who made their first post during this period."
     consolidated_page_views:
       title: "Consolidated Pageviews"
-      xaxis: "Pagesviews"
+      xaxis:
+        page_view_crawler: "Crawlers"
+        page_view_anon: "Anonymous users"
+        page_view_logged_in: "Logged in users"
       yaxis: "Day"
       description: "Pageviews for logged in users, anonymous users and crawlers."
+      labels:
+        post: Post
+        editor: Editor
+        author: Author
+        edit_reason: Reason
     dau_by_mau:
       title: "DAU/MAU"
       xaxis: "Day"

GitHub sha: 3e1e9fce

1 Like