Browse Source

debug

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

7
dist/index.d.ts vendored

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

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

23
src/index.ts

@ -51,11 +51,6 @@ const DEFAULT_GAUGE_OPTIONS: GaugeOptions = {
};
export class ChartwerkGaugePod extends ChartwerkPod<GaugeTimeSerie, GaugeOptions> {
// TODO: better name
private _gaugeTransform = '';
private _gaugeCenter = '';
private _minWH = 0;
constructor(el: HTMLElement, _series: GaugeTimeSerie[] = [], _options: GaugeOptions = {}) {
super(
d3, el, _series,
@ -69,18 +64,22 @@ export class ChartwerkGaugePod extends ChartwerkPod<GaugeTimeSerie, GaugeOptions
return;
}
this._setBoundingBox();
this._renderValueArc();
this._renderThresholdArc();
this._renderValue();
}
private _setBoundingBox(): void {
// TODO: refactor
this._gaugeTransform = `translate(${this.width / 2},${0.8 * this.height})`;
this._gaugeCenter = `translate(${this.width / 2 + this.margin.left},${0.8 * this.height})`;
get _gaugeTransform(): string {
return `translate(${this.width / 2},${0.8 * this.height})`;
}
get _gaugeCenter(): string {
return `translate(${this.width / 2 + this.margin.left},${0.8 * this.height})`;
}
this._minWH = _.min([0.6 * this.width, this.height]);
get _minWH(): number {
console.log(this.width, this.height);
return _.min([0.6 * this.width, this.height]);
}
private _renderValue(): void {
@ -250,7 +249,7 @@ export class ChartwerkGaugePod extends ChartwerkPod<GaugeTimeSerie, GaugeOptions
private get _valueTextDecimals(): number {
if(this.options.valueTextFormat === undefined) {
throw new Error(`Options has no valueTextFormat`);
throw new Error(`Options has no valueTextFormat`);
}
return this.options.valueTextFormat.decimals;
}

Loading…
Cancel
Save