Sorry if I missed something obvious. The README file contains an example that shows how to draw multiple objects from the same ROOT file in the same canvas, but I can’t figure out how to do the same for two objects which are taken from different sources, e.g.:
import { draw, httpRequest } from 'https://root.cern/js/latest/modules/main.mjs';
let obj1 = await httpRequest(URL1, 'object');
let obj2 = await httpRequest(URL2, 'object');
// draw('drawing', obj, 'hist');
// the line above can draw one object, but how can I draw both obj1 and ob2 in the same 'drawing' div?
Thank you for the quick reply. In fact that was the first thing that I tried out. The first histogram object was successfully drawn, but after I called draw() function second time with ‘hist same’ option I got completely empty blanc canvas. If I pressed the right mouse button anywhere in this canvas I got a drop-down TCanvas menu so the canvas is there but it contains nothing.
UPD: I don’t know if this is related but I got the following error in JS console when drawing second histogram:
Error funcs.grx is not a function at TypeError: funcs.grx is not a function
at TH1Painter.drawNormal (TH1Painter.mjs:653:33)
at TH1Painter.draw1DBins (TH1Painter.mjs:831:19)
at TH1Painter.mjs:1223:33
at async ~/:17:7
Thank you for looking into this. I’m very glad that the feature works and I’ll appreciate if you could tell me what’s wrong with my histograms, which I attached to this message as a tarball (this Web page doesn’t allow me to attach json files (.
Many thanks, this works like a charm.
May I ask you one more question. I want to display in a Web page a few histograms, which are being constantly updated, so I’m planing to redraw them periodically. If the user of the Web page changes some visualisation parameters, e.g. set the log scale to one of the axes, changed position of the stat box, increased font size, etc., is there a way to preserve all these changes when drawing a new version of the same histogram?