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. 21
      src/index.ts

7
dist/index.d.ts vendored

@ -1,12 +1,11 @@
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> {
private _gaugeTransform;
private _gaugeCenter;
private _minWH;
constructor(el: HTMLElement, _series?: GaugeTimeSerie[], _options?: GaugeOptions); constructor(el: HTMLElement, _series?: GaugeTimeSerie[], _options?: GaugeOptions);
renderMetrics(): void; renderMetrics(): void;
private _setBoundingBox; get _gaugeTransform(): string;
get _gaugeCenter(): string;
get _minWH(): number;
private _renderValue; private _renderValue;
private _renderValueArc; private _renderValueArc;
private _renderThresholdArc; private _renderThresholdArc;

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

21
src/index.ts

@ -51,11 +51,6 @@ const DEFAULT_GAUGE_OPTIONS: GaugeOptions = {
}; };
export class ChartwerkGaugePod extends ChartwerkPod<GaugeTimeSerie, 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 = {}) { constructor(el: HTMLElement, _series: GaugeTimeSerie[] = [], _options: GaugeOptions = {}) {
super( super(
d3, el, _series, d3, el, _series,
@ -69,18 +64,22 @@ export class ChartwerkGaugePod extends ChartwerkPod<GaugeTimeSerie, GaugeOptions
return; return;
} }
this._setBoundingBox();
this._renderValueArc(); this._renderValueArc();
this._renderThresholdArc(); this._renderThresholdArc();
this._renderValue(); this._renderValue();
} }
private _setBoundingBox(): void { get _gaugeTransform(): string {
// TODO: refactor return `translate(${this.width / 2},${0.8 * this.height})`;
this._gaugeTransform = `translate(${this.width / 2},${0.8 * this.height})`; }
this._gaugeCenter = `translate(${this.width / 2 + this.margin.left},${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 { private _renderValue(): void {

Loading…
Cancel
Save