Browse Source

value size -> value font size

merge-requests/1/merge
vargburz 4 years ago
parent
commit
27c2da02ab
  1. 2
      dist/index.d.ts
  2. 2
      dist/index.js
  3. 2
      dist/types.d.ts
  4. 14
      src/index.ts
  5. 2
      src/types.ts

2
dist/index.d.ts vendored

@ -29,7 +29,7 @@ export declare class ChartwerkGaugePod extends ChartwerkPod<GaugeTimeSerie, Gaug
private get _valueText();
private get _valueTextFontSize();
private get _stat();
private get _valueSize();
private get _valueFontSize();
private get _valueArcBackgroundColor();
private get _innerRadius();
private get _outerRadius();

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

2
dist/types.d.ts vendored

@ -34,7 +34,7 @@ export declare type GaugeOptionsParams = {
stat: Stat;
valueFormatter: ValueFormatter;
icons: IconConfig[];
valueSize: number;
valueFontSize: number;
valueArcBackgroundColor: string;
};
export declare type GaugeOptions = Options & Partial<GaugeOptionsParams>;

14
src/index.ts

@ -47,7 +47,7 @@ const DEFAULT_GAUGE_OPTIONS: GaugeOptions = {
innerRadius: DEFAULT_INNER_RADIUS,
outerRadius: DEFAULT_OUTER_RADIUS,
icons: [],
valueSize: VALUE_TEXT_FONT_SIZE,
valueFontSize: VALUE_TEXT_FONT_SIZE,
valueArcBackgroundColor: BACKGROUND_COLOR
};
@ -291,13 +291,13 @@ export class ChartwerkGaugePod extends ChartwerkPod<GaugeTimeSerie, GaugeOptions
private get _valueTextFontSize(): number {
let font;
if(this._valueText.length <= 6) {
font = this._valueSize;
font = this._valueFontSize;
} else if(this._valueText.length > 6 && this._valueText.length <= 10) {
font = this._valueSize - 2;
font = this._valueFontSize - 2;
} else if(this._valueText.length > 10 && this._valueText.length <= 12) {
font = this._valueSize - 4;
font = this._valueFontSize - 4;
} else {
font = this._valueSize - 6;
font = this._valueFontSize - 6;
}
return this.rescaleValueFont(font);
}
@ -306,8 +306,8 @@ export class ChartwerkGaugePod extends ChartwerkPod<GaugeTimeSerie, GaugeOptions
return this.options.stat;
}
private get _valueSize(): number {
return this.options.valueSize;
private get _valueFontSize(): number {
return this.options.valueFontSize;
}
private get _valueArcBackgroundColor(): string {

2
src/types.ts

@ -38,7 +38,7 @@ export type GaugeOptionsParams = {
stat: Stat;
valueFormatter: ValueFormatter;
icons: IconConfig[];
valueSize: number;
valueFontSize: number;
valueArcBackgroundColor: string;
}
export type GaugeOptions = Options & Partial<GaugeOptionsParams>;

Loading…
Cancel
Save