Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better support in Gauge for bar and needle display styles #5083

Closed
wants to merge 72 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
b6998b3
Add new Gauge component
charlesh88 Feb 24, 2022
e0326cf
convert to ES6, added `checkbox` and `GaugeFormController` control types
nikhilmandlik Mar 5, 2022
2e2bf9f
adjust radial font
nikhilmandlik Mar 5, 2022
791ff2e
rename filenames
nikhilmandlik Mar 5, 2022
db288d8
Add new Gauge component
charlesh88 Mar 8, 2022
ce7df4c
Add new Gauge component
charlesh88 Mar 9, 2022
e87eb3d
Add new Gauge component
charlesh88 Mar 9, 2022
92550af
added gaugeType option
nikhilmandlik Mar 9, 2022
fd40065
Add new Gauge component
charlesh88 Mar 9, 2022
b3fabfe
Merge branch 'add-gauge-4896' of github.com:nasa/openmct into add-gau…
charlesh88 Mar 9, 2022
ec531cb
Add new Gauge component
charlesh88 Mar 9, 2022
84f527c
Add new Gauge component
charlesh88 Mar 9, 2022
36eaee4
Add new Gauge component
charlesh88 Mar 10, 2022
6804ed5
Add new Gauge component
charlesh88 Mar 11, 2022
80620d7
Add new Gauge component
charlesh88 Mar 11, 2022
beb0ac8
add digits counter for main value size adjustment.
nikhilmandlik Mar 11, 2022
845f9e8
add toggleSwitch form control
nikhilmandlik Mar 11, 2022
c5bc993
renamed GaugePlugin and restructure GaugePlugin form.
nikhilmandlik Mar 11, 2022
0633582
implemented use telemetry limits.
nikhilmandlik Mar 12, 2022
fb9c043
Add new Gauge component
charlesh88 Mar 12, 2022
ad47d0f
Add new Gauge component
charlesh88 Mar 12, 2022
8260d8c
clean up
nikhilmandlik Mar 14, 2022
445350e
Add new Gauge component
charlesh88 Mar 15, 2022
c1a4bda
Add new Gauge component
charlesh88 Mar 15, 2022
2b7d626
Add new Gauge component
charlesh88 Mar 16, 2022
7ab4a80
current value should stop updating current time is out of bounds of t…
nikhilmandlik Mar 16, 2022
5989cd6
added default values
nikhilmandlik Mar 16, 2022
8f762d0
Add new Gauge component
charlesh88 Mar 16, 2022
44b517f
fixed form issue with validate function
nikhilmandlik Mar 16, 2022
8547872
added validation to gauge controller
nikhilmandlik Mar 16, 2022
b99c606
Merge branch 'add-gauge-4896' of github.com:nasa/openmct into add-gau…
nikhilmandlik Mar 16, 2022
e7f776f
Merge branch 'master' into add-gauge-4896
nikhilmandlik Mar 16, 2022
a5f906d
Add new Gauge component
charlesh88 Mar 16, 2022
0424f01
Merge branch 'add-gauge-4896' of github.com:nasa/openmct into add-gau…
charlesh88 Mar 16, 2022
9e071d1
added validation on limitLow and limitHigh.
nikhilmandlik Mar 16, 2022
e671df8
Add new Gauge component
charlesh88 Mar 16, 2022
c05812d
Merge branch 'master' into add-gauge-4896
nikhilmandlik Mar 16, 2022
0c529d0
fixed gauge issue with value update on bounds change .
nikhilmandlik Mar 16, 2022
5f68ef5
Add new Gauge component
charlesh88 Mar 16, 2022
6919067
Merge branch 'add-gauge-4896' of github.com:nasa/openmct into add-gau…
charlesh88 Mar 18, 2022
e9b8dbc
Merge branch 'master' into add-gauge-4896
nikhilmandlik Mar 18, 2022
2717af2
Merge branch 'master' into add-gauge-4896
nikhilmandlik Mar 21, 2022
c467a3e
Merge branch 'master' into add-gauge-4896
jvigliotta Mar 21, 2022
5d6ae0d
Merge branch 'master' into add-gauge-4896
nikhilmandlik Mar 22, 2022
70b9d79
Fixed lint issues
nikhilmandlik Mar 22, 2022
3304be0
addressed review comments.
nikhilmandlik Mar 22, 2022
205a80a
Refine Gauge
charlesh88 Mar 22, 2022
f198cba
Merge branch 'add-gauge-4896' of github.com:nasa/openmct into add-gau…
charlesh88 Mar 22, 2022
600f855
Merge branch 'master' into add-gauge-4896
unlikelyzero Mar 23, 2022
22a501b
Refine Gauge
charlesh88 Mar 23, 2022
17bd9eb
Merge branch 'add-gauge-4896' of github.com:nasa/openmct into add-gau…
charlesh88 Mar 23, 2022
e30b58d
Merge branch 'master' into add-gauge-4896
jvigliotta Mar 23, 2022
0dcb87c
Merge branch 'master' into add-gauge-4896
nikhilmandlik Mar 23, 2022
a02cf98
added `hideFromInspector` property to filter field from showing into …
nikhilmandlik Mar 24, 2022
f4e78cb
Must disallow more than one telemetry point from being added to Gauge…
nikhilmandlik Mar 24, 2022
ed0ed5a
fixed validation logic.
nikhilmandlik Mar 24, 2022
fc8a270
changed return canedit to false
nikhilmandlik Mar 24, 2022
d84a2b5
use source instead of key from range hints.
nikhilmandlik Mar 24, 2022
5109525
Merge branch 'imagery-layers' of github.com:nasa/openmct into imagery…
charlesh88 Mar 24, 2022
94d5c23
Merge branch 'master' into add-gauge-4896
nikhilmandlik Mar 28, 2022
f428d59
Merge branch 'master' into add-gauge-4896
jvigliotta Mar 31, 2022
0db937f
added e2e doc
nikhilmandlik Apr 1, 2022
187be2e
Merge branch 'master' into add-gauge-4896
jvigliotta Apr 4, 2022
a630880
addressed review comments.
nikhilmandlik Apr 6, 2022
6800d8c
Merge branch 'add-gauge-4896' of github.com:nasa/openmct into add-gau…
nikhilmandlik Apr 6, 2022
56d8838
added toggle-check-box-mixin
nikhilmandlik Apr 6, 2022
7dffefc
Merge branch 'master' into add-gauge-4896
nikhilmandlik Apr 6, 2022
21c3fcd
Merge branch 'master' into add-gauge-4896
jvigliotta Apr 6, 2022
3aac865
add confirmation dialog on another telemetry added to gauge
nikhilmandlik Apr 7, 2022
c33feaa
Merge branch 'master' into add-gauge-4896
nikhilmandlik Apr 11, 2022
a305017
Refactor Gauge for bar and needle display styles
charlesh88 Apr 18, 2022
960db3c
Refactor Gauge for bar and needle display styles
charlesh88 Apr 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add new Gauge component
- WIP!
- Significant work: added lower limit to dial and meter;
- Added limitLow, refactored limit to limitHigh;
- Improved valToPercentMeter method;
  • Loading branch information
