mirror of
https://github.com/nasa/openmct.git
synced 2025-06-14 13:18:15 +00:00
[Code Review] Updates based on code review by @VWoeltjen
Set export functions on the ExportImageService prototype. Insantiated ExportImageService in the PlotController for better dependcy injection.
This commit is contained in:
@ -250,6 +250,7 @@ define(
|
||||
|
||||
self.pending = true;
|
||||
self.$element = $element;
|
||||
self.ExportImageService = new ExportImageService();
|
||||
|
||||
// Initialize axes; will get repopulated when telemetry
|
||||
// metadata becomes available.
|
||||
@ -258,18 +259,6 @@ define(
|
||||
new PlotAxis("ranges", [], AXIS_DEFAULTS[1])
|
||||
];
|
||||
|
||||
$scope.exportPDF = function () {
|
||||
PlotController.prototype.exportPDF(self.$element, 'plot.pdf');
|
||||
};
|
||||
|
||||
$scope.exportPNG = function () {
|
||||
PlotController.prototype.exportPNG(self.$element, 'plot.png');
|
||||
};
|
||||
|
||||
$scope.exportJPG = function () {
|
||||
PlotController.prototype.exportJPG(self.$element, 'plot.jpg');
|
||||
};
|
||||
|
||||
// Watch for changes to the selected axis
|
||||
$scope.$watch("axes[0].active.key", domainRequery);
|
||||
$scope.$watch("axes[1].active.key", rangeRequery);
|
||||
@ -383,22 +372,22 @@ define(
|
||||
/**
|
||||
* Export the plot to PDF
|
||||
*/
|
||||
PlotController.prototype.exportPDF = function (element, filename) {
|
||||
ExportImageService.exportPDF(element[0], filename);
|
||||
PlotController.prototype.exportPDF = function () {
|
||||
this.ExportImageService.exportPDF(this.$element[0], 'plot.pdf');
|
||||
};
|
||||
|
||||
/**
|
||||
* Export the plot to PNG
|
||||
*/
|
||||
PlotController.prototype.exportPNG = function (element, filename) {
|
||||
ExportImageService.exportPNG(element, filename);
|
||||
PlotController.prototype.exportPNG = function () {
|
||||
this.ExportImageService.exportPNG(this.$element[0], 'plot.png');
|
||||
};
|
||||
|
||||
/**
|
||||
* Export the plot to JPG
|
||||
*/
|
||||
PlotController.prototype.exportJPG = function (element, filename) {
|
||||
ExportImageService.exportJPG(element, filename);
|
||||
PlotController.prototype.exportJPG = function () {
|
||||
this.ExportImageService.exportJPG(this.$element[0], 'plot.jpg');
|
||||
};
|
||||
|
||||
return PlotController;
|
||||
|
Reference in New Issue
Block a user