facets icon indicating copy to clipboard operation
facets copied to clipboard

Accept JSON data on <facets-overview> component

Open rgbkrk opened this issue 8 years ago • 8 comments

Would there be a way to use the <facets-overview> component without creating a protobuf? I'd love if there could be some default inference, taking data= in the same way the <facets-dive> works.

rgbkrk avatar Jul 19 '17 21:07 rgbkrk

Something similar is supported now but still needs documenting. The facets-overview element has a method getStatsProto that accepts an array of objects where each object is a dict of features to values (so it accepts json when it is an array of flat objects) which returns the calculated proto which can then be provided as the protoInput param on the element.

Does that work for your use case?

jameswex avatar Jul 20 '17 00:07 jameswex

You can see it being used on the gh-pages branch which contains the demo site's code: https://github.com/PAIR-code/facets/blob/gh-pages/index.html#L237

jameswex avatar Jul 20 '17 00:07 jameswex

Trying that out now, getting a long line of blue squares. 😉

screen shot 2017-07-19 at 6 30 26 pm

rgbkrk avatar Jul 20 '17 01:07 rgbkrk

In case you're curious, I was playing with this here: https://github.com/nteract/commuter/pull/211

rgbkrk avatar Jul 20 '17 01:07 rgbkrk

Were you able to get overview working with the getStatsProto method to convert an array of data item dicts into the feature stats proto?

jameswex avatar Jul 24 '17 23:07 jameswex

Nope.

rgbkrk avatar Jul 25 '17 00:07 rgbkrk

Not sure what those crazy blue squares are (is the facets-overview element taking up a reasonable width and height?), but if the getStatsProto method is returning a valid proto object, then setting the protoInput property on the polymer element to that proto should be all it takes. At first glance, the code you linked to seems reasonable, although I'm not familiar with react.

jameswex avatar Jul 25 '17 00:07 jameswex

Because facets-overview supports multiple sources of data, getStatsProto takes an array of data in a format of:

[ {data: [], name: 'test.csv'}, {data: [], name: 'test2.csv'} ]

where the array in data has the same json data format that is used for facets-dive.

kelvinau avatar May 23 '18 22:05 kelvinau