mirror of
https://github.com/grafana/grafana.git
synced 2024-11-22 08:56:43 -06:00
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:
parent
0a8eae2c12
commit
af6893e41d
@ -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);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user