Browse Source

fix

merge-requests/1/merge
rozetko 4 years ago
parent
commit
152714387d
  1. 3
      dist/index.d.ts
  2. 2
      dist/index.js
  3. 21
      src/index.ts

3
dist/index.d.ts vendored

@ -1,11 +1,8 @@
import { GaugeTimeSerie, GaugeOptions, Stat } from './types'; import { GaugeTimeSerie, GaugeOptions, Stat } from './types';
import { ChartwerkPod } from '@chartwerk/core'; import { ChartwerkPod } from '@chartwerk/core';
export declare class ChartwerkGaugePod extends ChartwerkPod<GaugeTimeSerie, GaugeOptions> { export declare class ChartwerkGaugePod extends ChartwerkPod<GaugeTimeSerie, GaugeOptions> {
lastHeight: number;
lastWidth: number;
constructor(el: HTMLElement, _series?: GaugeTimeSerie[], _options?: GaugeOptions); constructor(el: HTMLElement, _series?: GaugeTimeSerie[], _options?: GaugeOptions);
renderMetrics(): void; renderMetrics(): void;
_waitForLoadAndRender(): void;
get _gaugeTransform(): string; get _gaugeTransform(): string;
get _gaugeCenter(): string; get _gaugeCenter(): string;
get _minWH(): number; get _minWH(): number;

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

21
src/index.ts

@ -51,9 +51,6 @@ const DEFAULT_GAUGE_OPTIONS: GaugeOptions = {
}; };
export class ChartwerkGaugePod extends ChartwerkPod<GaugeTimeSerie, GaugeOptions> { export class ChartwerkGaugePod extends ChartwerkPod<GaugeTimeSerie, GaugeOptions> {
lastHeight = -1;
lastWidth = -1;
constructor(el: HTMLElement, _series: GaugeTimeSerie[] = [], _options: GaugeOptions = {}) { constructor(el: HTMLElement, _series: GaugeTimeSerie[] = [], _options: GaugeOptions = {}) {
super( super(
d3, el, _series, d3, el, _series,
@ -67,21 +64,9 @@ export class ChartwerkGaugePod extends ChartwerkPod<GaugeTimeSerie, GaugeOptions
return; return;
} }
this._waitForLoadAndRender(); this._renderValueArc();
} this._renderThresholdArc();
this._renderValue();
_waitForLoadAndRender(): void {
if(this.width !== this.lastWidth && this.height !== this.lastHeight) {
this.lastWidth = this.width;
this.lastHeight = this.height;
setTimeout(() => {
this._waitForLoadAndRender();
}, 500);
} else {
this._renderValueArc();
this._renderThresholdArc();
this._renderValue();
}
} }
get _gaugeTransform(): string { get _gaugeTransform(): string {

Loading…
Cancel
Save