122using namespace std::string_literals;
231 if (entry.fName ==
name)
232 return precision > 0 ? entry.fIndx*10 + precision : entry.fIndx;
233 if (entry.fIndx > maxindx)
234 maxindx = entry.fIndx;
237 TString fullname = fontfile, fmt =
"ttf";
238 auto pos = fullname.
Last(
'.');
240 fmt = fullname(pos+1, fullname.
Length() - pos);
242 if ((fmt !=
"ttf") && (fmt !=
"woff2")) {
243 ::Error(
"TWebCanvas::AddFont",
"Unsupported font file extension %s", fmt.Data());
251 ::Error(
"TWebCanvas::AddFont",
"Not possible to read font file %s", fullname.
Data());
255 std::ifstream is(fullname.
Data(), std::ios::in | std::ios::binary);
258 is.seekg(0, std::ios::end);
259 res.resize(is.tellg());
260 is.seekg(0, std::ios::beg);
261 is.read((
char *)res.data(), res.length());
267 ::Error(
"TWebCanvas::AddFont",
"Fail to read font file %s", fullname.
Data());
277 return precision > 0 ? maxindx*10 + precision : maxindx;
306 static const struct {
307 const char *
name{
nullptr};
308 bool with_derived{
false};
309 bool reduse_by_many{
false};
310 } supported_classes[] = {{
"TH1",
true},
317 {
"TGraphPolargram",
true},
322 {
"TBox",
false,
true},
324 {
"TLine",
false,
true},
325 {
"TEllipse",
true,
true},
332 {
"TPolyLine",
true,
true},
349 for (
int i = 0; supported_classes[i].name !=
nullptr; ++i)
350 if ((!many_primitives || !supported_classes[i].reduse_by_many) && (strcmp(supported_classes[i].
name, obj->
ClassName()) == 0))
354 for (
int i = 0; supported_classes[i].name !=
nullptr; ++i)
355 if (supported_classes[i].with_derived && (!many_primitives || !supported_classes[i].reduse_by_many))
399 std::map<std::string, bool> mapped_funcs;
401 while (!modules_names.empty()) {
403 auto p = modules_names.find(
";");
404 if (
p == std::string::npos) {
405 modname = modules_names;
406 modules_names.clear();
408 modname = modules_names.substr(0,
p);
409 modules_names = modules_names.substr(
p+1);
412 p = modname.find(
"/");
413 if ((
p == std::string::npos) || modname.empty())
416 std::string pathname = modname.substr(0,
p+1);
417 std::string
filename = modname.substr(
p+1);
419 auto fpath = loc[pathname];
429 auto pmark = cont.find(
"$$jsroot_batch_conform$$");
430 if (pmark == std::string::npos)
436 static const std::string str1 =
"import {";
437 static const std::string str2 =
"} from 'jsroot';";
439 auto p1 = cont.find(str1);
440 auto p2 = cont.find(str2, p1);
441 if ((p1 == std::string::npos) || (p2 == std::string::npos) || (p2 > pmark))
446 TString funcs = cont.substr(p1 + 8, p2 - p1 - 8).c_str();
447 auto arr =
funcs.Tokenize(
",");
450 while (
auto obj = next()) {
453 if (!mapped_funcs[
name.Data()]) {
455 mapped_funcs[
name.Data()] =
true;
460 cont.erase(p1, p2 + str2.length() - p1);
462 cont.insert(p1, globs.
Data());
464 content.append(cont);
488 if (
name[0] ==
'+') {
511 TView *view =
nullptr;
544 painter->SetPainting(
nullptr);
602 auto *tgt = listofcols->Reserve(pal.
GetSize());
605 listofcols->FixSize();
616 TString code =
TString::Format(
"%d:%s:%s:%s", entry.fIndx, entry.fName.Data(), entry.fFormat.Data(), entry.fData.Data());
634 bool process_primitives = (version == 0) || (pad_status.fVersion > version);
660 if (resfunc && (version == 0))
670 TIter iter(primitives);
674 bool need_frame =
false, has_histo =
false, need_palette =
false;
675 std::string need_title;
677 auto checkNeedPalette = [](
TH1* hist,
const TString &opt) {
678 auto check = [&opt](
const TString &arg) {
679 return opt.Contains(arg +
"Z") || opt.Contains(arg +
"HZ");
682 return ((hist->
GetDimension() == 2) && (check(
"COL") || check(
"LEGO") || check(
"LEGO4") || check(
"SURF2"))) ||
683 ((hist->
GetDimension() == 3) && (check(
"BOX2") || check(
"BOX3")));
686 while (process_primitives && ((obj = iter()) !=
nullptr)) {
695 auto hs =
static_cast<THStack *
>(obj);
698 do_rebuild_stack =
kTRUE;
705 hs->BuildPrimitives(iter.
GetOption(), do_rebuild_stack);
722 frame =
static_cast<TFrame *
>(obj);
728 if (checkNeedPalette(
static_cast<TH1*
>(obj), opt))
733 if (!has_histo && (strlen(obj->
GetTitle()) > 0))
737 if (!has_histo && (strlen(obj->
GetTitle()) > 0))
740 need_frame = need_palette =
true;
745 if (!has_histo && (strlen(obj->
GetTitle()) > 0))
748 if (strcmp(obj->
GetName(),
"title") == 0)
764 auto line0 = title->
GetLine(0);
767 title =
new TPaveText(0, 0, 0, 0,
"blNDC");
776 title->
AddText(need_title.c_str());
778 primitives->
Add(title);
782 auto flush_master = [&]() {
789 auto check_cutg_in_options = [&](
const TString &opt) {
790 auto p1 = opt.Index(
"["), p2 = opt.Index(
"]");
791 if ((p1 !=
kNPOS) && (p2 !=
kNPOS) && p2 > p1 + 1) {
792 TString cutname = opt(p1 + 1, p2 - p1 - 1);
802 auto check_save_tf1 = [&](
TObject *fobj,
bool ignore_nodraw =
false) {
808 auto f1 =
static_cast<TF1 *
>(fobj);
817 f1->
Save(0, 0, 0, 0, 0, 0);
820 auto create_stats = [&]() {
860 bool has_tf1 =
false;
862 while (
auto fobj = fiter()) {
866 check_save_tf1(fobj);
872 stats = create_stats();
882 bool first_obj =
true;
884 if (process_primitives)
885 pad_status._has_specials =
false;
887 while ((obj = iter()) !=
nullptr) {
891 }
else if (!process_primitives) {
895 TH1K *hist =
static_cast<TH1K *
>(obj);
902 hist->TAttLine::Copy(*
h1);
903 hist->TAttFill::Copy(*
h1);
904 hist->TAttMarker::Copy(*
h1);
909 while (
auto fobj = fiter())
917 TH1 *hist =
static_cast<TH1 *
>(obj);
924 while (
auto fobj = fiter()) {
930 check_save_tf1(fobj);
937 if (!stats && (first_obj || o.
Contains(
"SAMES"))) {
938 stats = create_stats();
945 if (!palette &&
CanCreateObject(
"TPaletteAxis") && checkNeedPalette(hist, o)) {
946 std::stringstream exec;
947 exec <<
"new TPaletteAxis(0,0,0,0, (TH1*)" << std::hex << std::showbase << (size_t)hist <<
");";
948 palette = (
TObject *)
gROOT->ProcessLine(exec.str().c_str());
964 check_graph_funcs(
gr);
990 TString hopt = !real_draw ? iter.
GetOption() : (zscale ?
"lego2z" :
"lego2");
991 if (title) hopt.
Append(
";;use_pad_title");
994 auto hist = gr2d->
GetHistogram(real_draw ?
"empty" :
"");
1006 while (
auto fobj = fiter()) {
1008 check_save_tf1(fobj);
1012 while (
auto gobj = giter())
1013 check_graph_funcs(
static_cast<TGraph *
>(gobj));
1042 while (
auto fobj = fiter()) {
1052 std::stringstream exec;
1053 exec <<
"new TPaletteAxis(0,0,0,0,0,0);";
1054 palette = (
TObject *)
gROOT->ProcessLine(exec.str().c_str());
1064 auto f1 =
static_cast<TF1 *
> (obj);
1068 check_save_tf1(obj,
true);
1070 f1opt.
Append(
";force_saved");
1072 f1opt.
Append(
";prefer_saved");
1077 f1opt.
Append(
";webcanv_hist");
1081 check_cutg_in_options(iter.
GetOption());
1089 auto gaxis =
static_cast<TGaxis *
> (obj);
1097 if (frame && (obj == frame)) {
1111 bool provide_colors =
false;
1115 provide_colors = process_primitives;
1138 std::vector<TList *> all_primitives(
fAllPads.size());
1140 all_primitives[
n] =
fAllPads[
n]->fPrimitives;
1154 fAllPads[
n]->fPrimitives = all_primitives[
n];
1171 if (conn.match(connid)) {
1172 conn.fCtrl[key] =
value;
1189 if (conn.match(connid))
1190 conn.fSend.emplace(msg);
1204 bool isMoreData =
false, isAnySend =
false;
1208 bool isConnData = !conn.fCtrl.empty() || !conn.fSend.empty() ||
1209 ((conn.fCheckedVersion <
fCanvVersion) && (conn.fSendVersion == conn.fDrawVersion));
1211 while ((conn.is_batch() && !connid) || (conn.match(connid) &&
fWindow &&
fWindow->CanSend(conn.fConnId,
true))) {
1216 if (!conn.fCtrl.empty()) {
1219 }
else if (!conn.fSend.empty()) {
1220 std::swap(buf, conn.fSend.front());
1222 }
else if ((conn.fCheckedVersion <
fCanvVersion) && (conn.fSendVersion == conn.fDrawVersion)) {
1231 if (!conn.fSendVersion)
1237 if (conn.is_batch()) {
1244 auto hash =
json.Hash();
1245 if (conn.fLastSendHash && (conn.fLastSendHash == hash) && conn.fSendVersion) {
1249 buf.append(
json.Data());
1250 conn.fLastSendHash = hash;
1265 if (!buf.empty() && !conn.is_batch()) {
1266 fWindow->Send(conn.fConnId, buf);
1275 if (fTimer->IsSlow() && isMoreData)
1299 fWindow->SetDefaultPage(
"file:rootui5sys/canv/canvas6.html");
1303 [
this](
unsigned connid) {
1304 if (
fWindow->GetConnectionId(0) == connid)
1311 [
this](
unsigned connid,
const std::string &arg) {
1316 [
this](
unsigned connid) {
1319 if (
c.fConnId == connid) {
1329 if ((
w > 0) && (
w < 50000) && (
h > 0) && (
h < 30000))
1345 if (
gROOT->IsWebDisplayBatch())
1369 if (!pad || !obj)
return;
1373 AddCtrlMsg(0,
"edit"s, std::to_string(hash));
1442 if ((cw > 0) && (ch > 0)) {
1488 auto arr = TBufferJSON::FromJSON<std::vector<TWebPadOptions>>(msg);
1495 TPad *pad_with_execs =
nullptr;
1496 TExec *hist_exec =
nullptr;
1498 for (
unsigned n = 0;
n < arr->size(); ++
n) {
1499 auto &
r = arr->at(
n);
1510 if (
r.w.size() == 4)
1515 if (
r.active && (pad !=
gPad) && process_execs)
1563 if (mother->GetAbsWNDC() > 0. && mother->GetAbsHNDC() > 0.) {
1564 pad->
fXlowNDC = (
r.xlow - mother->GetAbsXlowNDC()) / mother->GetAbsWNDC();
1565 pad->
fYlowNDC = (
r.ylow - mother->GetAbsYlowNDC()) / mother->GetAbsHNDC();
1566 pad->
fXUpNDC = (
r.xup - mother->GetAbsXlowNDC()) / mother->GetAbsWNDC();
1567 pad->
fYUpNDC = (
r.yup - mother->GetAbsYlowNDC()) / mother->GetAbsHNDC();
1568 pad->
fWNDC = (
r.xup -
r.xlow) / mother->GetAbsWNDC();
1569 pad->
fHNDC = (
r.yup -
r.ylow) / mother->GetAbsHNDC();
1573 if (
r.phi ||
r.theta) {
1589 if ((xrange != 0.) && (pxrange != 0)) {
1592 pad->
fXtoPixelk = rounding + -pxrange*
r.px1/xrange;
1599 if ((yrange != 0.) && (pyrange != 0.)) {
1602 pad->
fYtoPixelk = rounding + -pyrange - pyrange*
r.py1/yrange;
1618 if (hist_holder == hist)
1619 hist_holder =
nullptr;
1634 if ((
hmin ==
hmax) && !no_entries && !is_stack) {
1639 }
else if (
r.zy1 ==
r.zy2) {
1648 if ((
hmin ==
hmax) && !no_entries) {
1654 if (
r.zz1 ==
r.zz2) {
1677 ::Error(
"SetMember",
"Cannot find %s data member in %s",
name, hist_holder->
ClassName());
1681 SetMember(
"fMinimum",
hmin);
1682 SetMember(
"fMaximum",
hmax);
1686 while (
auto fobj = next())
1688 hist_exec = (
TExec *) fobj;
1689 need_update =
kTRUE;
1693 std::map<std::string, int> idmap;
1695 for (
auto &item :
r.primitives) {
1696 auto iter = idmap.find(item.snapid);
1698 if (iter == idmap.end())
1699 idmap[item.snapid] = 1;
1701 idcnt = ++iter->second;
1709 need_update =
kTRUE;
1712 if (process_execs && (
gPad == pad))
1713 pad_with_execs = pad;
1730 if ((!execs || !execs->GetSize()) && !extra)
1742 while (
auto obj = next()) {
1743 auto exec =
dynamic_cast<TExec *
>(obj);
1760 std::string buf = lines;
1764 while (obj && !buf.empty()) {
1765 std::string sub = buf;
1766 auto pos = buf.find(
";;");
1767 if (pos == std::string::npos) {
1771 sub = buf.substr(0,pos);
1772 buf = buf.substr(pos+2);
1774 if (sub.empty())
continue;
1776 std::stringstream exec;
1777 exec <<
"((" << obj->
ClassName() <<
" *) " << std::hex << std::showbase << (size_t)obj <<
")->" << sub <<
";";
1778 if (indx < 3 || gDebug > 0)
1779 Info(
"ProcessLinesForObject",
"Obj %s Execute %s", obj->
GetName(), exec.str().c_str());
1780 gROOT->ProcessLine(exec.str().c_str());
1797 if (
fWebConn[indx].fConnId == connid)
1803 Bool_t is_main_connection = indx == 1;
1807 FlagGuard(
Bool_t &_flag) : flag(_flag) { flag =
true; }
1808 ~FlagGuard() { flag =
false; }
1813 const char *cdata = arg.c_str();
1815 if (arg ==
"KEEPALIVE") {
1818 }
else if (arg ==
"QUIT") {
1823 }
else if (arg.compare(0, 7,
"READY6:") == 0) {
1830 const char *separ = strchr(cdata,
':');
1832 fWebConn[indx].fDrawVersion = std::stoll(cdata);
1834 fWebConn[indx].fDrawVersion = std::stoll(std::string(cdata, separ - cdata));
1840 }
else if (arg ==
"RELOAD") {
1845 }
else if (arg.compare(0, 5,
"SAVE:") == 0) {
1848 const char *img = cdata + 5;
1850 const char *separ = strchr(img,
':');
1855 std::ofstream ofs(
filename.Data());
1862 filelen = strlen(img);
1866 filelen = binary.
Length();
1870 Info(
"ProcessData",
"File %s size %d has been created",
filename.Data(), filelen);
1873 }
else if (arg.compare(0, 8,
"PRODUCE:") == 0) {
1878 }
else if (arg.compare(0, 8,
"GETMENU:") == 0) {
1886 std::string buf =
"MENU:";
1891 }
else if (arg.compare(0, 11,
"STATUSBITS:") == 0) {
1893 if (is_main_connection) {
1898 }
else if (arg.compare(0, 10,
"HIGHLIGHT:") == 0) {
1900 if (is_main_connection) {
1901 auto arr = TBufferJSON::FromJSON<std::vector<std::string>>(arg.substr(10));
1902 if (!arr || (arr->size() != 4)) {
1903 Error(
"ProcessData",
"Wrong arguments count %d in highlight message", (
int)(arr ? arr->size() : -1));
1907 int argx = std::stoi(arr->at(2));
1908 int argy = std::stoi(arr->at(3));
1920 }
else if (
IsReadOnly() || !is_main_connection) {
1927 }
else if (arg.compare(0, 9,
"OPTIONS6:") == 0) {
1932 }
else if (arg.compare(0, 9,
"FITPANEL:") == 0) {
1934 std::string chid = arg.substr(9);
1936 TH1 *hist =
nullptr;
1938 while (
auto obj = iter()) {
1939 hist =
dynamic_cast<TH1 *
>(obj);
1944 if (chid ==
"standalone")
1945 showcmd =
"panel->Show()";
1947 showcmd =
TString::Format(
"auto wptr = (std::shared_ptr<ROOT::RWebWindow>*)0x%zx;"
1948 "panel->Show({*wptr, %u, %s})",
1949 (
size_t) &
fWindow, connid, chid.c_str());
1951 auto cmd =
TString::Format(
"auto panel = std::make_shared<ROOT::Experimental::RFitPanel>(\"FitPanel\");"
1952 "panel->AssignCanvas(\"%s\");"
1953 "panel->AssignHistogram((TH1 *)0x%zx);"
1954 "%s;panel->ClearOnClose(panel);",
1955 Canvas()->GetName(), (
size_t) hist, showcmd.
Data());
1956 gROOT->ProcessLine(cmd.Data());
1957 }
else if (arg ==
"START_BROWSER"s) {
1959 gROOT->ProcessLine(
"new TBrowser;");
1961 }
else if (arg.compare(0, 6,
"EVENT:") == 0) {
1962 auto arr = TBufferJSON::FromJSON<std::vector<std::string>>(arg.substr(6));
1963 if (!arr || (arr->size() != 5)) {
1964 Error(
"ProcessData",
"Wrong arguments count %d in event message", (
int)(arr ? arr->size() : -1));
1967 std::string kind = arr->at(1);
1970 int argx = std::stoi(arr->at(2));
1971 int argy = std::stoi(arr->at(3));
1974 if ((event >= 0) && pad && (pad ==
gPad)) {
1985 }
else if (arg.compare(0, 8,
"PRIMIT6:") == 0) {
1987 auto opt = TBufferJSON::FromJSON<TWebObjectOptions>(arg.c_str() + 8);
1997 }
else if (arg.compare(0, 11,
"PADCLICKED:") == 0) {
1999 auto click = TBufferJSON::FromJSON<TWebPadClick>(arg.c_str() + 11);
2007 const char *mthd = btn->GetMethod();
2008 if (mthd && *mthd) {
2010 gROOT->ProcessLine(mthd);
2015 if (pad && (pad !=
gPad)) {
2022 if (!click->objid.empty()) {
2030 if ((click->x >= 0) && (click->y >= 0)) {
2043 }
else if (arg.compare(0, 8,
"OBJEXEC:") == 0) {
2045 auto buf = arg.substr(8);
2046 auto pos = buf.find(
":");
2048 if ((pos > 0) && (pos != std::string::npos)) {
2049 auto sid = buf.substr(0, pos);
2050 buf.erase(0, pos + 1);
2053 TPad *objpad =
nullptr;
2057 if (obj && !buf.empty()) {
2070 }
else if (arg.compare(0, 12,
"EXECANDSEND:") == 0) {
2074 std::string buf = arg.substr(12);
2078 auto pos = buf.find(
":");
2082 reply = buf.substr(0, pos);
2083 buf.erase(0, pos + 1);
2084 pos = buf.find(
":");
2086 auto sid = buf.substr(0, pos);
2087 buf.erase(0, pos + 1);
2092 if (obj && !buf.empty() && !reply.empty()) {
2093 std::stringstream exec;
2094 exec <<
"((" << obj->
ClassName() <<
" *) " << std::hex << std::showbase << (size_t)obj
2095 <<
")->" << buf <<
";";
2097 Info(
"ProcessData",
"Obj %s Exec %s", obj->
GetName(), exec.str().c_str());
2099 auto res =
gROOT->ProcessLine(exec.str().c_str());
2102 std::string send = reply;
2106 if (reply[0] ==
'D')
2111 }
else if (arg.compare(0, 6,
"CLEAR:") == 0) {
2112 std::string snapid = arg.substr(6);
2121 Error(
"ProcessData",
"Not found pad with id %s to clear\n", snapid.c_str());
2123 }
else if (arg.compare(0, 7,
"DIVIDE:") == 0) {
2124 auto arr = TBufferJSON::FromJSON<std::vector<std::string>>(arg.substr(7));
2125 if (arr && arr->size() == 2) {
2127 int nn = 0, n1 = 0, n2 = 0;
2129 std::string divide = arr->at(1);
2130 auto p = divide.find(
'x');
2131 if (
p == std::string::npos)
2132 p = divide.find(
'X');
2134 if (
p != std::string::npos) {
2135 n1 = std::stoi(divide.substr(0,
p));
2136 n2 = std::stoi(divide.substr(
p+1));
2138 nn = std::stoi(divide);
2141 if (pad && ((nn > 1) || (n1*n2 > 1))) {
2153 }
else if (arg.compare(0, 8,
"DRAWOPT:") == 0) {
2155 auto arr = TBufferJSON::FromJSON<std::vector<std::string>>(arg.substr(8));
2156 if (arr && arr->size() == 2) {
2163 }
else if (arg.compare(0, 8,
"RESIZED:") == 0) {
2165 auto arr = TBufferJSON::FromJSON<std::vector<int>>(arg.substr(8));
2166 if (arr && arr->size() == 7) {
2175 }
else if (arg.compare(0, 7,
"POPOBJ:") == 0) {
2177 auto arr = TBufferJSON::FromJSON<std::vector<std::string>>(arg.substr(7));
2178 if (arr && arr->size() == 2) {
2183 while (
auto o = next())
2193 }
else if (arg.compare(0, 8,
"SHOWURL:") == 0) {
2196 args.
SetUrl(arg.substr(8));
2201 }
else if (arg ==
"INTERRUPT"s) {
2203 gROOT->SetInterrupt();
2228 entry._modified =
true;
2232 while (
auto obj = iter()) {
2247 entry.second._detected =
false;
2248 entry.second._modified = force_modified;
2255 bool is_any_modified =
false;
2257 if (iter->second._modified)
2258 is_any_modified =
true;
2259 if (!iter->second._detected)
2266 if (is_any_modified) {
2269 if (entry.second._modified)
2273 return is_any_modified;
2289 fWindow->SetGeometry(arr[2], arr[3]);
2362 Info(
"WaitWhenCanvasPainted",
"version %ld", (
long)ver);
2364 while (cnt++ < cnt_limit) {
2366 if (!
fWindow->HasConnection(0,
false)) {
2368 Info(
"WaitWhenCanvasPainted",
"no connections - abort");
2374 Info(
"WaitWhenCanvasPainted",
"ver %ld got painted", (
long)ver);
2384 Info(
"WaitWhenCanvasPainted",
"timeout");
2407 imp->CreatePadSnapshot(holder, pad, 0, [&res, json_compression](
TPadWebSnapshot *snap) {
2427 auto imp = std::make_unique<TWebCanvas>(
c,
c->GetName(), 0, 0,
c->GetWw(),
c->GetWh(),
kTRUE);
2433 imp->CreatePadSnapshot(holder,
c, 0, [&res, json_compression](
TPadWebSnapshot *snap) {
2459 auto imp = std::make_unique<TWebCanvas>(
c,
c->GetName(), 0, 0,
c->GetWw(),
c->GetWh(),
kTRUE);
2487 const char *endings[4] = {
"(",
"[",
"]",
")"};
2488 const char *suffix =
nullptr;
2489 for (
int n = 0; (
n < 4) && !suffix; ++
n) {
2492 suffix = endings[
n];
2511 }
else if (fmt ==
"pdf") {
2514 append_batch =
kTRUE;
2520 ::Error(
"TWebCanvas::ProduceImage",
"Cannot change PDF name when multi-page PDF active");
2525 ::Error(
"TWebCanvas::ProduceImage",
"Cannot produce other images when multi-page PDF active");
2539 if (!suffix && (!
gBatchImageMode || (fmt ==
"s.pdf") || (fmt ==
"json") || (fmt ==
"s.png")))
2567 std::vector<std::string> jsons;
2568 std::vector<Int_t> widths, heights;
2570 for (
unsigned n = 0;
n < pads.size(); ++
n) {
2580 if ((pad->GetCanvas() == pad) || (pad->IsA() ==
TCanvas::Class())) {
2584 w = (
Int_t) (pad->GetAbsWNDC() * pad->GetCanvas()->GetWw());
2585 h = (
Int_t) (pad->GetAbsHNDC() * pad->GetCanvas()->GetWh());
2589 jsons.emplace_back(
json.Data());
2590 widths.emplace_back(
w);
2591 heights.emplace_back(
h);
2596 if (!
gBatchImageMode || (fmt ==
"json") || (fmt ==
"s.png") || (fmt ==
"s.pdf"))
2619 TPad *objpad =
nullptr;
2622 if (item.
fcust.compare(
"exec") == 0) {
2623 auto pos = item.
opt.find(
"(");
2624 if (obj && (pos != std::string::npos) && obj->
IsA()->
GetMethodAllAny(item.
opt.substr(0,pos).c_str())) {
2625 std::stringstream exec;
2626 exec <<
"((" << obj->
ClassName() <<
" *) " << std::hex << std::showbase
2627 << (size_t)obj <<
")->" << item.
opt <<
";";
2629 Info(
"ProcessObjectOptions",
"Obj %s Execute %s", obj->
GetName(), exec.str().c_str());
2630 gROOT->ProcessLine(exec.str().c_str());
2632 Error(
"ProcessObjectOptions",
"Fail to execute %s for object %p %s", item.
opt.c_str(), obj, obj ? obj->
ClassName() :
"---");
2638 bool modified =
false;
2641 auto pos = item.
opt.find(
";;use_");
2642 if (pos != std::string::npos) item.
opt.resize(pos);
2645 Info(
"ProcessObjectOptions",
"Set draw option %s for object %s %s", item.
opt.c_str(),
2653 if (item.
fcust.compare(0,10,
"auto_exec:") == 0) {
2655 }
else if (item.
fcust.compare(
"frame") == 0) {
2658 if (item.
fopt.size() >= 4) {
2666 }
else if (item.
fcust.compare(0,4,
"pave") == 0) {
2669 if ((item.
fopt.size() >= 4) && objpad) {
2685 auto stats =
static_cast<TPaveStats *
>(pave);
2687 size_t pos_start = 6, pos_end;
2688 while ((pos_end = item.
fcust.find(
";;", pos_start)) != std::string::npos) {
2689 stats->AddText(item.
fcust.substr(pos_start, pos_end - pos_start).c_str());
2690 pos_start = pos_end + 2;
2692 stats->AddText(item.
fcust.substr(pos_start).c_str());
2695 }
else if (item.
fcust.compare(0,9,
"func_fail") == 0) {
2702 return modified ? objpad :
nullptr;
2713 if (sid.empty() || (sid ==
"0"s))
2719 std::string subelement;
2720 long unsigned id = 0;
2723 auto separ = sid.find(
"#");
2725 if (separ == std::string::npos) {
2726 id = std::stoul(sid);
2728 subelement = sid.substr(separ + 1);
2729 id = std::stoul(sid.substr(0, separ));
2736 TObject *obj = lnk->GetObject();
2739 if (!search_hist && (
TString::Hash(&obj,
sizeof(obj)) !=
id)) {
2742 if (objpad && !*objpad)
2751 if (!search_hist && --idcnt > 0)
2761 subelement =
"hist";
2763 auto getHistogram = [](
TObject *container) ->
TH1* {
2764 auto offset = container->IsA()->GetDataMemberOffset(
"fHistogram");
2766 return *((
TH1 **)((
char *)container +
offset));
2767 ::Error(
"getHistogram",
"Cannot access fHistogram data member in %s", container->ClassName());
2771 while(!subelement.empty() && obj) {
2773 if (!search_hist && objlnk)
2776 std::string kind = subelement;
2777 auto separ = kind.find(
"#");
2778 if (separ == std::string::npos) {
2782 subelement = subelement.substr(separ + 1);
2793 if (kind.compare(
"hist") == 0) {
2797 obj = getHistogram(
gr);
2799 obj = getHistogram(mg);
2801 obj = getHistogram(hs);
2803 obj = getHistogram(scatter);
2805 obj = getHistogram(
f1);
2807 obj = getHistogram(gr2d);
2810 }
else if (kind.compare(
"x") == 0) {
2812 }
else if (kind.compare(
"y") == 0) {
2814 }
else if (kind.compare(
"z") == 0) {
2816 }
else if ((kind.compare(0,5,
"func_") == 0) || (kind.compare(0,5,
"indx_") == 0)) {
2817 auto funcname = kind.substr(5);
2818 TList *col =
nullptr;
2829 else if (kind.compare(0,5,
"func_") == 0)
2832 obj = col->
At(std::stoi(funcname));
2833 }
else if (kind.compare(0,7,
"graphs_") == 0) {
2835 obj = graphs ? graphs->
At(std::stoi(kind.substr(7))) :
nullptr;
2836 }
else if (kind.compare(0,6,
"hists_") == 0) {
2838 obj = hists ? hists->
At(std::stoi(kind.substr(6))) :
nullptr;
2839 }
else if (kind.compare(0,6,
"stack_") == 0) {
2840 auto stack = hs ? hs->
GetStack() :
nullptr;
2841 obj = stack ? stack->At(std::stoi(kind.substr(6))) :
nullptr;
2842 }
else if (kind.compare(0,7,
"member_") == 0) {
2843 auto member = kind.substr(7);
2851 if (!search_hist || obj)
void Info(const char *location, const char *msgfmt,...)
Use this function for informational messages.
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void data
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t hmin
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t hmax
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void funcs
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t src
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t height
R__EXTERN TStyle * gStyle
R__EXTERN TSystem * gSystem
R__EXTERN TVirtualPS * gVirtualPS
static std::vector< WebFont_t > gWebFonts
static const std::string sid_pad_histogram
Holds different arguments for starting browser with RWebDisplayHandle::Display() method.
EBrowserKind GetBrowserKind() const
returns configured browser kind, see EBrowserKind for supported values
void SetStandalone(bool on=true)
Set standalone mode for running browser, default on When disabled, normal browser window (or just tab...
RWebDisplayArgs & SetWidgetKind(const std::string &kind)
set widget kind
RWebDisplayArgs & SetSize(int w, int h)
set preferable web window width and height
RWebDisplayArgs & SetUrl(const std::string &url)
set window url
RWebDisplayArgs & SetPos(int x=-1, int y=-1)
set preferable web window x and y position, negative is default
@ kCEF
Chromium Embedded Framework - local display with CEF libs.
@ kQt5
Qt5 QWebEngine libraries - Chromium code packed in qt5.
@ kQt6
Qt6 QWebEngine libraries - Chromium code packed in qt6.
static bool ProduceImages(const std::string &fname, const std::vector< std::string > &jsons, const std::vector< int > &widths, const std::vector< int > &heights, const char *batch_file=nullptr)
Produce image file(s) using JSON data as source Invokes JSROOT drawing functionality in headless brow...
static std::vector< std::string > ProduceImagesNames(const std::string &fname, unsigned nfiles=1)
Produce vector of file names for specified file pattern Depending from supported file forma.
static std::string GetImageFormat(const std::string &fname)
Detect image format There is special handling of ".screenshot.pdf" and ".screenshot....
static bool ProduceImage(const std::string &fname, const std::string &json, int width=800, int height=600, const char *batch_file=nullptr)
Produce image file using JSON data as source Invokes JSROOT drawing functionality in headless browser...
static std::unique_ptr< RWebDisplayHandle > Display(const RWebDisplayArgs &args)
Create web display.
static std::shared_ptr< RWebWindow > Create()
Create new RWebWindow Using default RWebWindowsManager.
static bool EmbedFileDialog(const std::shared_ptr< RWebWindow > &window, unsigned connid, const std::string &args)
Create dialog instance to use as embedded dialog inside provided widget Loads libROOTBrowserv7 and tr...
static bool IsFileDialogMessage(const std::string &msg)
Check if this could be the message send by client to start new file dialog If returns true,...
static std::map< std::string, std::string > GetServerLocations()
Returns server locations as <std::string, std::string> Key is location name (with slash at the end) a...
Array of integers (32 bits per element).
const Int_t * GetArray() const
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
virtual void SetFillStyle(Style_t fstyle)
Set the fill area style.
virtual void SetBottomMargin(Float_t bottommargin)
Set Pad bottom margin in fraction of the pad height.
virtual void SetLeftMargin(Float_t leftmargin)
Set Pad left margin in fraction of the pad width.
virtual void SetRightMargin(Float_t rightmargin)
Set Pad right margin in fraction of the pad width.
Float_t GetRightMargin() const
virtual void SetTopMargin(Float_t topmargin)
Set Pad top margin in fraction of the pad height.
virtual void SetTextAlign(Short_t align=11)
Set the text alignment.
virtual void SetTextColor(Color_t tcolor=1)
Set the text color.
virtual void SetTextFont(Font_t tfont=62)
Set the text font.
virtual void SetTextSize(Float_t tsize=1)
Set the text size.
virtual void SetRangeUser(Double_t ufirst, Double_t ulast)
Set the viewing range for the axis from ufirst to ulast (in user coordinates, that is,...
virtual void SetRange(Int_t first=0, Int_t last=0)
Set the viewing range for the axis using bin numbers.
static TString Decode(const char *data)
Decode a base64 string date into a generic TString.
static TString Encode(const char *data)
Transform data into a null terminated base64 string.
virtual void SetY2(Double_t y2)
virtual void SetX1(Double_t x1)
virtual void SetX2(Double_t x2)
virtual void SetY1(Double_t y1)
static Int_t ExportToFile(const char *filename, const TObject *obj, const char *option=nullptr)
Convert object into JSON and store in text file Returns size of the produce file Used in TObject::Sav...
static TString ToJSON(const T *obj, Int_t compact=0, const char *member_name=nullptr)
@ kNoSpaces
no new lines plus remove all spaces around "," and ":" symbols
@ kMapAsObject
store std::map, std::unordered_map as JSON object
@ kSameSuppression
zero suppression plus compress many similar values together
ABC describing GUI independent main window (with menubar, scrollbars and a drawing area).
void SetScripts(const std::string &src)
void SetFixedSize(bool on=true)
void SetHighlightConnect(bool on=true)
UInt_t fCw
Width of the canvas along X (pixels)
UInt_t GetWindowHeight() const
void SetClickSelectedPad(TPad *pad)
Int_t fWindowTopX
Top X position of window (in pixels)
Int_t fEventX
! Last X mouse position in canvas
TVirtualPadPainter * GetCanvasPainter()
Access and (probably) creation of pad painter.
UInt_t fWindowWidth
Width of window (including borders, etc.)
Int_t fEventY
! Last Y mouse position in canvas
UInt_t fWindowHeight
Height of window (including menubar, borders, etc.)
TObject * fSelected
! Currently selected object
UInt_t fCh
Height of the canvas along Y (pixels)
UInt_t GetWindowWidth() const
Int_t fWindowTopY
Top Y position of window (in pixels)
void SetClickSelected(TObject *obj)
UInt_t GetWw() const override
UInt_t GetWh() const override
virtual void Highlighted(TVirtualPad *pad, TObject *obj, Int_t x, Int_t y)
Emit Highlighted() signal.
Int_t fEvent
! Type of current or last handled event
TClass instances represent classes, structs and namespaces in the ROOT type system.
Longptr_t GetDataMemberOffset(const char *membername) const
return offset for member name.
Int_t Size() const
Return size of object of this class.
Bool_t InheritsFrom(const char *cl) const override
Return kTRUE if this class inherits from a class with name "classname".
TMethod * GetMethodAllAny(const char *method)
Return pointer to method without looking at parameters.
void SetName(const char *name)
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
The color creation and management class.
static const TArrayI & GetPalette()
Static function returning the current active palette.
static Bool_t DefinedColors(Int_t set_always_on=0)
Static method returning kTRUE if some new colors have been defined after initialisation or since the ...
virtual Int_t GetValue(const char *name, Int_t dflt) const
Returns the integer value for a resource.
TExec is a utility class that can be used to execute a C++ command when some event happens in a pad.
virtual void Exec(const char *command="")
Execute the command referenced by this object.
virtual TH1 * GetHistogram() const
Return a pointer to the histogram used to visualise the function Note that this histogram is managed ...
virtual Bool_t IsValid() const
Return kTRUE if the function is valid.
virtual void Save(Double_t xmin, Double_t xmax, Double_t ymin, Double_t ymax, Double_t zmin, Double_t zmax)
Save values of function in array fSave.
TClass * IsA() const override
Bool_t HasSave() const
Return true if function has data in fSave buffer.
TF1 * GetFunction() const
Graphics object made of three arrays X, Y and Z with the same number of points each.
TH2D * GetHistogram(Option_t *option="")
By default returns a pointer to the Delaunay histogram.
TList * GetListOfFunctions() const
A TGraph is an object made of two arrays X and Y with npoints each.
@ kNoStats
Don't draw stats box.
TList * GetListOfFunctions() const
virtual TH1F * GetHistogram() const
Returns a pointer to the histogram used to draw the axis Takes into account the two following cases.
1-D histogram with a double per channel (see TH1 documentation)
TH1K class supports the nearest K Neighbours method, widely used in cluster analysis.
Double_t GetBinContent(Int_t bin) const override
Return content of global bin number bin.
TH1 is the base class of all histogram classes in ROOT.
virtual void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
virtual Int_t GetDimension() const
@ kNoTitle
Don't draw the histogram title.
@ kIsZoomed
Bit set when zooming on Y axis.
virtual void SetMaximum(Double_t maximum=-1111)
virtual void SetMinimum(Double_t minimum=-1111)
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
virtual Double_t GetEntries() const
Return the current number of entries.
TList * GetListOfFunctions() const
void SetName(const char *name) override
Change the name of this histogram.
virtual Int_t BufferEmpty(Int_t action=0)
Fill histogram with all entries in the buffer.
The Histogram stack class.
TObjArray * GetStack()
Return pointer to Stack. Build it if not yet done.
Int_t GetNhists() const
Return the number of histograms in the stack.
static char * ReadFileContent(const char *filename, Int_t &len)
Reads content of file from the disk.
Option_t * GetOption() const
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
void Add(TObject *obj) override
TObject * Last() const override
Return the last object in the list. Returns 0 when list is empty.
virtual TObjLink * FirstLink() const
TObject * At(Int_t idx) const override
Returns the object at position idx. Returns 0 if idx is out of range.
void AddFirst(TObject *obj) override
Add object at the beginning of the list.
A TMultiGraph is a collection of TGraph (or derived) objects.
TList * GetListOfGraphs() const
TList * GetListOfFunctions()
Return pointer to list of functions.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
Wrapper around a TObject so it can be stored in a TList.
virtual void SetOption(Option_t *)
TObject * GetObject() const
Mother of all ROOT objects.
virtual const char * GetName() const
Returns name of object.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
virtual TObject * Clone(const char *newname="") const
Make a clone of an object using the Streamer facility.
virtual const char * ClassName() const
Returns name of class to which the object belongs.
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
virtual const char * GetTitle() const
Returns title of object.
virtual TClass * IsA() const
virtual void Paint(Option_t *option="")
This method must be overridden if a class wants to paint itself.
TPadWebSnapshot & NewSubPad()
Create new entry for subpad.
TWebSnapshot & NewPrimitive(TObject *obj=nullptr, const std::string &opt="", const std::string &suffix="")
Create new entry in list of primitives.
TWebSnapshot & NewSpecials()
Create new entry in list of primitives in the front.
void SetHasExecs(bool on=true)
void SetWithoutPrimitives(bool on=true)
void SetActive(bool on=true)
bool IsSetObjectIds() const
The most important graphics class in the ROOT system.
Int_t GetTicky() const override
Double_t fAbsYlowNDC
Absolute Y top left corner of pad in NDC [0,1].
Double_t fXtoAbsPixelk
Conversion coefficient for X World to absolute pixel.
virtual void DivideSquare(Int_t n, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0)
"n" is the total number of sub-pads.
Double_t fWNDC
Width of pad along X in Normalized Coordinates (NDC)
void SetView(TView *view=nullptr) override
Set the current TView. Delete previous view if view=0.
TVirtualViewer3D * GetViewer3D(Option_t *type="") override
Create/obtain handle to 3D viewer.
Double_t fPixeltoYk
Conversion coefficient for pixel to Y World.
void SetGrid(Int_t valuex=1, Int_t valuey=1) override
Double_t fPhi
phi angle to view as lego/surface
Double_t fPixeltoY
yworld = fPixeltoYk + fPixeltoY*ypixel
Double_t fAbsXlowNDC
Absolute X top left corner of pad in NDC [0,1].
TList * GetListOfExecs() const override
void Divide(Int_t nx=1, Int_t ny=1, Float_t xmargin=0.01, Float_t ymargin=0.01, Int_t color=0) override
Automatic pad generation by division.
Double_t fXtoPixel
xpixel = fXtoPixelk + fXtoPixel*xworld
Bool_t GetGridx() const override
Double_t fX2
X of upper X coordinate.
Double_t fPixeltoX
xworld = fPixeltoXk + fPixeltoX*xpixel
Double_t fYtoPixel
ypixel = fYtoPixelk + fYtoPixel*yworld
Double_t fAbsWNDC
Absolute Width of pad along X in NDC.
TObject * Remove(TObject *obj, Bool_t modified=kTRUE) override
Remove object from list of primitives When.
UInt_t GetWw() const override
Get Ww.
Double_t fX1
X of lower X coordinate.
TList * GetListOfPrimitives() const override
Double_t fUymin
Minimum value on the Y axis.
Int_t fLogz
(=0 if Z linear scale, =1 if log scale)
Double_t fYtoPixelk
Conversion coefficient for Y World to pixel.
Double_t fPixeltoXk
Conversion coefficient for pixel to X World.
Bool_t IsModified() const override
Double_t fY1
Y of lower Y coordinate.
Double_t fYlowNDC
Y bottom left corner of pad in NDC [0,1].
Double_t fAbsPixeltoXk
Conversion coefficient for absolute pixel to X World.
void Clear(Option_t *option="") override
Delete all pad primitives.
Int_t GetTickx() const override
Double_t fUymax
Maximum value on the Y axis.
TVirtualPad * GetMother() const override
void Modified(Bool_t flag=true) override
Mark pad modified Will be repainted when TCanvas::Update() will be called next time.
TView * GetView() const override
TClass * IsA() const override
Bool_t GetGridy() const override
Double_t fAbsHNDC
Absolute Height of pad along Y in NDC.
void SetFixedAspectRatio(Bool_t fixed=kTRUE) override
Fix pad aspect ratio to current value if fixed is true.
Int_t fLogx
(=0 if X linear scale, =1 if log scale)
Double_t GetAbsWNDC() const override
UInt_t GetWh() const override
Get Wh.
TCanvas * GetCanvas() const override
void Add(TObject *obj, Option_t *opt="", Bool_t modified=kTRUE) override
Add an object to list of primitives with speicified draw option When.
Double_t fTheta
theta angle to view as lego/surface
TVirtualPad * cd(Int_t subpadnumber=0) override
Set Current pad.
void Print(const char *filename="") const override
This method is equivalent to SaveAs("filename"). See TPad::SaveAs for details.
TFrame * GetFrame() override
Get frame.
Double_t fYtoAbsPixelk
Conversion coefficient for Y World to absolute pixel.
Double_t fXtoPixelk
Conversion coefficient for X World to pixel.
Int_t fLogy
(=0 if Y linear scale, =1 if log scale)
Double_t fHNDC
Height of pad along Y in Normalized Coordinates (NDC)
Double_t fXlowNDC
X bottom left corner of pad in NDC [0,1].
Double_t fUxmin
Minimum value on the X axis.
Double_t GetAbsHNDC() const override
void SetTicks(Int_t valuex=1, Int_t valuey=1) override
Double_t fUxmax
Maximum value on the X axis.
Double_t fY2
Y of upper Y coordinate.
Double_t fAbsPixeltoYk
Conversion coefficient for absolute pixel to Y World.
const char * GetName() const override
Returns name of object.
The histogram statistics painter class.
virtual void SetStatFormat(const char *format="6.4g")
Change (i.e. set) the format for printing statistics.
virtual void SetFitFormat(const char *format="5.4g")
Change (i.e. set) the format for printing fit parameters in statistics box.
void SetParent(TObject *obj) override
A Pave (see TPave) with text, lines or/and boxes inside.
virtual TText * AddText(Double_t x1, Double_t y1, const char *label)
Add a new Text line to this pavetext at given coordinates.
void Clear(Option_t *option="") override
Clear all lines in this pavetext.
virtual TText * GetLine(Int_t number) const
Get Pointer to line number in this pavetext.
A TBox with a bordersize and a shadow option.
virtual void SetY1NDC(Double_t y1)
virtual void ConvertNDCtoPad()
Convert pave coordinates from NDC to Pad coordinates.
virtual void SetName(const char *name="")
virtual void SetBorderSize(Int_t bordersize=4)
Sets the border size of the TPave box and shadow.
virtual void SetY2NDC(Double_t y2)
virtual void SetX1NDC(Double_t x1)
virtual void SetX2NDC(Double_t x2)
A TScatter is able to draw four variables scatter plot on a single plot.
TGraph * GetGraph() const
Get the graph holding X and Y positions.
TH2F * GetHistogram() const
Get the graph histogram used for drawing axis.
void ToLower()
Change string to lower-case.
Bool_t EndsWith(const char *pat, ECaseCompare cmp=kExact) const
Return true if string ends with the specified string.
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
const char * Data() const
void Resize(Ssiz_t n)
Resize the string. Truncate or add blanks as necessary.
Ssiz_t Last(char c) const
Find last occurrence of a character c.
void ToUpper()
Change string to upper case.
UInt_t Hash(ECaseCompare cmp=kExact) const
Return hash value.
TString & Append(const char *cs)
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Color_t GetStatTextColor() const
Int_t GetOptTitle() const
Float_t GetStatFontSize() const
Float_t GetPadRightMargin() const
Style_t GetTitleFont(Option_t *axis="X") const
Return title font.
Color_t GetTitleFillColor() const
Style_t GetTitleStyle() const
Color_t GetStatColor() const
Width_t GetTitleBorderSize() const
Width_t GetStatBorderSize() const
Color_t GetTitleTextColor() const
Style_t GetStatStyle() const
const char * GetFitFormat() const
const char * GetStatFormat() const
Style_t GetStatFont() const
Float_t GetTitleFontSize() const
virtual Bool_t ExpandPathName(TString &path)
Expand a pathname getting rid of special shell characters like ~.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual void Sleep(UInt_t milliSec)
Sleep milliSec milli seconds.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
static Long_t SelfId()
Static method returning the id for the current thread.
Handles synchronous and a-synchronous timer events.
virtual void TurnOn()
Add the timer to the system timer list.
void SetTime(Long_t milliSec)
static TView * CreateView(Int_t system=1, const Double_t *rmin=nullptr, const Double_t *rmax=nullptr)
Create a concrete default 3-d view via the plug-in manager.
virtual void SetAutoRange(Bool_t autorange=kTRUE)=0
TVirtualPS is an abstract interface to Postscript, PDF, SVG.
To make it possible to use GL for 2D graphic in a TPad/TCanvas.
small helper class to store/restore gPad context in TPad methods
TVirtualPad is an abstract base class for the Pad and Canvas classes.
Semi-Abstract base class defining a generic interface to the underlying, low level,...
void SetSlow(Bool_t slow=kTRUE)
TWebCanvasTimer(TWebCanvas &canv)
void Timeout() override
used to send control messages to clients
Basic TCanvasImp ABI implementation for Web-based Graphics Provides painting of main ROOT classes in ...
TVirtualPadPainter * CreatePadPainter() override
Creates web-based pad painter.
void ForceUpdate() override
Increment canvas version and force sending data to client - do not wait for reply.
static void AddCustomClass(const std::string &clname, bool with_derived=false)
Assign custom class.
static TString CreatePadJSON(TPad *pad, Int_t json_compression=0, Bool_t batchmode=kFALSE)
Create JSON painting output for given pad Produce JSON can be used for offline drawing with JSROOT.
void SetCanvasSize(UInt_t w, UInt_t h) override
Set canvas size of web canvas.
UInt_t fColorsHash
! last hash of colors/palette
Int_t fTF1UseSave
! use save buffer for TF1/TF2, 0:off, 1:prefer, 2:force
void ShowCmd(const std::string &arg, Bool_t show)
Function used to send command to browser to toggle menu, toolbar, editors, ...
Long64_t fColorsVersion
! current colors/palette version, checked every time when new snapshot created
virtual Bool_t IsReadOnly() const
std::shared_ptr< ROOT::RWebWindow > fWindow
virtual Bool_t IsJSSupportedClass(TObject *obj, Bool_t many_primitives=kFALSE)
Returns kTRUE when object is fully supported on JSROOT side In ROOT7 Paint function will just return ...
void AddCtrlMsg(unsigned connid, const std::string &key, const std::string &value)
Add control message for specified connection Same control message can be overwritten many time before...
static void SetCustomScripts(const std::string &src)
Configures custom script for canvas.
ObjectSelectSignal_t fObjSelectSignal
! signal emitted when new object selected in the pad
PadClickedSignal_t fPadClickedSignal
! signal emitted when simple mouse click performed on the pad
void SetLongerPolling(Bool_t on)
UInt_t fStyleHash
! last hash of gStyle
virtual Bool_t CanCreateObject(const std::string &)
void ShowWebWindow(const ROOT::RWebDisplayArgs &user_args="")
Show canvas in specified place.
Int_t fPrimitivesMerge
! number of PS primitives, which will be merged together
void Show() override
Show canvas in browser window.
Bool_t WaitWhenCanvasPainted(Long64_t ver)
Wait when specified version of canvas was painted and confirmed by browser.
static UInt_t gBatchImageMode
! configured batch size
static std::string gCustomScripts
! custom JavaScript code or URL on JavaScript files to load before start drawing
Bool_t IsAsyncMode() const
UInt_t CalculateColorsHash()
Calculate hash function for all colors and palette.
void SetWindowGeometry(const std::vector< int > &arr)
Set window geometry as array with coordinates and dimensions.
Bool_t HasStatusBar() const override
Returns kTRUE if web canvas has status bar.
static std::vector< std::string > gCustomClasses
! list of custom classes, which can be delivered as is to client
void Close() override
Close web canvas - not implemented.
static bool ProduceImages(std::vector< TPad * > pads, const char *filename, Int_t width=0, Int_t height=0)
Create images for several pads using batch (headless) capability of Chrome or Firefox browsers Suppor...
Bool_t HasMenuBar() const override
Returns kTRUE if web canvas has menu bar.
Int_t InitWindow() override
Initialize window for the web canvas At this place canvas is not yet register to the list of canvases...
void CheckPadModified(TPad *pad)
Returns true if any pad in the canvas were modified Reset modified flags, increment canvas version (i...
void RaiseWindow() override
Raise browser window.
static bool ProduceImage(TPad *pad, const char *filename, Int_t width=0, Int_t height=0)
Create image using batch (headless) capability of Chrome or Firefox browsers Supported png,...
void ActivateInEditor(TPad *pad, TObject *obj)
Activate object in editor in web browser.
std::vector< WebConn > fWebConn
! connections
PadSignal_t fActivePadChangedSignal
! signal emitted when active pad changed in the canvas
Bool_t GetLongerPolling() const
UInt_t fClientBits
! latest status bits from client like editor visible or not
std::function< void(TPadWebSnapshot *)> PadPaintingReady_t
Function called when pad painting produced.
Int_t fPaletteDelivery
! colors palette delivery 0:never, 1:once, 2:always, 3:per subpad
Bool_t fProcessingData
! flag used to prevent blocking methods when process data is invoked
Bool_t HasToolTips() const override
Returns kTRUE if tooltips are activated in web canvas.
std::vector< TPad * > fAllPads
! list of all pads recognized during streaming
friend class TWebCanvasTimer
TWebCanvasTimer * fTimer
! timer to submit control messages
static std::vector< std::string > gBatchJsons
! converted jsons batch job
Long64_t fCanvVersion
! actual canvas version, changed with every new Modified() call
std::vector< int > fWindowGeometry
! last received window geometry
TPad * ProcessObjectOptions(TWebObjectOptions &item, TPad *pad, int idcnt=1)
Process data for single primitive Returns object pad if object was modified.
void CreateObjectSnapshot(TPadWebSnapshot &master, TPad *pad, TObject *obj, const char *opt, TWebPS *masterps=nullptr)
Creates representation of the object for painting in web browser.
std::map< TObject *, bool > fUsedObjs
! map of used objects during streaming
void AddColorsPalette(TPadWebSnapshot &master)
Add special canvas objects with list of colors and color palette.
Long64_t fStyleVersion
! current gStyle object version, checked every time when new snapshot created
static std::string gBatchMultiPdf
! name of current multi-page pdf file
static void BatchImageMode(UInt_t n=100)
Configure batch image mode for web graphics.
std::vector< std::unique_ptr< ROOT::RWebDisplayHandle > > fHelpHandles
! array of handles for help widgets
void AddSendQueue(unsigned connid, const std::string &msg)
Add message to send queue for specified connection If connid == 0, message will be add to all connect...
void SetWindowPosition(Int_t x, Int_t y) override
Set window position of web canvas.
UpdatedSignal_t fUpdatedSignal
! signal emitted when canvas updated or state is changed
Int_t fJsonComp
! compression factor for messages send to the client
static std::vector< int > gBatchWidths
! batch job widths
~TWebCanvas() override
Destructor.
static std::string ProcessCustomScripts(bool batch)
For batch mode special handling of scripts are required Headless browser not able to load modules fro...
Bool_t fReadOnly
!< configured display
std::map< TPad *, PadStatus > fPadsStatus
! map of pads in canvas and their status flags
static Font_t AddFont(const char *name, const char *ttffile, Int_t precision=2)
Add font to static list of fonts supported by the canvas Name specifies name of the font,...
void AddCustomFonts(TPadWebSnapshot &master)
Add special canvas objects with custom fonts.
Bool_t CheckDataToSend(unsigned connid=0)
Check if any data should be send to client If connid != 0, only selected connection will be checked.
Bool_t PerformUpdate(Bool_t async) override
if canvas or any subpad was modified, scan all primitives in the TCanvas and subpads and convert them...
void AssignStatusBits(UInt_t bits)
Assign clients bits.
virtual Bool_t ProcessData(unsigned connid, const std::string &arg)
Handle data from web browser Returns kFALSE if message was not processed.
void ProcessLinesForObject(TObject *obj, const std::string &lines)
Execute one or several methods for selected object String can be separated by ";;" to let execute sev...
TWebCanvas(TCanvas *c, const char *name, Int_t x, Int_t y, UInt_t width, UInt_t height, Bool_t readonly=kTRUE)
Constructor.
static std::vector< int > gBatchHeights
! batch job heights
static Int_t StoreCanvasJSON(TCanvas *c, const char *filename, const char *option="")
Create JSON painting output for given canvas and store into the file See TBufferJSON::ExportToFile() ...
static const std::string & GetCustomScripts()
Returns configured custom script.
void Iconify() override
Iconify browser window.
void SetWindowTitle(const char *newTitle) override
Set window title of web canvas.
UInt_t GetWindowGeometry(Int_t &x, Int_t &y, UInt_t &w, UInt_t &h) override
Returns window geometry including borders and menus.
static std::vector< std::string > gBatchFiles
! file names for batch job
static TCanvasImp * NewCanvas(TCanvas *c, const char *name, Int_t x, Int_t y, UInt_t width, UInt_t height)
Static method to create TWebCanvas instance Used by plugin manager.
static TString CreateCanvasJSON(TCanvas *c, Int_t json_compression=0, Bool_t batchmode=kFALSE)
Create JSON painting output for given canvas Produce JSON can be used for offline drawing with JSROOT...
Bool_t HasEditor() const override
Returns kTRUE if web canvas has graphical editor.
Int_t fStyleDelivery
! gStyle delivery to clients: 0:never, 1:once, 2:always
PadClickedSignal_t fPadDblClickedSignal
! signal emitted when simple mouse click performed on the pad
void ProcessExecs(TPad *pad, TExec *extra=nullptr)
Process TExec objects in the pad.
static bool FlushBatchImages()
Flush batch images.
void CreatePadSnapshot(TPadWebSnapshot &paddata, TPad *pad, Long64_t version, PadPaintingReady_t func)
Create snapshot for pad and all primitives Callback function is used to create JSON in the middle of ...
Bool_t CheckCanvasModified(bool force_modified=false)
Check if any pad on the canvas was modified If yes, increment version of correspondent pad Returns tr...
virtual Bool_t DecodePadOptions(const std::string &, bool process_execs=false)
Decode all pad options, which includes ranges plus objects options.
Int_t GetPaletteDelivery() const
void SetWindowSize(UInt_t w, UInt_t h) override
Set window size of web canvas.
static bool IsCustomClass(const TClass *cl)
Checks if class belongs to custom.
TObject * FindPrimitive(const std::string &id, int idcnt=1, TPad *pad=nullptr, TObjLink **objlnk=nullptr, TPad **objpad=nullptr)
Search of object with given id in list of primitives One could specify pad where search could be star...
Bool_t fFixedSize
! is canvas size fixed
Int_t GetStyleDelivery() const
Class used to transport drawing options from the client.
std::vector< double > fopt
custom float array
std::string fcust
custom string
std::string snapid
id of the object
std::string opt
drawing options
Bool_t IsEmptyPainting() const
TWebPainting * TakePainting()
TWebPainting * GetPainting()
Implement TVirtualPadPainter which abstracts painting operations.
Object used to store paint operations and deliver them to JSROOT.
void AddColor(Int_t indx, TColor *col)
Add custom color to operations.
void AddOper(const std::string &oper)
Add next custom operator to painting Operations are separated by semicolons Following operations are ...
@ kSVG
list of SVG primitives
@ kColors
list of ROOT colors + palette
void SetSnapshot(Int_t kind, TObject *snapshot, Bool_t owner=kFALSE)
SetUse pointer to assign object id - TString::Hash.
void SetObjectIDAsPtr(void *ptr, const std::string &suffix="")
Use pointer to assign object id - TString::Hash.
LongDouble_t Power(LongDouble_t x, LongDouble_t y)
Returns x raised to the power y.
bool _detected
! if pad was detected during last scan
WebFont_t(Int_t indx, const TString &name, const TString &fmt, const TString &data)