charlesh88 committed Mar 11, 2022
commit 6804ed5c8f9b42aa61a1cef9427270c58631210e
15 changes: 12 additions & 3 deletions src/plugins/gauge/components/GaugeFormController.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,16 @@
</div>

<div class="form-row c-form__row">
<label>Max Limit</label>
<input v-model="limit"
<label>Low Limit</label>
<input v-model="limitLow"
type="number"
@input="onChange"
>
</div>

<div class="form-row c-form__row">
<label>High Limit</label>
<input v-model="limitHigh"
type="number"
@input="onChange"
>
Expand Down Expand Up @@ -108,7 +116,8 @@ export default {
gaugeType: this.model.value.gaugeType || this.getGaugeTypes().value,
isUseTelemetryLimits: this.model.value.isUseTelemetryLimits,
isDisplayMinMax: this.model.value.isDisplayMinMax,
limit: this.model.value.limit,
limitHigh: this.model.value.limitHigh,
limitLow: this.model.value.limitLow,
max: this.model.value.max,
min: this.model.value.min,
precision: this.model.value.precision
Expand Down
146 changes: 127 additions & 19 deletions src/plugins/gauge/components/GaugeRadial.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,29 @@
</g>
</svg>

<svg v-if="degLimit < 270"
class="c-dial__limit"
<svg v-if="dialHighLimitDeg < 270"
class="c-dial__limit-high"
viewBox="0 0 512 512"
:class="{
'c-limit-clip--90': degLimit > 90,
'c-limit-clip--180': degLimit >= 180
'c-high-limit-clip--90': dialHighLimitDeg > 90,
'c-high-limit-clip--180': dialHighLimitDeg >= 180
}"
>
<path d="M100,256A156,156,0,1,1,366.3,366.3L437,437a255.2,255.2,0,0,0,75-181C512,114.6,397.4,0,256,0S0,114.6,0,256A255.2,255.2,0,0,0,75,437l70.7-70.7A155.5,155.5,0,0,1,100,256Z"
:style="`transform: rotate(${degLimit}deg)`"
:style="`transform: rotate(${dialHighLimitDeg}deg)`"
/>
</svg>

