|
953 | 953 | if (graph.fMaximum != -1111) maximum = ymax = graph.fMaximum; |
954 | 954 | if ((minimum < 0) && (ymin >=0)) minimum = 0.9*ymin; |
955 | 955 |
|
956 | | - var histo = JSROOT.CreateHistogram("TH1I", 100); |
957 | | - histo.fName = graph.fName + "_h"; |
958 | | - histo.fTitle = graph.fTitle; |
| 956 | + var kResetHisto = JSROOT.BIT(17); ///< fHistogram must be reset in GetHistogram |
| 957 | + |
| 958 | + var histo = graph.fHistogram; |
| 959 | + |
| 960 | + if (histo) { |
| 961 | + // make logic like in the TGraph::GetHistogram |
| 962 | + if (!graph.TestBit(kResetHisto)) return histo; |
| 963 | + graph.InvertBit(kResetHisto); |
| 964 | + } else { |
| 965 | + graph.fHistogram = histo = JSROOT.CreateHistogram("TH1I", 100); |
| 966 | + histo.fName = graph.fName + "_h"; |
| 967 | + histo.fTitle = graph.fTitle; |
| 968 | + histo.fBits = histo.fBits | JSROOT.TH1StatusBits.kNoStats; |
| 969 | + } |
| 970 | + |
959 | 971 | histo.fXaxis.fXmin = uxmin; |
960 | 972 | histo.fXaxis.fXmax = uxmax; |
961 | 973 | histo.fYaxis.fXmin = minimum; |
962 | 974 | histo.fYaxis.fXmax = maximum; |
963 | 975 | histo.fMinimum = minimum; |
964 | 976 | histo.fMaximum = maximum; |
965 | | - histo.fBits = histo.fBits | JSROOT.TH1StatusBits.kNoStats; |
| 977 | + |
966 | 978 | return histo; |
967 | 979 | } |
968 | 980 |
|
|
1918 | 1930 | painter.CreateStat(); |
1919 | 1931 |
|
1920 | 1932 | if (!painter.main_painter() && painter.options.Axis) { |
1921 | | - if (!graph.fHistogram) |
1922 | | - graph.fHistogram = painter.CreateHistogram(); |
1923 | | - JSROOT.draw(divid, graph.fHistogram, painter.options.Axis, painter.PerformDrawing.bind(painter, divid)); |
| 1933 | + JSROOT.draw(divid, painter.CreateHistogram(), painter.options.Axis, painter.PerformDrawing.bind(painter, divid)); |
1924 | 1934 | } else { |
1925 | 1935 | painter.PerformDrawing(divid); |
1926 | 1936 | } |
|
0 commit comments