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

#7779 fix regression in histogram labeling #7785

Merged
merged 4 commits into from
Sep 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions js/notebook/src/plot/CombinedPlotScope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
10 changes: 3 additions & 7 deletions js/notebook/src/plot/PlotScope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ export default class PlotScope {
this.legendDone = false;
this.update();
this.fillCellModelWithPlotMethods();
this.adjustModelWidth();
this.emitSizeChange(true);
this.pointsLimitModal.init();
}
Expand Down Expand Up @@ -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() {
Expand All @@ -315,10 +315,6 @@ export default class PlotScope {
this.removePipe.length = 0;
}

adjustModelWidth() {
this.plotSize.updateModelWidth(this.plotSize.getPlotWithLegendWidth());
}

updatePlot() {
this.standardizeData();
this.initFlags();
Expand Down
23 changes: 21 additions & 2 deletions js/notebook/src/plot/PlotSize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,34 @@ 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")
);

let legendWidth = this.scope.jqlegendcontainer.find('.plot-legend').width() || 0;

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() {
Expand Down
2 changes: 2 additions & 0 deletions js/notebook/src/plot/std/axis/DefaultAxis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -68,6 +69,7 @@ export default class DefaultAxis {
this.axisFixedLabels = {};
this.dateIntws = [];
this.numIntws = [];
this.showGridlineLabels = true;

this.setNumFixs();
}
Expand Down