From 2eb35bf4d69bc33c31412e1f8143ecb248f27035 Mon Sep 17 00:00:00 2001
From: Xiao Gui <xgui3783@gmail.com>
Date: Tue, 1 Oct 2019 14:59:05 +0200
Subject: [PATCH] bugfix: aot build

---
 src/ui/databrowserModule/fileviewer/chart.interface.ts | 10 ++++++++++
 .../fileviewer/fileviewer.component.ts                 |  9 ++-------
 .../fileviewer/fileviewer.template.html                |  2 +-
 .../fileviewer/line/line.chart.component.ts            |  5 +++--
 .../fileviewer/radar/radar.chart.component.ts          |  5 +++--
 5 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/src/ui/databrowserModule/fileviewer/chart.interface.ts b/src/ui/databrowserModule/fileviewer/chart.interface.ts
index 4a1371704..300eca5c2 100644
--- a/src/ui/databrowserModule/fileviewer/chart.interface.ts
+++ b/src/ui/databrowserModule/fileviewer/chart.interface.ts
@@ -1,6 +1,8 @@
 import { ChartOptions } from "chart.js";
 
 import merge from 'lodash.merge'
+import { SafeUrl } from "@angular/platform-browser";
+import { ElementRef } from "@angular/core";
 
 export interface ScaleOptionInterface{
   type? : string
@@ -69,6 +71,14 @@ export interface ScaleLabelInterface{
   display? : boolean
 }
 
+export interface CommonChartInterface{
+  csvDataUrl: SafeUrl
+  csvTitle: string
+  imageTitle: string
+
+  canvas: ElementRef
+}
+
 export const applyOption = (defaultOption:ChartOptions,option?:Partial<ChartOptions>)=>{
   merge(defaultOption,option)
 }
\ No newline at end of file
diff --git a/src/ui/databrowserModule/fileviewer/fileviewer.component.ts b/src/ui/databrowserModule/fileviewer/fileviewer.component.ts
index edaeafad7..37eaa626f 100644
--- a/src/ui/databrowserModule/fileviewer/fileviewer.component.ts
+++ b/src/ui/databrowserModule/fileviewer/fileviewer.component.ts
@@ -2,6 +2,7 @@ import { Component, Input, ViewChild, ElementRef, Inject, Optional, OnChanges }
 
 import { ViewerPreviewFile } from 'src/services/state/dataStore.store';
 import { MAT_DIALOG_DATA } from '@angular/material';
+import { CommonChartInterface } from './chart.interface';
 
 
 @Component({
@@ -18,7 +19,7 @@ export class FileViewer implements OnChanges{
    */
   @Input() previewFile : ViewerPreviewFile
   
-  @ViewChild('childChart') childChart : ChartComponentInterface
+  @ViewChild('childChart') childChart: CommonChartInterface
 
   constructor(
     @Optional() @Inject(MAT_DIALOG_DATA) data
@@ -31,9 +32,3 @@ export class FileViewer implements OnChanges{
     this.downloadUrl = this.previewFile.url
   }
 }
-
-interface ChartComponentInterface{
-  canvas : ElementRef,
-  shapedLineChartDatasets: any
-}
-
diff --git a/src/ui/databrowserModule/fileviewer/fileviewer.template.html b/src/ui/databrowserModule/fileviewer/fileviewer.template.html
index 35cc94aae..99fdf6575 100644
--- a/src/ui/databrowserModule/fileviewer/fileviewer.template.html
+++ b/src/ui/databrowserModule/fileviewer/fileviewer.template.html
@@ -23,7 +23,7 @@
   <div [ngSwitch]="previewFile.data.chartType"
     *ngSwitchCase="'application/json'">
     <radar-chart
-      #childChart
+      #childChart="iavRadarChart"
       [colors]="previewFile.data.colors"
       [options]="previewFile.data.chartOptions"
       [labels]="previewFile.data.labels"
diff --git a/src/ui/databrowserModule/fileviewer/line/line.chart.component.ts b/src/ui/databrowserModule/fileviewer/line/line.chart.component.ts
index 564b19f68..6e456f480 100644
--- a/src/ui/databrowserModule/fileviewer/line/line.chart.component.ts
+++ b/src/ui/databrowserModule/fileviewer/line/line.chart.component.ts
@@ -1,9 +1,10 @@
 import { Component, Input, OnChanges, ElementRef, ViewChild } from '@angular/core'
-import { DatasetInterface, ChartColor, ScaleOptionInterface, LegendInterface, TitleInterfacce, applyOption } from '../chart.interface'
+import { DatasetInterface, ChartColor, ScaleOptionInterface, LegendInterface, TitleInterfacce, applyOption, CommonChartInterface } from '../chart.interface'
 
 import { ChartOptions, LinearTickOptions,ChartDataSets } from 'chart.js';
 import { Color } from 'ng2-charts';
 import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
+
 @Component({
   selector : `line-chart`,
   templateUrl : './line.chart.template.html',
@@ -12,7 +13,7 @@ import { DomSanitizer, SafeUrl } from '@angular/platform-browser';
    ],
    exportAs: 'iavLineChart'
 })
-export class LineChart implements OnChanges{
+export class LineChart implements OnChanges, CommonChartInterface{
 
   @ViewChild('canvas') canvas: ElementRef
 
diff --git a/src/ui/databrowserModule/fileviewer/radar/radar.chart.component.ts b/src/ui/databrowserModule/fileviewer/radar/radar.chart.component.ts
index 2eaad28d9..2b97314d9 100644
--- a/src/ui/databrowserModule/fileviewer/radar/radar.chart.component.ts
+++ b/src/ui/databrowserModule/fileviewer/radar/radar.chart.component.ts
@@ -1,6 +1,6 @@
 import { Component, Input, OnChanges, ViewChild, ElementRef } from '@angular/core'
 
-import { DatasetInterface, ChartColor, ScaleOptionInterface, TitleInterfacce, LegendInterface, applyOption } from '../chart.interface';
+import { DatasetInterface, ChartColor, ScaleOptionInterface, TitleInterfacce, LegendInterface, applyOption, CommonChartInterface } from '../chart.interface';
 import { Color } from 'ng2-charts';
 import { SafeUrl, DomSanitizer } from '@angular/platform-browser';
 import { RadialChartOptions } from 'chart.js'
@@ -11,8 +11,9 @@ import { RadialChartOptions } from 'chart.js'
   styleUrls : [ 
     `./radar.chart.style.css`
    ],
+   exportAs: 'iavRadarChart'
 })
-export class RadarChart implements OnChanges{
+export class RadarChart implements OnChanges, CommonChartInterface{
 
   @ViewChild('canvas') canvas : ElementRef
   /**
-- 
GitLab