JSRoot plotting datasets against each other

Is it possible to, having access to a root dataset, plot two variables against each other using only JSRoot? Or would I have to use root to plot the variables against each other, and then have JSRoot output the resultant graph?
Thank you.

Hi,

Here is several examples how TTree::Draw - like expression can be performed in JSROOT:

https://root.cern/js/latest/examples.htm#ttree_2d

And here is brief docu:

Regards,
Sergey

Thanks Sergey!
I was able to plot what I wanted using the following syntax:

  var filename1 = "https://root.cern/js/files/hsimple.root"

     JSROOT.OpenFile(filename1, function(file){
        file.ReadObject("ntuple;1", function(obj) {
            JSROOT.draw("drawing1", obj, "px:py");
	});
     });

My follow up question is whether it is possible to do something similar if the variables px and py are coming from different trees in a root file (or even different root files). Would the TSelector class be the best way of doing this?

All the best,
-Steve

Normally one process data from the same TTree - see docu and examples here:

But because of asynchronous API it is very difficult to use data from different TTree objects.
Main problem - there is no GetEntry() method in JSROOT.
For such complex tasks I recommend to use ROOT functionality - primary goal of JSROOT is display data, but not make complex evaluation in browser.

Regards,
Sergey