From 78625c471b4f03a09bd42f72b82217e1f2d01cef Mon Sep 17 00:00:00 2001
From: Benjamin Bellamy <ben@podlibre.org>
Date: Tue, 20 Oct 2020 09:32:03 +0000
Subject: [PATCH] feat(analytics): add charts and data export

---
 app/Views/_assets/modules/Charts.ts | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/app/Views/_assets/modules/Charts.ts b/app/Views/_assets/modules/Charts.ts
index 3266714ec4..2f6053afd7 100644
--- a/app/Views/_assets/modules/Charts.ts
+++ b/app/Views/_assets/modules/Charts.ts
@@ -9,6 +9,9 @@ const drawPieChart = (chartDivId: string, dataUrl: string | null): void => {
   // Create chart instance
   const chart = am4core.create(chartDivId, am4charts.PieChart);
   am4core.percent(100);
+  chart.exporting.menu = new am4core.ExportMenu();
+  chart.exporting.menu.align = "left";
+  chart.exporting.menu.verticalAlign = "top";
   // Set theme
   am4core.useTheme(am4themes_material);
   chart.innerRadius = am4core.percent(10);
@@ -33,6 +36,9 @@ const drawXYChart = (chartDivId: string, dataUrl: string | null): void => {
   // Create chart instance
   const chart = am4core.create(chartDivId, am4charts.XYChart);
   am4core.percent(100);
+  chart.exporting.menu = new am4core.ExportMenu();
+  chart.exporting.menu.align = "right";
+  chart.exporting.menu.verticalAlign = "bottom";
   // Set theme
   am4core.useTheme(am4themes_material);
   // Create axes
@@ -66,6 +72,9 @@ const drawXYDurationChart = (chartDivId: string, dataUrl: string | null): void =
   // Create chart instance
   const chart = am4core.create(chartDivId, am4charts.XYChart);
   am4core.percent(100);
+  chart.exporting.menu = new am4core.ExportMenu();
+  chart.exporting.menu.align = "right";
+  chart.exporting.menu.verticalAlign = "bottom";
   // Set theme
   am4core.useTheme(am4themes_material);
   // Create axes
@@ -104,6 +113,9 @@ const drawXYSeriesChart = (
   // Create chart instance
   const chart = am4core.create(chartDivId, am4charts.XYChart);
   am4core.percent(100);
+  chart.exporting.menu = new am4core.ExportMenu();
+  chart.exporting.menu.align = "right";
+  chart.exporting.menu.verticalAlign = "bottom";
   // Set theme
   am4core.useTheme(am4themes_material);
   // Create axes
@@ -134,6 +146,9 @@ const drawMapChart = (chartDivId: string, dataUrl: string | null): void => {
   // Create map instance
   const chart = am4core.create(chartDivId, am4maps.MapChart);
   am4core.percent(100);
+  chart.exporting.menu = new am4core.ExportMenu();
+  chart.exporting.menu.align = "left";
+  chart.exporting.menu.verticalAlign = "top";
   // Set theme
   am4core.useTheme(am4themes_material);
   // Set map definition
-- 
GitLab