Integrating R view with Javascript

LabKey Support Forum (Inactive)
Integrating R view with Javascript jeckels  2013-11-12 12:13
Status: Closed
 
Hi Bront,

Yes, you'll want to use LABKEY.WebPart instead, with a partName of 'Report'. Here's an example:

    function refreshChart() {
        var config = {reportId: '101', showSection: 'labkeyl_png'};

        var wikiWebPartRenderer = new LABKEY.WebPart( {
            partName: 'Report',
            renderTo: 'histogramDiv',
            frame: 'none',
            partConfig: config
        });
        wikiWebPartRenderer.render();
    }

You can get the reportId from the URL when you're editing the R view. The format depends on whether it's stored in the database (as it is when it's created through the user interface), or from a file in a module.

You can view the example in action here:

https://www.labkey.org/Wiki/home/CPAS/demo/page.view?name=Fractional%20Delta%20Mass

You can either just view the page's source code via your browser, or download the files from here:

https://www.labkey.org/FileContent/home/CPAS/demo/begin.view

Thanks,
Josh