Skip to content

Commit cb9ea31

Browse files
committed
before v1.0.0
1 parent 38f9f75 commit cb9ea31

File tree

2 files changed

+28
-28
lines changed

2 files changed

+28
-28
lines changed

README.md

+24-24
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ npm install stream-charts
3030

3131
For the neuron raster chart (see [example](https://github.com/robphilipp/stream-charts-examples/blob/master/src/app/examples/StreamingRasterChart.tsx))
3232

33-
```typescript
33+
```typescript jsx
3434
import {RasterChart} from "stream-charts";
35-
.
36-
.
37-
.
35+
// .
36+
// .
37+
// .
3838
<RasterChart
3939
width={plotWidth}
4040
height={seriesHeight}
@@ -56,11 +56,11 @@ import {RasterChart} from "stream-charts";
5656

5757
and for the scatter chart (see [example](https://github.com/robphilipp/stream-charts-examples/blob/master/src/app/examples/StreamingScatterChart.tsx))
5858

59-
```typescript
59+
```typescript jsx
6060
import {ScatterChart} from "stream-charts";
61-
.
62-
.
63-
.
61+
// .
62+
// .
63+
// .
6464
<ScatterChart
6565
width={plotWidth}
6666
height={plotHeight}
@@ -117,15 +117,15 @@ Except for the plot height and width, *style* properties are optional. Style pro
117117

118118
All the optional *style* properties have defaults (the defaults look like the example charts above). The defaults can be overridden by specifying the properties you would like to change. For example, if you would like to change only the size of the font used for the axes labels, then you can specify the property as,
119119

120-
```typescript
120+
```typescript jsx
121121
<ScatterChart
122-
.
123-
.
124-
.
122+
// .
123+
// .
124+
// .
125125
axisLabelFont={{color: 'blue'}}
126-
.
127-
.
128-
.
126+
// .
127+
// .
128+
// .
129129
/>
130130
```
131131

@@ -155,7 +155,7 @@ The *data* properties define the data source, processing, and constraints.
155155

156156
##### Understanding the time-window
157157

158-
These charts have been develop to be used with high-frequency dynamic data that my run for a considerable amount of time. For example, you may stream in data for a few hundred seconds, and have the plot show the last 10 seconds worth of data. To achieve this you use the `timeWindow` property. Because you want to see the most recent 10 seconds of data, you set the time-window property to 10,000 ms (`timeWindow={10000}`). The charts use the time-window property and the current simulation time to show the most recent `timeWindow` milliseconds of data (in our example, the past 10 seconds). This causes the data to "slide" to the left after `timeWindow` has elapsed.
158+
These charts have been developed to be used with high-frequency dynamic data that my run for a considerable amount of time. For example, you may stream in data for a few hundred seconds, and have the plot show the last 10 seconds worth of data. To achieve this you use the `timeWindow` property. Because you want to see the most recent 10 seconds of data, you set the time-window property to 10,000 ms (`timeWindow={10000}`). The charts use the time-window property, and the current simulation time, to show the most recent `timeWindow` milliseconds of data (in our example, the past 10 seconds). This causes the data to "slide" to the left after `timeWindow` has elapsed.
159159

160160
#### enhancements
161161

@@ -192,7 +192,7 @@ By default, when the charts mount, they subscribe to the specified observable. T
192192
193193
You hand the `stream-charts` an [Observable](https://rxjs-dev.firebaseapp.com/api/index/class/Observable). This defines how (i.e. the pipeline) the data is generated. Only upon subscription does data flow through this pipeline. The rxjs `Observable.subscribe(...)` function returns a [Subscription](https://rxjs-dev.firebaseapp.com/api/index/class/Subscription) that can be used to stop the data.
194194

195-
An example of an observable can be found in the [randomSpikeDataObservable(...)](src/app/examples/randomData.ts) function.
195+
An example of an observable can be found in the [randomSpikeDataObservable(...)](./src/app/examples/randomData.ts) function.
196196

197197
One reason to provide an `onSubscription` callback is so that you have a handle on the subscription so that you can stop the data. For example, you may want to provide the user of your application a button to stop the data. Or, you may wish to stop the simulation after a certain period of time.
198198

@@ -210,18 +210,18 @@ If you are only interested in the current time, you can use the `onUpdateTime` c
210210
211211
When the time associated with the data in the stream changes, this callback provides a hook into that time. In the [StreamingScatterChart](src/app/examples/StreamingScatterChart.tsx), for example, this callback is used to stop the random data after 1 second (1000 ms) by cancelling the subscription.
212212

213-
```typescript
213+
```typescript jsx
214214
<ScatterChart
215-
.
216-
.
217-
.
215+
// .
216+
// .
217+
// .
218218
onSubscribe={subscription => subscriptionRef.current = subscription}
219219
onUpdateTime={(t: number) => {
220220
if(t > 1000) subscriptionRef.current!.unsubscribe()
221221
}}
222-
.
223-
.
224-
.
222+
// .
223+
// .
224+
// .
225225
/>
226226
```
227227

src/app/charts/RasterChart.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { TimeRange, TimeRangeType } from "./timeRange";
66
import { adjustedDimensions, Margin, PlotDimensions } from "./margins";
77
import { Datum, emptySeries, PixelDatum, Series } from "./datumSeries";
88
import { defaultTooltipStyle, TooltipStyle } from "./TooltipStyle";
9-
import { fromEvent, Observable, Subscription } from "rxjs";
9+
import {fromEvent, noop, Observable, Subscription} from "rxjs";
1010
import { ChartData } from "./chartData";
1111
import { throttleTime, windowTime } from "rxjs/operators";
1212
import { defaultTrackerStyle, TrackerStyle } from "./TrackerStyle";
@@ -122,9 +122,9 @@ export function RasterChart(props: Props): JSX.Element {
122122
seriesObservable,
123123
windowingTime = 100,
124124
shouldSubscribe = true,
125-
onSubscribe = (_: Subscription) => { },
126-
onUpdateData = () => { },
127-
onUpdateTime = (_: number) => { },
125+
onSubscribe = noop,
126+
onUpdateData = noop,
127+
onUpdateTime = noop,
128128
filter = /./,
129129
timeWindow,
130130
dropDataAfter = Infinity,

0 commit comments

Comments
 (0)