<svg v-if="dialLowLimitDeg < 270"
class="c-dial__limit-low"
viewBox="0 0 512 512"
:class="{
'c-dial-clip--90': dialLowLimitDeg < 90,
'c-dial-clip--180': dialLowLimitDeg >= 90 && dialLowLimitDeg < 180
}"
>
<path d="M256,100c86.2,0,156,69.8,156,156s-69.8,156-156,156c-43.1,0-82.1-17.5-110.3-45.7L75,437 c46.3,46.3,110.3,75,181,75c141.4,0,256-114.6,256-256S397.4,0,256,0C185.3,0,121.3,28.7,75,75l70.7,70.7 C173.9,117.5,212.9,100,256,100z"
:style="`transform: rotate(${dialLowLimitDeg}deg)`"
/>
</svg>

Expand Down Expand Up @@ -118,6 +131,94 @@
</div>
</template>
</div>

<div v-if="debug"
class="temp-debug"
>
<div><b>ranges: </b>{{ rangeLow }} &lt; &gt; {{ rangeHigh }}</div>
<div><b>limits: </b>{{ limitLow }} &lt; &gt; {{ limitHigh }}</div>
<div><b>dial limit deg: </b>{{ dialLowLimitDeg }} deg &lt; &gt; {{ dialHighLimitDeg }} deg</div>
<div><b>meter limit %: </b>{{ meterLowLimitPerc }} &lt; &gt; {{ meterHighLimitPerc }}</div>

<div v-if="debugDial"
class="temp-dial-debug"
>
<div class="c-dial">
Value
<svg v-if="degValue > 0"
class="c-dial__value"
viewBox="0 0 512 512"
:class="{
'c-dial-clip--90': degValue < 90 && gaugeType.indexOf('-needle') === -1,
'c-dial-clip--180': degValue >= 90 && degValue < 180 && gaugeType.indexOf('-needle') === -1
}"
>
<path v-if="true"
d="M256,31A224.3,224.3,0,0,0,98.3,95.5l48.4,49.2a156,156,0,1,1-1,221.6L96.9,415.1A224.4,224.4,0,0,0,256,481c124.3,0,225-100.7,225-225S380.3,31,256,31Z"
:style="`transform: rotate(${0}deg)`"
/>
<path v-if="gaugeType.indexOf('dial-needle') !== -1 && false"
d="M139.9,360.1l-48.6,48.6c-3.3,3.3-3.3,8.7,0,12s8.7,3.3,12,0l48.6-48.6L139.9,360.1z"
:style="`transform: rotate(${degValue}deg)`"
/>
</svg>
</div>

