Skip to content

Commit

Permalink
Positioning of TOI in tables and plots
Browse files Browse the repository at this point in the history
  • Loading branch information
akhenry committed Oct 17, 2016
1 parent 7a09bc1 commit dadca62
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@
}
}


// TOI is showing value as well
.show-val .l-toi-holder {
.l-toi {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@
<a class="l-page-button s-icon-button icon-pointer-left"></a>
<div class="l-data-visualization">
<div style="position: relative; height: 100%" ng-style="{'left': toi.left + '%'}">
<mct-include key="'time-of-interest'" class="show-val"
parameters = "{'name': 'conductor'}"></mct-include>
<mct-include key="'time-of-interest'" class="show-val"></mct-include>
</div>
</div>
<a class="l-page-button align-right s-icon-button icon-pointer-right"></a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ define(
conductor.on('timeSystem', this.changeTimeSystem);
if (conductor.timeSystem()) {
this.changeTimeSystem(conductor.timeSystem());
var toi = conductor.timeOfInterest();
if (toi) {
this.changeTimeOfInterest(toi);
}
}

$scope.$on('$destroy', this.destroy);
Expand Down
3 changes: 2 additions & 1 deletion platform/features/plot/bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ define([
"telemetryFormatter",
"telemetryHandler",
"throttle",
"PLOT_FIXED_DURATION"
"PLOT_FIXED_DURATION",
"timeConductor"
]
},
{
Expand Down
13 changes: 10 additions & 3 deletions platform/features/plot/res/templates/plot.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
this source code distribution or the Licensing information page available
at runtime from the About dialog for additional information.
-->
<style>
.gl-plot-wrapper-display-area-and-x-axis .toiPositioner {
position: relative;
height: 100%;
}
</style>
<span ng-controller="PlotController as plot"
class="abs holder holder-plot has-control-bar">
<div class="l-control-bar" ng-show="!plot.hideExportButtons">
Expand Down Expand Up @@ -71,9 +77,10 @@
</div>

<div class="gl-plot-wrapper-display-area-and-x-axis">
<mct-include key="'time-of-interest'" class="show-val"
parameters = "{'name': 'plot'}"
></mct-include>
<div class="toiPositioner"
ng-if="toiPerc" ng-style="{'left': toiPerc + '%'}">
<mct-include key="'time-of-interest'" class="show-val"></mct-include>
</div>

<div class="gl-plot-coords"
ng-if="subplot.isHovering() && subplot.getHoverCoordinates()">
Expand Down
19 changes: 18 additions & 1 deletion platform/features/plot/src/PlotController.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ define(
telemetryFormatter,
telemetryHandler,
throttle,
PLOT_FIXED_DURATION
PLOT_FIXED_DURATION,
conductor
) {
var self = this,
plotTelemetryFormatter =
Expand Down Expand Up @@ -200,6 +201,7 @@ define(
if (handle) {
handle.unsubscribe();
handle = undefined;
conductor.off(changeTimeOfInterest);
}
}

Expand Down Expand Up @@ -242,6 +244,17 @@ define(
requery();
}
self.setUnsynchedStatus($scope.domainObject, follow && self.isZoomed());
changeTimeOfInterest(conductor.timeOfInterest());
}

function changeTimeOfInterest(timeOfInterest) {
if (timeOfInterest !== undefined){
var bounds = conductor.bounds();
var range = bounds.end - bounds.start;
$scope.toiPerc = ((timeOfInterest - bounds.start) / range) * 100;
} else {
$scope.toiPerc = undefined;
}
}

this.modeOptions = new PlotModeOptions([], subPlotFactory);
Expand All @@ -264,6 +277,10 @@ define(
new PlotAxis("ranges", [], AXIS_DEFAULTS[1])
];

changeTimeOfInterest(conductor.timeOfInterest());

conductor.on("timeOfInterest", changeTimeOfInterest);

// Watch for changes to the selected axis
$scope.$watch("axes[0].active.key", domainRequery);
$scope.$watch("axes[1].active.key", rangeRequery);
Expand Down
8 changes: 3 additions & 5 deletions platform/features/table/res/templates/mct-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,17 @@
</tr>
</thead>
<tbody>
<!--ng-class="{ 'l-toi pinned': false }"-->
<!--ng-click="dummyUnpin()" -->
<tr ng-repeat-start="visibleRow in visibleRows track by visibleRow.rowIndex"
ng-if="visibleRow.rowIndex === 10"
ng-if="visibleRow.rowIndex === toiRowIndex"
ng-style="{ top: visibleRow.offsetY + 'px' }"
class="l-toi-tablerow pinned">
<td colspan="999">
<mct-include key="'time-of-interest'"></mct-include>
</td>
</tr>
<tr ng-repeat-end
ng-click="table.onRowClick($event, visibleRow.rowIndex)"
ng-style="{ top: visibleRow.offsetY + 'px' }">
ng-style="{ top: visibleRow.offsetY + 'px' }"
ng-click="table.onRowClick($event, visibleRow.rowIndex) ">
<td ng-repeat="header in displayHeaders"
ng-style=" {
width: columnWidths[$index] + 'px',
Expand Down
44 changes: 29 additions & 15 deletions platform/features/table/src/controllers/MCTTableController.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ define(

this.conductor.on('timeSystem', this.changeTimeSystem);
this.conductor.on('timeOfInterest', this.setTimeOfInterest);
this.conductor.on('bounds', this.changeBounds);

// If time system defined, set initially
if (conductor.timeSystem()) {
Expand All @@ -124,6 +125,7 @@ define(
MCTTableController.prototype.destroyConductorListeners = function () {
this.conductor.off('timeSystem', this.changeTimeSystem);
this.conductor.off('timeOfInterest', this.setTimeOfInterest);
this.conductor.off('bounds', this.changeBounds);
};

MCTTableController.prototype.changeTimeSystem = function () {
Expand Down Expand Up @@ -542,7 +544,15 @@ define(
}

this.$scope.displayRows = this.filterAndSort(newRows || []);
this.resize(newRows).then(this.setVisibleRows.bind(this));
this.resize(newRows).then(function() {
this.setVisibleRows();

var timeOfInterest = this.conductor.timeOfInterest();
if (timeOfInterest) {
this.setTimeOfInterest(timeOfInterest);
}
}.bind(this));

};

/**
Expand Down Expand Up @@ -604,25 +614,29 @@ define(
if (this.$scope.timeColumns.indexOf(this.$scope.sortColumn) !== -1
&& newTOI
&& this.$scope.displayRows.length > 0) {
var formattedTOI = this.toiFormatter.format(newTOI);;
// searchElement, min, max
this.$scope.toiRowIndex = this.binarySearch(this.$scope.displayRows,
formattedTOI, 0, this.$scope.displayRows.length - 1);
this.scrollToRow(this.$scope.toiRowIndex);
var formattedTOI = this.toiFormatter.format(newTOI);
// searchElement, min, max
this.$scope.toiRowIndex = this.binarySearch(this.$scope.displayRows,
formattedTOI, 0, this.$scope.displayRows.length - 1);
this.scrollToRow(this.$scope.toiRowIndex);
}
};

/**
* On zoom, pan, etc. reset TOI
* @param bounds
*/
MCTTableController.prototype.changeBounds = function(bounds) {
this.setTimeOfInterest(this.conductor.timeOfInterest());
};

MCTTableController.prototype.onRowClick = function (event, rowIndex) {
if (this.$scope.timeColumns.indexOf(this.$scope.sortColumn) !== -1) {
if (rowIndex === this.$scope.toiRowIndex) {
this.conductor.timeOfInterest(undefined);
} else {
var selectedTime = this.$scope.displayRows[rowIndex][this.$scope.sortColumn].text;
if (selectedTime
&& this.toiFormatter.validate(selectedTime)
&& event.altKey) {
this.conductor.timeOfInterest(this.toiFormatter.parse(selectedTime));
}
var selectedTime = this.$scope.displayRows[rowIndex][this.$scope.sortColumn].text;
if (selectedTime
&& this.toiFormatter.validate(selectedTime)
&& event.altKey) {
this.conductor.timeOfInterest(this.toiFormatter.parse(selectedTime));
}
}
};
Expand Down

0 comments on commit dadca62

Please sign in to comment.