Skip to content

Commit 000c559

Browse files
author
Niilo Keinänen
committed
LCJS v8.0.0
1 parent 6cb7bbf commit 000c559

File tree

3 files changed

+7
-22
lines changed

3 files changed

+7
-22
lines changed

README.md

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

5858

59-
[Data Grid]: https://lightningchart.com/js-charts/api-documentation/v7.1.0/classes/DataGrid.html
60-
[Chart XY]: https://lightningchart.com/js-charts/api-documentation/v7.1.0/classes/ChartXY.html
59+
[Data Grid]: https://lightningchart.com/js-charts/api-documentation/v8.0.0/classes/DataGrid.html
60+
[Chart XY]: https://lightningchart.com/js-charts/api-documentation/v8.0.0/classes/ChartXY.html
6161

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"webpack-stream": "^7.0.0"
1818
},
1919
"dependencies": {
20-
"@lightningchart/lcjs": "^7.1.0",
21-
"@lightningchart/xydata": "^1.4.0"
20+
"@lightningchart/lcjs": "^8.0.0",
21+
"@lightningchart/xydata": "^1.5.0"
2222
},
2323
"lightningChart": {
2424
"eID": "1302"

src/index.js

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const {
77
emptyLine,
88
synchronizeAxisIntervals,
99
lightningChart,
10-
LegendBoxBuilders,
1110
UIElementBuilders,
1211
UIOrigins,
1312
emptyFill,
@@ -47,16 +46,10 @@ const dataGrid = dashboard
4746
.setColumnContent(0, ['', ...exampleTrends.map((trend) => trend.name)])
4847
.setRowContent(0, ['', 'Latest value', 'Previous value', 'value 15 s'])
4948

50-
const seriesXYList = exampleTrends.map((trend) =>
51-
chartXY
52-
.addPointLineAreaSeries({ dataPattern: 'ProgressiveX' })
53-
.setAreaFillStyle(emptyFill)
54-
.setMaxSampleCount(50_000)
55-
.setName(trend.name),
56-
)
49+
const seriesXYList = exampleTrends.map((trend) => chartXY.addLineSeries({}).setMaxSampleCount(50_000).setName(trend.name))
5750
const axisX = chartXY
5851
.getDefaultAxisX()
59-
.setScrollStrategy(AxisScrollStrategies.progressive)
52+
.setScrollStrategy(AxisScrollStrategies.scrolling)
6053
.setDefaultInterval((state) => ({ end: state.dataMax, start: (state.dataMax ?? 0) - 60 * 1000, stopAxisAfter: false }))
6154
.setTickStrategy(AxisTickStrategies.Time)
6255

@@ -68,14 +61,6 @@ const axisXTop = chartXY
6861
synchronizeAxisIntervals(axisX, axisXTop)
6962
const indicator15s = axisXTop.addCustomTick(UIElementBuilders.AxisTickMajor).setTextFormatter((_) => '-15 s')
7063

71-
const legend = chartXY.addLegendBox(LegendBoxBuilders.HorizontalLegendBox, chartXY.coordsRelative).add(chartXY)
72-
chartXY.addEventListener('layoutchange', (event) => {
73-
legend.setOrigin(UIOrigins.CenterBottom).setPosition({
74-
x: event.margins.left + event.viewportWidth / 2,
75-
y: event.margins.bottom,
76-
})
77-
})
78-
7964
const theme = dashboard.getTheme()
8065
const textFillGood = theme.examples.positiveTextFillStyle
8166
const textFillBad = theme.examples.negativeTextFillStyle
@@ -100,7 +85,7 @@ Promise.all(
10085
const streamOneSample = (sample, isFirst) => {
10186
const tNow = Date.now()
10287

103-
seriesXYList.forEach((series, iTrend) => series.add({ x: tNow - tStart, y: sample[iTrend] }))
88+
seriesXYList.forEach((series, iTrend) => series.appendSample({ x: tNow - tStart, y: sample[iTrend] }))
10489

10590
if (isFirst) {
10691
trendsHistory.forEach((trendHistory, iTrend) => {

0 commit comments

Comments
 (0)