Fix documentation for streaming data sources (#30704)

The added code is now mandatory since 7.4.x
See https://github.com/grafana/grafana/issues/30686
This commit is contained in:
Fabien Wernli 2021-01-28 13:35:49 +01:00 committed by GitHub
parent 0a8eae2c12
commit af6893e41d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,6 +75,10 @@ Grafana uses [RxJS](https://rxjs.dev/) to continuously send data from a data sou
1. Use `subscriber.next()` to send the updated data frame whenever you receive new updates. 1. Use `subscriber.next()` to send the updated data frame whenever you receive new updates.
```ts
import { LoadingState } from '@grafana/data';
```
```ts ```ts
const intervalId = setInterval(() => { const intervalId = setInterval(() => {
frame.add({ time: Date.now(), value: Math.random() }); frame.add({ time: Date.now(), value: Math.random() });
@ -82,6 +86,7 @@ Grafana uses [RxJS](https://rxjs.dev/) to continuously send data from a data sou
subscriber.next({ subscriber.next({
data: [frame], data: [frame],
key: query.refId, key: query.refId,
state: LoadingState.Streaming,
}); });
}, 500); }, 500);