Weird behaviour of TPaveText in jsroot

Dear experts,

I found an interesting behavior of TPaveText when used with jsroot. Consider the following toy example of filling a TPaveText:

TPaveText *pt = new TPaveText(0.05,0.05,.95,.95);
 
    for(int i=0; i<3; i++){
         pt->AddText(Form("Group %d", i));
        ((TText*)pt->GetListOfLines()->Last())->SetTextAlign(22);

        for(int j = 0; j<2; j++){
          pt->AddText(Form("Member %d", j));
          ((TText*)pt->GetListOfLines()->Last())->SetTextAlign(12);       
        }
        pt->AddText(""); 
        pt->AddLine();
        ((TLine*)pt->GetListOfLines()->Last())->SetLineWidth(3);
        ((TLine*)pt->GetListOfLines()->Last())->SetLineStyle(9);  
     }

The expected output of this code is the following:


However, when using the same code with jsroot, the output looks like this:

As it can be seen, there are two issues:

  1. The placement of the TLine does not follow the expected behavior of the AddLine() function
  2. The SetTextAlign() function does not work

I would appreciate any help for this problem!

Best,
Marcel

I think @linev can help.

Hello again,

In case you would like to check this issue with an already existing TPaveText on the official jsroot webpage, here is a TObject that contains a TPaveText generated with the example code above.
TObject_1653482257683.root (5 KB)

Thanks a lot in advance for any help with this!

Best,
Marcel

Hi Marcel,

Thanks for providing example - it much easier to debug it.
I fix several problems with drawing of TPaveText elements - here how it works:

https://jsroot.gsi.de/dev/?file=../files/tmp/tpave.root&item=ccdb_object

canvas

Regards,
Sergey

Hi Sergey,

Thanks a lot for this fix! This is great, now it looks as it is supposed to be.
Can you already anticipate when you will release these fixes in a new version of the jsroot?

Best,
Marcel

Can be done in next week

1 Like

Finally, JSROOT release 7.1.0 with related fixes is there!

Hi Sergey,

This is really great! Thanks a lot for your efforts!

Best,
Marcel

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.