root-project / jsroot

JavaScript ROOT
MIT License
187 stars 80 forks source link

Palette coloring discarded on redraw #277

Closed Quark-X10 closed 9 months ago

Quark-X10 commented 9 months ago

Drawing a THStack with automatic coloring (PMC/PLC/PFC) works fine but all the colors reset to the blue default on redraw like when the "monitoring" box is checked in a THttpServer environment. As far as i know, the TMultiGraph counterpart is behaving as expected.

linev commented 9 months ago

Can you provide small reproducer macro that one can debug it?

Quark-X10 commented 9 months ago

Sure, here it is:

{
    THttpServer * hs = new THttpServer("http:8090;ro;noglobal");
    TCanvas * c = new TCanvas("c1","c1");
    THStack * s = new THStack("hstack","hstack");
    hs->Register("/",c);
    const Int_t n_bin = 100;
    TH1D * h1 = new TH1D("h1","h1",n_bin,-10,10);
    s->Add(h1);
    TH1D * h2 = new TH1D("h2","h2",n_bin,-10,10);
    s->Add(h2);
    for(Int_t i=1;i<=n_bin;++i)
    {
        h1->SetBinContent(i,1);
        h2->SetBinContent(i,2);
    }
    c->cd();
    s->Draw("NOSTACK PLC PMC");
}

While executing this with root -b -x macro.C, if you load the canvas on the webgui it draw correctly but if you then check monitoring the coloring resets to default at the first redraw.

linev commented 9 months ago

Should be fixed in 7.5.3

I attach here macro example which regularly update histograms. hstack.cxx.txt