From 8be56f8a0e1e44581caf3e73326d429d87bc1576 Mon Sep 17 00:00:00 2001 From: ryan Date: Thu, 14 Mar 2019 13:31:50 -0700 Subject: [PATCH] improve single stat display --- .../plugins/panel/singlestat2/SingleStatPanel.tsx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/public/app/plugins/panel/singlestat2/SingleStatPanel.tsx b/public/app/plugins/panel/singlestat2/SingleStatPanel.tsx index f9f20487c95..10c5523e7c1 100644 --- a/public/app/plugins/panel/singlestat2/SingleStatPanel.tsx +++ b/public/app/plugins/panel/singlestat2/SingleStatPanel.tsx @@ -1,5 +1,5 @@ // Libraries -import React from 'react'; +import React, { CSSProperties } from 'react'; // Types import { SingleStatOptions } from './types'; @@ -8,9 +8,17 @@ import { SingleStatBase } from './SingleStatBase'; export class SingleStatPanel extends SingleStatBase { renderStat(value: DisplayValue, width: number, height: number) { + const style: CSSProperties = {}; + style.margin = '0 auto'; + style.fontSize = '250%'; + style.textAlign = 'center'; + if (value.color) { + style.color = value.color; + } + return (
- {value.text} +
{value.text}
); }