mirror of
https://github.com/nasa/openmct.git
synced 2025-06-19 15:43:48 +00:00
Fix Y axis plot label control (#2465)
* Fix Y axis plot label control * Now uses writing-mode: vertical-lr instead of transform for vertical text; * Text overflow: hidden prevents scrollbars; * Select displayed on hover over Y axis area; * Dynamically adds icon-gear when Y axis can be configured; * use child plot div for image exports
This commit is contained in:
committed by
Andrew Henry
parent
fa66289d5c
commit
e89881c266
@ -110,17 +110,18 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="plot-wrapper-axis-and-display-area flex-elem grows">
|
<div class="plot-wrapper-axis-and-display-area flex-elem grows">
|
||||||
<div class="gl-plot-axis-area gl-plot-y"
|
<div class="gl-plot-axis-area gl-plot-y has-local-controls"
|
||||||
ng-style="{
|
ng-style="{
|
||||||
width: (tickWidth + 30) + 'px'
|
width: (tickWidth + 30) + 'px'
|
||||||
}">
|
}">
|
||||||
|
|
||||||
<div class="gl-plot-label gl-plot-y-label" ng-if="!yKeyOptions">
|
<div class="gl-plot-label gl-plot-y-label"
|
||||||
{{ yAxis.get('label') }}
|
ng-class="{'icon-gear': (yKeyOptions.length > 1 && series.length === 1)}"
|
||||||
|
ng-bind="yAxisLabel">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="gl-plot-label gl-plot-y-label" ng-if="yKeyOptions.length > 1 && series.length === 1">
|
<select class="gl-plot-y-label__select local-controls--hidden"
|
||||||
<select class="gl-plot-y-label__select"
|
ng-if="yKeyOptions.length > 1 && series.length === 1"
|
||||||
ng-model="yAxisLabel" ng-change="plot.toggleYAxisLabel(yAxisLabel, yKeyOptions, series[0])">
|
ng-model="yAxisLabel" ng-change="plot.toggleYAxisLabel(yAxisLabel, yKeyOptions, series[0])">
|
||||||
<option ng-repeat="option in yKeyOptions"
|
<option ng-repeat="option in yKeyOptions"
|
||||||
value="{{option.name}}"
|
value="{{option.name}}"
|
||||||
@ -128,7 +129,6 @@
|
|||||||
{{option.name}}
|
{{option.name}}
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<mct-ticks axis="yAxis">
|
<mct-ticks axis="yAxis">
|
||||||
|
@ -526,6 +526,7 @@ define([
|
|||||||
|
|
||||||
if (yAxisObject) {
|
if (yAxisObject) {
|
||||||
series.emit('change:yKey', yAxisObject.key);
|
series.emit('change:yKey', yAxisObject.key);
|
||||||
|
this.$scope.yAxisLabel = label;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -277,22 +277,18 @@ define([
|
|||||||
* Export view as JPG.
|
* Export view as JPG.
|
||||||
*/
|
*/
|
||||||
PlotController.prototype.exportJPG = function () {
|
PlotController.prototype.exportJPG = function () {
|
||||||
this.hideExportButtons = true;
|
var plotElement = this.$element.children()[1];
|
||||||
this.exportImageService.exportJPG(this.$element[0], 'plot.jpg', 'export-plot')
|
|
||||||
.finally(function () {
|
this.exportImageService.exportJPG(plotElement, 'plot.jpg', 'export-plot');
|
||||||
this.hideExportButtons = false;
|
|
||||||
}.bind(this));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export view as PNG.
|
* Export view as PNG.
|
||||||
*/
|
*/
|
||||||
PlotController.prototype.exportPNG = function () {
|
PlotController.prototype.exportPNG = function () {
|
||||||
this.hideExportButtons = true;
|
var plotElement = this.$element.children()[1];
|
||||||
this.exportImageService.exportPNG(this.$element[0], 'plot.png', 'export-plot')
|
|
||||||
.finally(function () {
|
this.exportImageService.exportPNG(plotElement, 'plot.png', 'export-plot');
|
||||||
this.hideExportButtons = false;
|
|
||||||
}.bind(this));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PlotController.prototype.toggleCursorGuide = function ($event) {
|
PlotController.prototype.toggleCursorGuide = function ($event) {
|
||||||
|
@ -126,6 +126,12 @@ mct-plot {
|
|||||||
bottom: nth($plotDisplayArea, 3);
|
bottom: nth($plotDisplayArea, 3);
|
||||||
left: 0;
|
left: 0;
|
||||||
width: $plotYBarW;
|
width: $plotYBarW;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
.gl-plot-y-label__select {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,22 +168,21 @@ mct-plot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
&.gl-plot-y-label {
|
&.gl-plot-y-label {
|
||||||
$x: -50%;
|
display: block;
|
||||||
$r: -90deg;
|
left: 0; top: 0; right: auto; bottom: 0;
|
||||||
transform-origin: 50% 0;
|
padding-left: 5px;
|
||||||
transform: translateX($x) rotate($r);
|
text-orientation: mixed;
|
||||||
display: inline-block;
|
overflow: hidden;
|
||||||
margin-left: $interiorMargin; // Kick off the left edge
|
writing-mode: vertical-lr;
|
||||||
left: 0;
|
}
|
||||||
top: 50%;
|
}
|
||||||
white-space: nowrap;
|
|
||||||
|
|
||||||
select {
|
.gl-plot-y-label__select {
|
||||||
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10'%3e%3cpath fill='%23#{svgColorFromHex($colorSelectArw)}' d='M0 5l5 5V0L0 5z'/%3e%3c/svg%3e");
|
position: absolute;
|
||||||
background-position: left .4em top 50%, 0 0;
|
top: 50%;
|
||||||
padding: 1px $interiorMargin 1px 20px;
|
transform: translateY(-50%);
|
||||||
}
|
left: 20px;
|
||||||
}
|
z-index: 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
.gl-plot-x-options,
|
.gl-plot-x-options,
|
||||||
|
Reference in New Issue
Block a user