|
|
@ -27,6 +27,7 @@ import { |
|
|
import { |
|
|
import { |
|
|
type AnimationsSpec, |
|
|
type AnimationsSpec, |
|
|
Chart, |
|
|
Chart, |
|
|
|
|
|
Decimation, |
|
|
Filler, |
|
|
Filler, |
|
|
LinearScale, |
|
|
LinearScale, |
|
|
LineController, |
|
|
LineController, |
|
|
@ -58,6 +59,7 @@ export class GfLineChartComponent |
|
|
@Input() benchmarkLabel = ''; |
|
|
@Input() benchmarkLabel = ''; |
|
|
@Input() colorScheme: ColorScheme = DEFAULT_COLOR_SCHEME; |
|
|
@Input() colorScheme: ColorScheme = DEFAULT_COLOR_SCHEME; |
|
|
@Input() currency: string; |
|
|
@Input() currency: string; |
|
|
|
|
|
@Input() dataDecimation = false; |
|
|
@Input() historicalDataItems: LineChartItem[]; |
|
|
@Input() historicalDataItems: LineChartItem[]; |
|
|
@Input() isAnimated = false; |
|
|
@Input() isAnimated = false; |
|
|
@Input() label: string; |
|
|
@Input() label: string; |
|
|
@ -82,6 +84,7 @@ export class GfLineChartComponent |
|
|
|
|
|
|
|
|
public constructor(private changeDetectorRef: ChangeDetectorRef) { |
|
|
public constructor(private changeDetectorRef: ChangeDetectorRef) { |
|
|
Chart.register( |
|
|
Chart.register( |
|
|
|
|
|
Decimation, |
|
|
Filler, |
|
|
Filler, |
|
|
LineController, |
|
|
LineController, |
|
|
LineElement, |
|
|
LineElement, |
|
|
@ -187,6 +190,9 @@ export class GfLineChartComponent |
|
|
this.chart.options.plugins ??= {}; |
|
|
this.chart.options.plugins ??= {}; |
|
|
this.chart.options.plugins.tooltip = |
|
|
this.chart.options.plugins.tooltip = |
|
|
this.getTooltipPluginConfiguration(); |
|
|
this.getTooltipPluginConfiguration(); |
|
|
|
|
|
this.chart.options.plugins.decimation = this.dataDecimation |
|
|
|
|
|
? { algorithm: 'lttb', enabled: true } |
|
|
|
|
|
: undefined; |
|
|
this.chart.options.animations = this.isAnimated |
|
|
this.chart.options.animations = this.isAnimated |
|
|
? animations |
|
|
? animations |
|
|
: undefined; |
|
|
: undefined; |
|
|
@ -206,6 +212,9 @@ export class GfLineChartComponent |
|
|
}, |
|
|
}, |
|
|
interaction: { intersect: false, mode: 'index' }, |
|
|
interaction: { intersect: false, mode: 'index' }, |
|
|
plugins: { |
|
|
plugins: { |
|
|
|
|
|
decimation: this.dataDecimation |
|
|
|
|
|
? { algorithm: 'lttb', enabled: true } |
|
|
|
|
|
: undefined, |
|
|
legend: { |
|
|
legend: { |
|
|
align: 'start', |
|
|
align: 'start', |
|
|
display: this.showLegend, |
|
|
display: this.showLegend, |
|
|
|