add calculation

This commit is contained in:
Qiuxia Fan 2022-04-01 21:06:01 +08:00
parent b854b86ab4
commit b817ed5825
3 changed files with 5 additions and 0 deletions

View File

@ -32,6 +32,7 @@ export enum Calculations {
Precision = "precision", Precision = "precision",
ConvertSeconds = "convertSeconds", ConvertSeconds = "convertSeconds",
ConvertMilliseconds = "convertMilliseconds", ConvertMilliseconds = "convertMilliseconds",
MsTos = "msTos",
} }
export enum sizeEnum { export enum sizeEnum {
XS = "XS", XS = "XS",

View File

@ -351,6 +351,9 @@ export function aggregation(val: number, config: any): number | string {
case Calculations.Precision: case Calculations.Precision:
data = data.toFixed(2); data = data.toFixed(2);
break; break;
case Calculations.MsTos:
data = val / 1000;
break;
default: default:
data; data;
break; break;

View File

@ -272,4 +272,5 @@ export const CalculationOpts = [
}, },
{ label: "Convert seconds to YYYY-MM-DD HH:mm:ss", value: "convertSeconds" }, { label: "Convert seconds to YYYY-MM-DD HH:mm:ss", value: "convertSeconds" },
{ label: "Precision is 2", value: "precision" }, { label: "Precision is 2", value: "precision" },
{ label: "Milliseconds to seconds", value: "msTos" },
]; ];