<div class="c-dial">
Dial Clip
<div class="c-dial__value"
style="clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 50%, 0 100%);"
></div>
</div>

<div class="c-dial">
Dial Clip 180
<div class="c-dial__value c-dial-clip--180"></div>
</div>

<div class="c-dial">
Dial Clip 90
<div class="c-dial__value c-dial-clip--90"></div>
</div>
</div>

<div v-if="debugDial"
class="temp-dial-debug"
>
<div class="c-dial">
High Limit
<svg class="c-dial__bg"
viewBox="0 0 512 512"
>
<path d="M100,256A156,156,0,1,1,366.3,366.3L437,437a255.2,255.2,0,0,0,75-181C512,114.6,397.4,0,256,0S0,114.6,0,256A255.2,255.2,0,0,0,75,437l70.7-70.7A155.5,155.5,0,0,1,100,256Z"
:style="`transform: rotate(${dialHighLimitDeg}deg)`"
/>
</svg>
</div>

<div class="c-dial">
Low Limit
<svg class="c-dial__bg"
viewBox="0 0 512 512"
>
<path d="M256,100c86.2,0,156,69.8,156,156s-69.8,156-156,156c-43.1,0-82.1-17.5-110.3-45.7L75,437 c46.3,46.3,110.3,75,181,75c141.4,0,256-114.6,256-256S397.4,0,256,0C185.3,0,121.3,28.7,75,75l70.7,70.7 C173.9,117.5,212.9,100,256,100z"
:style="`transform: rotate(${dialLowLimitDeg}deg)`"
/>
</svg>
</div>

<div class="c-dial">
High Limit Clip 180
<div class="c-dial__value c-high-limit-clip--180"></div>
</div>

<div class="c-dial">
High Limit Clip 90
<div class="c-dial__value c-high-limit-clip--90"></div>
</div>
</div>
</div>

</div>
</template>

