Commit 734910811151c9099a39da32a56eee046a3d59d1
1 parent
c4fd3cb5
Fixed not correct label text for weight font; Refactoring
Showing
3 changed files
with
19 additions
and
19 deletions
@@ -163,7 +163,7 @@ export const analogueCompassSettingsSchema: JsonSettingsSchema = { | @@ -163,7 +163,7 @@ export const analogueCompassSettingsSchema: JsonSettingsSchema = { | ||
163 | form: [ | 163 | form: [ |
164 | { | 164 | { |
165 | key: 'majorTicks', | 165 | key: 'majorTicks', |
166 | - items:[ | 166 | + items: [ |
167 | 'majorTicks[]' | 167 | 'majorTicks[]' |
168 | ] | 168 | ] |
169 | }, | 169 | }, |
@@ -267,7 +267,7 @@ export const analogueCompassSettingsSchema: JsonSettingsSchema = { | @@ -267,7 +267,7 @@ export const analogueCompassSettingsSchema: JsonSettingsSchema = { | ||
267 | }, | 267 | }, |
268 | { | 268 | { |
269 | value: '700', | 269 | value: '700', |
270 | - label: '800' | 270 | + label: '700' |
271 | }, | 271 | }, |
272 | { | 272 | { |
273 | value: '800', | 273 | value: '800', |
@@ -43,7 +43,7 @@ export class TbAnalogueCompass extends TbBaseGauge<AnalogueCompassSettings, Radi | @@ -43,7 +43,7 @@ export class TbAnalogueCompass extends TbBaseGauge<AnalogueCompassSettings, Radi | ||
43 | protected createGaugeOptions(gaugeElement: HTMLElement, settings: AnalogueCompassSettings): RadialGaugeOptions { | 43 | protected createGaugeOptions(gaugeElement: HTMLElement, settings: AnalogueCompassSettings): RadialGaugeOptions { |
44 | 44 | ||
45 | const majorTicks = (settings.majorTicks && settings.majorTicks.length > 0) ? deepClone(settings.majorTicks) : | 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 | majorTicks.push(majorTicks[0]); | 47 | majorTicks.push(majorTicks[0]); |
48 | 48 | ||
49 | return { | 49 | return { |
@@ -492,7 +492,7 @@ export const analogueGaugeSettingsSchema: JsonSettingsSchema = { | @@ -492,7 +492,7 @@ export const analogueGaugeSettingsSchema: JsonSettingsSchema = { | ||
492 | }, | 492 | }, |
493 | { | 493 | { |
494 | value: '700', | 494 | value: '700', |
495 | - label: '800' | 495 | + label: '700' |
496 | }, | 496 | }, |
497 | { | 497 | { |
498 | value: '800', | 498 | value: '800', |
@@ -581,7 +581,7 @@ export const analogueGaugeSettingsSchema: JsonSettingsSchema = { | @@ -581,7 +581,7 @@ export const analogueGaugeSettingsSchema: JsonSettingsSchema = { | ||
581 | }, | 581 | }, |
582 | { | 582 | { |
583 | value: '700', | 583 | value: '700', |
584 | - label: '800' | 584 | + label: '700' |
585 | }, | 585 | }, |
586 | { | 586 | { |
587 | value: '800', | 587 | value: '800', |
@@ -670,7 +670,7 @@ export const analogueGaugeSettingsSchema: JsonSettingsSchema = { | @@ -670,7 +670,7 @@ export const analogueGaugeSettingsSchema: JsonSettingsSchema = { | ||
670 | }, | 670 | }, |
671 | { | 671 | { |
672 | value: '700', | 672 | value: '700', |
673 | - label: '800' | 673 | + label: '700' |
674 | }, | 674 | }, |
675 | { | 675 | { |
676 | value: '800', | 676 | value: '800', |
@@ -759,7 +759,7 @@ export const analogueGaugeSettingsSchema: JsonSettingsSchema = { | @@ -759,7 +759,7 @@ export const analogueGaugeSettingsSchema: JsonSettingsSchema = { | ||
759 | }, | 759 | }, |
760 | { | 760 | { |
761 | value: '700', | 761 | value: '700', |
762 | - label: '800' | 762 | + label: '700' |
763 | }, | 763 | }, |
764 | { | 764 | { |
765 | value: '800', | 765 | value: '800', |
@@ -842,7 +842,7 @@ export abstract class TbBaseGauge<S, O extends GenericOptions> { | @@ -842,7 +842,7 @@ export abstract class TbBaseGauge<S, O extends GenericOptions> { | ||
842 | private gauge: BaseGauge; | 842 | private gauge: BaseGauge; |
843 | 843 | ||
844 | protected constructor(protected ctx: WidgetContext, canvasId: string) { | 844 | protected constructor(protected ctx: WidgetContext, canvasId: string) { |
845 | - const gaugeElement = $('#'+canvasId, ctx.$container)[0]; | 845 | + const gaugeElement = $('#' + canvasId, ctx.$container)[0]; |
846 | const settings: S = ctx.settings; | 846 | const settings: S = ctx.settings; |
847 | const gaugeData: O = this.createGaugeOptions(gaugeElement, settings); | 847 | const gaugeData: O = this.createGaugeOptions(gaugeElement, settings); |
848 | this.gauge = this.createGauge(gaugeData as O).draw(); | 848 | this.gauge = this.createGauge(gaugeData as O).draw(); |
@@ -859,7 +859,7 @@ export abstract class TbBaseGauge<S, O extends GenericOptions> { | @@ -859,7 +859,7 @@ export abstract class TbBaseGauge<S, O extends GenericOptions> { | ||
859 | const tvPair = cellData.data[cellData.data.length - | 859 | const tvPair = cellData.data[cellData.data.length - |
860 | 1]; | 860 | 1]; |
861 | const value = tvPair[1]; | 861 | const value = tvPair[1]; |
862 | - if(value !== this.gauge.value) { | 862 | + if (value !== this.gauge.value) { |
863 | this.gauge.value = value; | 863 | this.gauge.value = value; |
864 | } | 864 | } |
865 | } | 865 | } |
@@ -876,10 +876,10 @@ export abstract class TbBaseGauge<S, O extends GenericOptions> { | @@ -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 | protected constructor(ctx: WidgetContext, canvasId: string) { | 881 | protected constructor(ctx: WidgetContext, canvasId: string) { |
882 | - super(ctx,canvasId); | 882 | + super(ctx, canvasId); |
883 | } | 883 | } |
884 | 884 | ||
885 | protected createGaugeOptions(gaugeElement: HTMLElement, settings: S): O { | 885 | protected createGaugeOptions(gaugeElement: HTMLElement, settings: S): O { |
@@ -891,26 +891,26 @@ export abstract class TbAnalogueGauge<S extends AnalogueGaugeSettings, O extends | @@ -891,26 +891,26 @@ export abstract class TbAnalogueGauge<S extends AnalogueGaugeSettings, O extends | ||
891 | const keyColor = settings.defaultColor || dataKey.color; | 891 | const keyColor = settings.defaultColor || dataKey.color; |
892 | 892 | ||
893 | const majorTicksCount = settings.majorTicksCount || 10; | 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 | const valueInt = settings.valueInt || 3; | 897 | const valueInt = settings.valueInt || 3; |
898 | 898 | ||
899 | const valueDec = getValueDec(this.ctx, settings); | 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 | const majorTicks: number[] = []; | 903 | const majorTicks: number[] = []; |
904 | const highlights: Highlight[] = []; | 904 | const highlights: Highlight[] = []; |
905 | let tick = minValue; | 905 | let tick = minValue; |
906 | 906 | ||
907 | - while(tick<=maxValue) { | 907 | + while (tick <= maxValue) { |
908 | majorTicks.push(tick); | 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 | const highlightColor = tinycolor(keyColor); | 912 | const highlightColor = tinycolor(keyColor); |
913 | - const percent = (tick-minValue)/total; | 913 | + const percent = (tick - minValue) / total; |
914 | highlightColor.setAlpha(percent); | 914 | highlightColor.setAlpha(percent); |
915 | const highlight: Highlight = { | 915 | const highlight: Highlight = { |
916 | from: tick, | 916 | from: tick, |