Skip to content

Commit b9229ad

Browse files
author
Niilo Keinänen
committed
LCJS v8.1.0
1 parent 80d7cee commit b9229ad

File tree

7 files changed

+20
-21
lines changed

7 files changed

+20
-21
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ Direct developer email support can be purchased through a [Support Plan][4] or b
5555
© LightningChart Ltd 2009-2025. All rights reserved.
5656

5757

58-
[XY cartesian chart]: https://lightningchart.com/js-charts/api-documentation/v8.0.1/classes/ChartXY.html
59-
[Line series]: https://lightningchart.com/js-charts/api-documentation/v8.0.1/classes/LineSeries.html
60-
[Data patterns]: https://lightningchart.com/js-charts/api-documentation/v8.0.1/interfaces/DataPattern.html
58+
[XY cartesian chart]: https://lightningchart.com/js-charts/api-documentation/v8.1.0/classes/ChartXY.html
59+
[Line series]: https://lightningchart.com/js-charts/api-documentation/v8.1.0/classes/PointLineAreaSeries.html
60+
[Data patterns]: https://lightningchart.com/js-charts/api-documentation/v8.1.0/types/DataPattern.html
6161
[Progressive trace data generator]: https://lightning-chart.github.io/xydata/classes/progressivetracegenerator.html
6262

ecg-cyberSpace.png

5.47 KB
Loading

ecg-darkGold.png

1.25 KB
Loading

ecg-light.png

2.8 KB
Loading

ecg-lightNature.png

6.72 KB
Loading

ecg-turquoiseHexagon.png

-1.23 KB
Loading

src/index.js

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,9 @@
44
// Import LightningChartJS
55
const lcjs = require('@lightningchart/lcjs')
66

7-
// Import xydata
8-
const xydata = require('@lightningchart/xydata')
9-
107
// Extract required parts from LightningChartJS.
118
const { lightningChart, AxisScrollStrategies, emptyFill, Themes } = lcjs
129

13-
// Import data-generators from 'xydata'-library.
14-
const { createSampledDataGenerator } = xydata
15-
1610
// Create a XY Chart.
1711
const chart = lightningChart({
1812
resourcesBaseUrl: new URL(document.head.baseURI).origin + new URL(document.head.baseURI).pathname + 'resources/',
@@ -1632,16 +1626,21 @@ const point = [
16321626
{ x: 1586, y: 94 },
16331627
{ x: 1587, y: 82 },
16341628
]
1635-
// Create a data generator to supply a continuous stream of data.
1636-
createSampledDataGenerator(point, 1, 10)
1637-
.setSamplingFrequency(1)
1638-
.setInputData(point)
1639-
.generate()
1640-
.setStreamBatchSize(48)
1641-
.setStreamInterval(50)
1642-
.setStreamRepeat(true)
1643-
.toStream()
1644-
.forEach((point) => {
1645-
// Push the created points to the series.
1646-
series.appendSample({ x: point.timestamp, y: point.data.y })
1629+
1630+
let i = 0
1631+
let prev = performance.now()
1632+
const stream = () => {
1633+
const now = performance.now()
1634+
const delta = Math.min(now - prev, 1000)
1635+
prev = now
1636+
const pCount = Math.round((1000 * delta) / 1000)
1637+
const points = new Array(pCount).fill(0).map((_, ii) => {
1638+
const sample = point[(i + ii) % point.length]
1639+
sample.x = i + ii
1640+
return sample
16471641
})
1642+
i += pCount
1643+
series.appendJSON(points)
1644+
requestAnimationFrame(stream)
1645+
}
1646+
stream()

0 commit comments

Comments
 (0)