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 ) )
5750const 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
6861synchronizeAxisIntervals ( axisX , axisXTop )
6962const 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-
7964const theme = dashboard . getTheme ( )
8065const textFillGood = theme . examples . positiveTextFillStyle
8166const 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