]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/shared/components/sparkline/sparkline.component.ts
import 15.2.0 Octopus source
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / shared / components / sparkline / sparkline.component.ts
index 856eabf798c29b51dab425b3c3f17315e3dc9dd8..3a477f06589dd5e837051b04c5a66d6235f1d143 100644 (file)
@@ -10,9 +10,9 @@ import { DimlessBinaryPipe } from '../../pipes/dimless-binary.pipe';
   styleUrls: ['./sparkline.component.scss']
 })
 export class SparklineComponent implements OnInit, OnChanges {
-  @ViewChild('sparkCanvas')
+  @ViewChild('sparkCanvas', { static: true })
   chartCanvasRef: ElementRef;
-  @ViewChild('sparkTooltip')
+  @ViewChild('sparkTooltip', { static: true })
   chartTooltipRef: ElementRef;
 
   @Input()
@@ -36,7 +36,7 @@ export class SparklineComponent implements OnInit, OnChanges {
     }
   ];
 
-  options = {
+  options: Record<string, any> = {
     animation: {
       duration: 0
     },
@@ -56,7 +56,7 @@ export class SparklineComponent implements OnInit, OnChanges {
       intersect: false,
       custom: undefined,
       callbacks: {
-        label: (tooltipItem) => {
+        label: (tooltipItem: any) => {
           if (this.isBinary) {
             return this.dimlessBinaryPipe.transform(tooltipItem.yLabel);
           } else {
@@ -91,11 +91,11 @@ export class SparklineComponent implements OnInit, OnChanges {
   constructor(private dimlessBinaryPipe: DimlessBinaryPipe) {}
 
   ngOnInit() {
-    const getStyleTop = (tooltip) => {
+    const getStyleTop = (tooltip: any) => {
       return tooltip.caretY - tooltip.height - tooltip.yPadding - 5 + 'px';
     };
 
-    const getStyleLeft = (tooltip, positionX) => {
+    const getStyleLeft = (tooltip: any, positionX: number) => {
       return positionX + tooltip.caretX + 'px';
     };
 
@@ -111,7 +111,7 @@ export class SparklineComponent implements OnInit, OnChanges {
       borderColor: this.colors[0].pointBorderColor
     };
 
-    this.options.tooltips.custom = (tooltip) => {
+    this.options.tooltips.custom = (tooltip: any) => {
       chartTooltip.customTooltips(tooltip);
     };
   }