From 1ae1c178b734420360f24099e7c483fbbc83c1e0 Mon Sep 17 00:00:00 2001 From: vargburz Date: Fri, 15 Jan 2021 16:06:50 +0300 Subject: [PATCH] gauge resize --- src/index.ts | 56 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 43 insertions(+), 13 deletions(-) diff --git a/src/index.ts b/src/index.ts index b5e20d7..d934e9c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,4 @@ -import { GaugeTimeSerie, GaugeOptions, Stat, Stop, ValueTextFormat } from './types'; +import { GaugeTimeSerie, GaugeOptions, Stat, Stop } from './types'; import { ChartwerkPod, VueChartwerkPodMixin, ZoomType } from '@chartwerk/core'; @@ -27,7 +27,10 @@ const DEFAULT_GAUGE_OPTIONS: GaugeOptions = { zoom: { type: ZoomType.NONE }, - + margin: { + top: 0, bottom: 0, + left: 0, right: 0 + }, stops: [ { color: 'green', @@ -51,6 +54,7 @@ export class ChartwerkGaugePod extends ChartwerkPod 6 && this._valueText.length <= 10) { - return VALUE_TEXT_FONT_SIZE - 2; + font = VALUE_TEXT_FONT_SIZE - 2; } else if(this._valueText.length > 10 && this._valueText.length <= 12) { - return VALUE_TEXT_FONT_SIZE - 4; + font = VALUE_TEXT_FONT_SIZE - 4; } else { - return VALUE_TEXT_FONT_SIZE - 6; + font = VALUE_TEXT_FONT_SIZE - 6; } + return this.rescaleValueFont(font); } private get _stat(): Stat { @@ -211,11 +223,29 @@ export class ChartwerkGaugePod extends ChartwerkPod