Skip to content

Commit 67b11dd

Browse files
committed
Fix - correctly update TGraph drawing when X range is changing
While axes drawn with dummy histogram, one should correctly update histogram for that. There was error with copy of axes settings
1 parent 22a62f1 commit 67b11dd

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

scripts/JSRootPainter.hist.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2101,14 +2101,14 @@
21012101
function CopyAxis(tgt,src) {
21022102
tgt.fTitle = src.fTitle;
21032103
tgt.fLabels = src.fLabels;
2104+
tgt.fXmin = src.fXmin;
2105+
tgt.fXmax = src.fXmax;
21042106
}
21052107
CopyAxis(histo.fXaxis, obj.fXaxis);
21062108
CopyAxis(histo.fYaxis, obj.fYaxis);
21072109
CopyAxis(histo.fZaxis, obj.fZaxis);
21082110
if (!fp.zoom_changed_interactive) {
21092111
function CopyZoom(tgt,src) {
2110-
tgt.fXmin = src.fXmin;
2111-
tgt.fXmax = src.fXmax;
21122112
tgt.fFirst = src.fFirst;
21132113
tgt.fLast = src.fLast;
21142114
tgt.fBits = src.fBits;

scripts/JSRootPainter.more.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -779,7 +779,7 @@
779779

780780
function TGraphPainter(graph) {
781781
JSROOT.TObjectPainter.call(this, graph);
782-
this.ownhisto = false; // indicate if graph histogram was drawn for axes
782+
this.axes_draw = false; // indicate if graph histogram was drawn for axes
783783
this.bins = null;
784784
this.xmin = this.ymin = this.xmax = this.ymax = 0;
785785
this.wheel_zoomy = true;
@@ -914,7 +914,7 @@
914914
}
915915

916916
TGraphPainter.prototype.CreateHistogram = function() {
917-
// bins should be created
917+
// bins should be created when calling this function
918918

919919
var xmin = this.xmin, xmax = this.xmax, ymin = this.ymin, ymax = this.ymax;
920920

@@ -1755,9 +1755,9 @@
17551755
this.CreateBins();
17561756

17571757
// if our own histogram was used as axis drawing, we need update histogram as well
1758-
if (this.ownhisto) {
1758+
if (this.axes_draw) {
17591759
var main = this.main_painter();
1760-
if (obj.fHistogram) main.UpdateObject(obj.fHistogram);
1760+
main.UpdateObject(obj.fHistogram || this.CreateHistogram());
17611761
main.GetObject().fTitle = graph.fTitle; // copy title
17621762
}
17631763

@@ -1886,7 +1886,7 @@
18861886
}
18871887

18881888
TGraphPainter.prototype.PerformDrawing = function(divid, hpainter) {
1889-
if (hpainter) this.ownhisto = true;
1889+
if (hpainter) this.axes_draw = true;
18901890
this.SetDivId(divid);
18911891
this.DrawBins();
18921892
this.DrawNextFunction(0, this.DrawingReady.bind(this));

0 commit comments

Comments
 (0)