diff client/src/components/gauge/Waterlevel.vue @ 3927:03f37e64701c

Factored out default template for diagrams in a single file.
author Sascha Wilde <wilde@intevation.de>
date Thu, 11 Jul 2019 16:55:31 +0200
parents 4f93bfb5725d
children b03d54958ccd
line wrap: on
line diff
--- a/client/src/components/gauge/Waterlevel.vue	Thu Jul 11 16:25:56 2019 +0200
+++ b/client/src/components/gauge/Waterlevel.vue	Thu Jul 11 16:55:31 2019 +0200
@@ -114,6 +114,7 @@
 import { pdfgen, templateLoader } from "@/lib/mixins";
 import { HTTP } from "@/lib/http";
 import { displayError } from "@/lib/errors";
+import { defaultDiagramTemplate } from "@/lib/DefaultDiagramTemplate";
 // we should load only d3 modules we need but for now we'll go with the lazy way
 // https://www.giacomodebidda.com/how-to-import-d3-plugins-with-webpack/
 // d3-line-chunked plugin: https://github.com/pbeshai/d3-line-chunked
@@ -132,43 +133,7 @@
         template: null
       },
       templates: [],
-      defaultTemplate: {
-        name: "Default",
-        properties: {
-          paperSize: "a4"
-        },
-        elements: [
-          {
-            type: "diagram",
-            position: "topleft",
-            offset: { x: 15, y: 50 },
-            width: 240,
-            height: 100
-          },
-          {
-            type: "diagramlegend",
-            position: "topleft",
-            offset: { x: 42, y: 172 },
-            color: "black"
-          },
-          {
-            type: "diagramtitle",
-            position: "topleft",
-            offset: { x: 50, y: 26 },
-            fontsize: 22,
-            color: "steelblue"
-          },
-          {
-            type: "text",
-            position: "topleft",
-            offset: { x: 3, y: 3 },
-            fontsize: 8,
-            width: 90,
-            color: "gray",
-            text: this.$gettext("Generated by") + " " + "{user}, {date}"
-          }
-        ]
-      },
+      defaultTemplate: defaultDiagramTemplate,
       pdf: {
         doc: null,
         width: 420,