简体   繁体   中英

How google facets visualization tool can be embed into web page

I'm referring to the source project from facets

I'm using Ubuntu 17.10

As per the instructions, I've installed bazel build and run the facets in my local by referring quick demo for facets demo using jupyter notebook.

Visualizations are shown here

I want the visualization would be embedded on a web page

Have you seen this part of their README: https://github.com/PAIR-code/facets/blob/master/facets_dive/README.md#embedding-dive-in-your-page

The project is built with Bazel. Make sure you have installed Bazel and run the Bazel BUILD files prior to proceeding. Provided you've loaded the Polymer element, you can insert an instance into your page like so.

<facets-dive></facets-dive>

To set the data, you'll need to add a little JavaScript. In your code, first get a reference to this DOM element, then assign your array of objects to the data attribute.

const vis = document.querySelector('facets-dive');
vis.data = [ ... your data ... ];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM