Skip to content
Snippets Groups Projects
Commit 2eb35bf4 authored by Xiao Gui's avatar Xiao Gui
Browse files

bugfix: aot build

parent 5ddaa89a
No related branches found
No related tags found
No related merge requests found
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
......@@ -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
}
......@@ -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"
......
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
......
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
/**
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment