Added basic chart to demo

Summary:
Added demo to show how DataSource can power charts using event sampling and smart windowing.

A more experimental application: use dataSource to power some charts, that leverages the events emitted from an datasource that is continuously being appended:

- incoming events are downsampled 1 in 100 to build up the bottom window
- incoming events are not downsampled to render the topwindow, but since datasource views will ignore events outside the window, things will stay pretty responsive when a window is selected (without a window, the downsampled dataset is used as source for top chart as well).

Compared to a naive (well still slightly optimised with useFastArray) implementation that throws all incoming event in a big array, it performs > 20 times faster (see difference in amount of events processed)

Reviewed By: passy

Differential Revision: D28474409

fbshipit-source-id: 6a7973d1ade3053b1d6c8f72069697d96b1ef4fd
This commit is contained in:
Michel Weststrate
2021-05-18 08:44:47 -07:00
committed by Facebook GitHub Bot
parent 3b6b684f10
commit f0f54b19b9

View File

@@ -489,9 +489,7 @@ class DataSourceView<T> {
this.windowEnd = end; this.windowEnd = end;
} }
public setListener( public setListener(listener?: (change: OutputChange) => void) {
listener: typeof DataSourceView['prototype']['outputChangeListener'],
) {
if (this.outputChangeListener && listener) { if (this.outputChangeListener && listener) {
console.warn('outputChangeListener already set'); console.warn('outputChangeListener already set');
} }