diff --git a/js/notebook/src/plot/CombinedPlotScope.ts b/js/notebook/src/plot/CombinedPlotScope.ts index 0b4f65612c..b82e288ae0 100644 --- a/js/notebook/src/plot/CombinedPlotScope.ts +++ b/js/notebook/src/plot/CombinedPlotScope.ts @@ -188,6 +188,7 @@ export default class CombinedPlotScope { this.id = `bko-plot-${bkUtils.generateId(6)}`; this.element.find('.combplot-plotcontainer').attr('id', this.id); + this.element.find('.plot-title').attr('class', `plot-title plot-title-${this.id}`); this.saveAsMenuContainer = $(`#${this.id}`); this.contextMenu = new ContextMenu(this); diff --git a/js/notebook/src/plot/PlotScope.ts b/js/notebook/src/plot/PlotScope.ts index d7ffc6a013..3359e7bff3 100644 --- a/js/notebook/src/plot/PlotScope.ts +++ b/js/notebook/src/plot/PlotScope.ts @@ -171,7 +171,6 @@ export default class PlotScope { this.legendDone = false; this.update(); this.fillCellModelWithPlotMethods(); - this.adjustModelWidth(); this.emitSizeChange(true); this.pointsLimitModal.init(); } @@ -293,9 +292,10 @@ export default class PlotScope { standardizeData() { const model = this.model.getCellModel(); - const plotModel = PlotModelFactory.getPlotModel(model, this.prefs); - this.stdmodel = plotModel.getStandardizedModel(); + this.stdmodel = PlotModelFactory + .getPlotModel(model, this.prefs) + .getStandardizedModel(); } initFlags() { @@ -315,10 +315,6 @@ export default class PlotScope { this.removePipe.length = 0; } - adjustModelWidth() { - this.plotSize.updateModelWidth(this.plotSize.getPlotWithLegendWidth()); - } - updatePlot() { this.standardizeData(); this.initFlags(); diff --git a/js/notebook/src/plot/PlotSize.ts b/js/notebook/src/plot/PlotSize.ts index 8dd030f82b..d95e3b7d44 100644 --- a/js/notebook/src/plot/PlotSize.ts +++ b/js/notebook/src/plot/PlotSize.ts @@ -47,7 +47,7 @@ export default class PlotSize { const legendPosition = this.scope.stdmodel.legendPosition.position; // Logic based on updateLegendPosition method const isLegendPlacedHorizontaly = ( - (["LEFT", "RIGTH"].indexOf(legendPosition) !== -1) + (["LEFT", "RIGHT"].indexOf(legendPosition) !== -1) || (["TOP", "BOTTOM"].indexOf(legendPosition) === -1 && this.scope.stdmodel.legendLayout === "VERTICAL") ); @@ -55,7 +55,26 @@ export default class PlotSize { legendWidth = legendWidth ? legendWidth + this.scope.layout.legendMargin + 2 : 0; - return isLegendPlacedHorizontaly ? plotWidth - legendWidth : plotWidth; + return isLegendPlacedHorizontaly ? plotWidth + legendWidth : plotWidth; + } + + getPlotWithLegendHeight() { + const containerHeight = this.scope.jqcontainer.parents('.output_subarea').height(); + const plotHeight = containerHeight && containerHeight < this.scope.layout.plotSize.height + ? containerHeight + : this.scope.layout.plotSize.height; + const legendPosition = this.scope.stdmodel.legendPosition.position; + // Logic based on updateLegendPosition method + const isLegendPlacedHorizontaly = ( + (["LEFT", "RIGHT"].indexOf(legendPosition) !== -1) + || (["TOP", "BOTTOM"].indexOf(legendPosition) === -1 && this.scope.stdmodel.legendLayout === "VERTICAL") + ); + + let legendHeight = this.scope.jqlegendcontainer.find('.plot-legend').height() || 0; + + legendHeight = legendHeight ? legendHeight + this.scope.layout.legendMargin + 2 : 0; + + return isLegendPlacedHorizontaly ? plotHeight : plotHeight + legendHeight; } setResizable() { diff --git a/js/notebook/src/plot/std/axis/DefaultAxis.ts b/js/notebook/src/plot/std/axis/DefaultAxis.ts index 447f26de62..658c3362ad 100644 --- a/js/notebook/src/plot/std/axis/DefaultAxis.ts +++ b/js/notebook/src/plot/std/axis/DefaultAxis.ts @@ -45,6 +45,7 @@ export default class DefaultAxis { numIntws: any[]; axisLabelWithCommon: any; + showGridlineLabels: boolean; constructor(type: any) { this.axisType = type == null ? "linear" : type; // linear, log, time, category, nanotime @@ -68,6 +69,7 @@ export default class DefaultAxis { this.axisFixedLabels = {}; this.dateIntws = []; this.numIntws = []; + this.showGridlineLabels = true; this.setNumFixs(); }