Fix type errors in chart tooltip callbacks

Signed-off-by: Mcat12 <newtoncat12@yahoo.com>
This commit is contained in:
Mcat12
2019-05-27 13:54:36 -07:00
parent c8e654b2cf
commit 29f1a4e2d8
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -52,7 +52,8 @@ class ClientsGraph extends Component<ClientsGraphProps & WithNamespaces, {}> {
},
callbacks: {
title: tooltipItem => {
const time = tooltipItem[0].xLabel!.match(/(\d?\d):?(\d?\d?)/);
const timeStr = tooltipItem[0].xLabel! as string;
const time = timeStr.match(/(\d?\d):?(\d?\d?)/);
const hour = parseInt(time![1], 10);
const minute = parseInt(time![2], 10) || 0;
const from = padNumber(hour) + ":" + padNumber(minute - 5) + ":00";
+2 -1
View File
@@ -70,7 +70,8 @@ class QueriesGraph extends Component<QueriesGraphProps & WithNamespaces, {}> {
mode: "x-axis",
callbacks: {
title: tooltipItem => {
const time = tooltipItem[0].xLabel!.match(/(\d?\d):?(\d?\d?)/);
const timeStr = tooltipItem[0].xLabel! as string;
const time = timeStr.match(/(\d?\d):?(\d?\d?)/);
const hour = parseInt(time![1], 10);
const minute = parseInt(time![2], 10) || 0;
const from = padNumber(hour) + ":" + padNumber(minute - 5) + ":00";