Commit 734910811151c9099a39da32a56eee046a3d59d1

Authored by Vladyslav_Prykhodko
1 parent c4fd3cb5

Fixed not correct label text for weight font; Refactoring

... ... @@ -163,7 +163,7 @@ export const analogueCompassSettingsSchema: JsonSettingsSchema = {
163 163 form: [
164 164 {
165 165 key: 'majorTicks',
166   - items:[
  166 + items: [
167 167 'majorTicks[]'
168 168 ]
169 169 },
... ... @@ -267,7 +267,7 @@ export const analogueCompassSettingsSchema: JsonSettingsSchema = {
267 267 },
268 268 {
269 269 value: '700',
270   - label: '800'
  270 + label: '700'
271 271 },
272 272 {
273 273 value: '800',
... ...
... ... @@ -43,7 +43,7 @@ export class TbAnalogueCompass extends TbBaseGauge<AnalogueCompassSettings, Radi
43 43 protected createGaugeOptions(gaugeElement: HTMLElement, settings: AnalogueCompassSettings): RadialGaugeOptions {
44 44
45 45 const majorTicks = (settings.majorTicks && settings.majorTicks.length > 0) ? deepClone(settings.majorTicks) :
46   - ['N','NE','E','SE','S','SW','W','NW'];
  46 + ['N', 'NE', 'E', 'SE', 'S', 'SW', 'W', 'NW'];
47 47 majorTicks.push(majorTicks[0]);
48 48
49 49 return {
... ...
... ... @@ -492,7 +492,7 @@ export const analogueGaugeSettingsSchema: JsonSettingsSchema = {
492 492 },
493 493 {
494 494 value: '700',
495   - label: '800'
  495 + label: '700'
496 496 },
497 497 {
498 498 value: '800',
... ... @@ -581,7 +581,7 @@ export const analogueGaugeSettingsSchema: JsonSettingsSchema = {
581 581 },
582 582 {
583 583 value: '700',
584   - label: '800'
  584 + label: '700'
585 585 },
586 586 {
587 587 value: '800',
... ... @@ -670,7 +670,7 @@ export const analogueGaugeSettingsSchema: JsonSettingsSchema = {
670 670 },
671 671 {
672 672 value: '700',
673   - label: '800'
  673 + label: '700'
674 674 },
675 675 {
676 676 value: '800',
... ... @@ -759,7 +759,7 @@ export const analogueGaugeSettingsSchema: JsonSettingsSchema = {
759 759 },
760 760 {
761 761 value: '700',
762   - label: '800'
  762 + label: '700'
763 763 },
764 764 {
765 765 value: '800',
... ... @@ -842,7 +842,7 @@ export abstract class TbBaseGauge<S, O extends GenericOptions> {
842 842 private gauge: BaseGauge;
843 843
844 844 protected constructor(protected ctx: WidgetContext, canvasId: string) {
845   - const gaugeElement = $('#'+canvasId, ctx.$container)[0];
  845 + const gaugeElement = $('#' + canvasId, ctx.$container)[0];
846 846 const settings: S = ctx.settings;
847 847 const gaugeData: O = this.createGaugeOptions(gaugeElement, settings);
848 848 this.gauge = this.createGauge(gaugeData as O).draw();
... ... @@ -859,7 +859,7 @@ export abstract class TbBaseGauge<S, O extends GenericOptions> {
859 859 const tvPair = cellData.data[cellData.data.length -
860 860 1];
861 861 const value = tvPair[1];
862   - if(value !== this.gauge.value) {
  862 + if (value !== this.gauge.value) {
863 863 this.gauge.value = value;
864 864 }
865 865 }
... ... @@ -876,10 +876,10 @@ export abstract class TbBaseGauge<S, O extends GenericOptions> {
876 876 }
877 877 }
878 878
879   -export abstract class TbAnalogueGauge<S extends AnalogueGaugeSettings, O extends GenericOptions> extends TbBaseGauge<S,O> {
  879 +export abstract class TbAnalogueGauge<S extends AnalogueGaugeSettings, O extends GenericOptions> extends TbBaseGauge<S, O> {
880 880
881 881 protected constructor(ctx: WidgetContext, canvasId: string) {
882   - super(ctx,canvasId);
  882 + super(ctx, canvasId);
883 883 }
884 884
885 885 protected createGaugeOptions(gaugeElement: HTMLElement, settings: S): O {
... ... @@ -891,26 +891,26 @@ export abstract class TbAnalogueGauge<S extends AnalogueGaugeSettings, O extends
891 891 const keyColor = settings.defaultColor || dataKey.color;
892 892
893 893 const majorTicksCount = settings.majorTicksCount || 10;
894   - const total = maxValue-minValue;
895   - let step = (total/majorTicksCount);
  894 + const total = maxValue - minValue;
  895 + let step = (total / majorTicksCount);
896 896
897 897 const valueInt = settings.valueInt || 3;
898 898
899 899 const valueDec = getValueDec(this.ctx, settings);
900 900
901   - step = parseFloat(parseFloat(step+'').toFixed(valueDec));
  901 + step = parseFloat(parseFloat(step + '').toFixed(valueDec));
902 902
903 903 const majorTicks: number[] = [];
904 904 const highlights: Highlight[] = [];
905 905 let tick = minValue;
906 906
907   - while(tick<=maxValue) {
  907 + while (tick <= maxValue) {
908 908 majorTicks.push(tick);
909   - let nextTick = tick+step;
910   - nextTick = parseFloat(parseFloat(nextTick+'').toFixed(valueDec));
911   - if (tick<maxValue) {
  909 + let nextTick = tick + step;
  910 + nextTick = parseFloat(parseFloat(nextTick + '').toFixed(valueDec));
  911 + if (tick < maxValue) {
912 912 const highlightColor = tinycolor(keyColor);
913   - const percent = (tick-minValue)/total;
  913 + const percent = (tick - minValue) / total;
914 914 highlightColor.setAlpha(percent);
915 915 const highlight: Highlight = {
916 916 from: tick,
... ...