Expand All @@ -132,27 +233,41 @@ export default {
curVal: 0,
precision: gaugeController.precision,
displayMinMax: gaugeController.isDisplayMinMax,
limit: gaugeController.limit,
limitHigh: gaugeController.limitHigh,
limitLow: gaugeController.limitLow,
rangeHigh: gaugeController.max,
rangeLow: gaugeController.min,
gaugeType: gaugeController.gaugeType
gaugeType: gaugeController.gaugeType,
debug: false,
debugDial: false
};
},
computed: {
degValue() {
return this.percentToDegrees(this.valToPercent(this.curVal));
},
degLimit() {
return this.percentToDegrees(this.valToPercent(this.limit));
dialHighLimitDeg() {
return this.percentToDegrees(this.valToPercent(this.limitHigh));
},
dialLowLimitDeg() {
return this.percentToDegrees(this.valToPercent(this.limitLow));
},
meterValueToPerc() {
if (this.curVal <= this.rangeLow) {
return 100;
}

if (this.curVal >= this.rangeHigh) {
return 0;
}

return this.valToPercentMeter(this.curVal);
},
meterHighLimitPerc() {
return this.valToPercentMeter(this.limit);
return this.valToPercentMeter(this.limitHigh);
},
meterLowLimitPerc() {
return 0;
return 100 - this.valToPercentMeter(this.limitLow);
}
},
mounted() {
Expand Down Expand Up @@ -182,14 +297,7 @@ export default {
return ((vValue - this.rangeLow) / (this.rangeHigh - this.rangeLow)) * 100;
},
valToPercentMeter(vValue) {
// Used by meter
if (vValue >= this.rangeHigh) {
return 0;
} else if (vValue <= this.rangeLow) {
return 100;
} else {
return (this.rangeHigh - vValue) / (this.rangeHigh - this.rangeLow) * 100;
}
return this.round((this.rangeHigh - vValue) / (this.rangeHigh - this.rangeLow) * 100, 2);
},
percentToDegrees(vPercent) {
return this.round((vPercent / 100) * 270, 2);
Expand Down
79 changes: 61 additions & 18 deletions src/plugins/gauge/gauge.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ $gaugeColorBg: rgba($colorBodyFg, 0.2);
$gaugeColorValueBg: rgba($colorBodyFg, 0.5);
$gaugeColorFg: pullForward($colorBodyFg, 20%);
$gaugeValueTransitionTime: 250ms;
$gaugeLimitColorBg: rgba($colorLimitRedBg, 0.5);
$gaugeLimitHighColorBg: rgba($colorLimitRedBg, 0.5);
$gaugeLimitLowColorBg: $gaugeLimitHighColorBg;

$dialClip90: polygon(0 0, 50% 50%, 0 100%);
$dialClip180: polygon(0 0, 100% 0, 0 100%);
$limitHighClip90: polygon(0 0, 100% 0, 100% 100%);
$limitHighClip180: polygon(100% 0, 100% 100%, 0 100%);

.is-object-type-gauge {
overflow: hidden;
Expand Down Expand Up @@ -57,7 +63,7 @@ $gaugeLimitColorBg: rgba($colorLimitRedBg, 0.5);
svg,
&__ticks,
&__bg,
&__limit,
&[class*='__limit'],
&__value {
@include abs();
}
Expand All @@ -68,31 +74,31 @@ $gaugeLimitColorBg: rgba($colorLimitRedBg, 0.5);
}
}

&__limit {
&.c-limit-clip--90 {
clip-path: polygon(0 0, 100% 0, 100% 100%);
}

&.c-limit-clip--180 {
clip-path: polygon(100% 0, 100% 100%, 0 100%);
}
.c-high-limit-clip--90 {
clip-path: $limitHighClip90;
}

path {
fill: $gaugeLimitColorBg;
}
.c-high-limit-clip--180 {
clip-path: $limitHighClip180;
}

&__value {
&__limit-high path { fill: $gaugeLimitHighColorBg; }
&__limit-low path { fill: $gaugeLimitLowColorBg; }

&__value,
&__limit-low {
&.c-dial-clip--90 {
clip-path: polygon(0 0, 50% 50%, 0 100%);
clip-path: $dialClip90;
}

&.c-dial-clip--180 {
clip-path: polygon(0 0, 100% 0, 0 100%);
clip-path: $dialClip180;
}
}

path {
&__value {
path,
polygon {
fill: $gaugeColorValueBg;
}
}
Expand Down Expand Up @@ -150,9 +156,16 @@ $gaugeLimitColorBg: rgba($colorLimitRedBg, 0.5);
}

[class*='limit'] {
background: $gaugeLimitColorBg;
position: absolute;
}

&__limit-high {
background: $gaugeLimitHighColorBg;
}

&__limit-low {
background: $gaugeLimitLowColorBg;
}
}

.c-gauge--meter-vertical .c-meter {
Expand Down Expand Up @@ -240,3 +253,33 @@ $gaugeLimitColorBg: rgba($colorLimitRedBg, 0.5);
}

}

.temp-debug {
position: absolute;
}

.temp-dial-debug {
margin-top: 10px;
display: flex;

div {
background: rgba(red, 0.1);
position: relative;
width: 100px;
height: 100px;

div {
@include abs();
background: rgba(green, 0.3);
}
}

svg {
opacity: 0.5;
}

> * + * {
margin-left: 10px;
}

}
3 changes: 2 additions & 1 deletion src/plugins/gauge/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const GAUGE_TYPES = [
['Filled Dial', 'dial-filled'],
['Needle Dial', 'dial-needle'],
['Vertical Meter', 'meter-vertical'],
['Vertical Meter Inverted', 'meter-vertical-inverted'],
['Horizontal Meter', 'meter-horz']
];

Expand All @@ -48,7 +49,7 @@ export default function () {
gaugeType: GAUGE_TYPES[0],
isDisplayMinMax: true,
isUseTelemetryLimits: false,
limit: 90,
limitHigh: 90,
max: 100,
min: 0,
precision: 2
Expand Down