Skip to content

Commit 2dbe7ee

Browse files
committed
LCJS 3.0.0
1 parent 8f94c25 commit 2dbe7ee

File tree

4 files changed

+50
-60
lines changed

4 files changed

+50
-60
lines changed

1mPointsLineTrace.png

-7.58 KB
Loading

README.md

Lines changed: 37 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -19,32 +19,46 @@ The demo can be used as an example or a seed project. Local execution requires t
1919

2020
## Description
2121

22-
This example plots a million data points using progressive line series.
22+
This example plots a million data points in an instant using line series.
2323

24-
## Progressive series
24+
## Progressive data optimizations
2525

26-
Progressive series are highly optimized series for the rendering of high-volume and high-density data while keeping full interactivity.
27-
These optimizations are enabled by selecting a ***DataPattern***, which needs to be specified during the creation of the series instance and cannot be changed further for performance related reasons.
26+
By default, `LineSeries` can take list of XY coordinates in any order, connecting them with a line stroke.
27+
However, in a lot of applications, the input data comes in a distinct order, for example, X coordinates describe a timestamp which increases between each consecutive data point. We refer to this as a *progressive data pattern*.
2828

29-
The ***DataPatterns***-collections object contains all different directions for progressive data patterns:
30-
- Select ***DataPatterns.horizontalProgressive*** to handle horizontal progressive datasets efficiently.
31-
- Select ***DataPatterns.horizontalRegressive*** to handle horizontal regressive datasets efficiently.
32-
- Select ***DataPatterns.verticalProgressive*** to handle vertical progressive datasets efficiently.
33-
- Select ***DataPatterns.verticalRegressive*** to handle vertical regressive datasets efficiently.
29+
`LineSeries` is coupled together with highly sophisticated optimizations that can be enabled in applications where input data follows a *data pattern*. This example showcases the `'ProgressiveX'` *pattern*.
3430

35-
```javascript
36-
// Create line series optimized for horizontally progressive data.
37-
const series = chart.addLineSeries(
38-
// Using the DataPatterns object to select the certain pattern for the line series.
39-
{ dataPattern: DataPatterns.horizontalProgressive }
40-
)
31+
### Enabling data pattern optimizations
32+
33+
*Data pattern* must be specified when the *series* is created:
34+
35+
```typescript
36+
// Create LineSeries with 'ProgressiveX' data pattern.
37+
const series = ChartXY.addLineSeries({
38+
dataPattern: {
39+
// pattern: 'ProgressiveX' => Each consecutive data point has increased X coordinate.
40+
pattern: 'ProgressiveX',
41+
// regularProgressiveStep: true => The X step between each consecutive data point is regular (for example, always `1.0`).
42+
regularProgressiveStep: true,
43+
}
44+
})
4145
```
4246

43-
**NOTE #1:**
47+
Available *data patterns* are:
48+
- `'ProgressiveX'`: Each consecutive data point has increased X coordinate.
49+
- `'ProgressiveY'`: Each consecutive data point has increased Y coordinate.
50+
- `'RegressiveX'`: Each consecutive data point has decreased X coordinate.
51+
- `'RegressiveX'`: Each consecutive data point has decreased Y coordinate.
52+
53+
The pattern of data can be identified even further with the optional `regularProgressiveStep` property.
54+
This can be enabled when the *progressive step* (for example, `'ProgressiveX'` -> X step) between each data point is regular, leading to even more significant optimizations.
4455

45-
The series created based on specified ***DataPattern*** is highly optimized **only** for the selected pattern. We do not recommend to provide data that contradict with specified ***DataPattern***.
56+
### Side-effects and good to know
4657

47-
**NOTE #2:**
58+
When a series is configured with a *data pattern*, the rendering process makes logical deductions and ssumptions on the user input data, according to the *data pattern* specification. **If the supplied input data does not follow the specification, rendering errors or even crashes can occur.** If you run into strange issues, first see if disabling the *data pattern* helps, or if your input data is somehow invalid.
59+
60+
61+
## Automatic Axis scrolling
4862

4963
The scrolling of data in progressive series can also be automated and optimized by specifying ***ScrollStrategy*** for both x-axis & y-axis to perform the scrolling efficiently.
5064

@@ -54,43 +68,12 @@ The scrolling of data in progressive series can also be automated and optimized
5468
- Select ***AxisScrollStrategies.regressive***. Automatically scrolls a scale to a negative direction.
5569
- Pass ***undefined*** to disable automatic scrolling. Scale can then be manually set using *setInterval* method of ***Axis***
5670

57-
For this particular example and based on the selected ***DataPatterns***, the configuration of the axis can be either ***AxisScrollStrategies.progressive*** or ***AxisScrollStrategies.regressive***.
58-
59-
For example
60-
- ***DataPatterns.horizontalProgressive*** series is created. X-axis scrolling should be configured with ***AxisScrollStrategies.progressive***. Y-scrolling can be any.
61-
62-
```javascript
63-
// Configure axis to have progressive scrolling.
64-
axisX.setScrollStrategy( AxisScrollStrategies.progressive )
65-
```
66-
67-
- ***DataPatterns.horizontalRegressive*** series is created. X-axis scrolling should be configured with ***AxisScrollStrategies.regressive***. Y-scrolling can be any.
68-
69-
```javascript
70-
// Configure axis to have regressive scrolling.
71-
axisX.setScrollStrategy( AxisScrollStrategies.regressive )
72-
```
73-
74-
- ***DataPatterns.verticalProgressive*** series is created. Y-axis scrolling should be configured with ***AxisScrollStrategies.progressive***. X-scrolling can be any.
75-
76-
```javascript
77-
// Configure axis to have progressive scrolling.
78-
axisY.setScrollStrategy( AxisScrollStrategies.progressive )
79-
```
80-
81-
- ***DataPatterns.verticalRegressive*** series is created. Y-axis scrolling should be configured with ***AxisScrollStrategies.regressive***. X-scrolling can be any.
82-
83-
```javascript
84-
// Configure axis to have regressive scrolling.
85-
axisY.setScrollStrategy( AxisScrollStrategies.regressive )
86-
```
87-
8871

8972
## API Links
9073

9174
* [XY cartesian chart]
9275
* [Scroll strategies]
93-
* [Progressive line series]
76+
* [Line series]
9477
* [Data patterns]
9578
* [Progressive trace data generator]
9679

@@ -116,9 +99,9 @@ Direct developer email support can be purchased through a [Support Plan][4] or b
11699
© Arction Ltd 2009-2020. All rights reserved.
117100

118101

119-
[XY cartesian chart]: https://www.arction.com/lightningchart-js-api-documentation/v2.2.0/classes/chartxy.html
120-
[Scroll strategies]: https://www.arction.com/lightningchart-js-api-documentation/v2.2.0/globals.html#axisscrollstrategies
121-
[Progressive line series]: https://www.arction.com/lightningchart-js-api-documentation/v2.2.0/classes/progressivelineseries.html
122-
[Data patterns]: https://www.arction.com/lightningchart-js-api-documentation/v2.2.0/globals.html#datapatterns
102+
[XY cartesian chart]: https://www.arction.com/lightningchart-js-api-documentation/v3.0.0/classes/chartxy.html
103+
[Scroll strategies]: https://www.arction.com/lightningchart-js-api-documentation/v3.0.0/globals.html#axisscrollstrategies
104+
[Line series]: https://www.arction.com/lightningchart-js-api-documentation/v3.0.0/classes/lineseries.html
105+
[Data patterns]: https://www.arction.com/lightningchart-js-api-documentation/v3.0.0/interfaces/datapattern.html
123106
[Progressive trace data generator]: https://arction.github.io/xydata/classes/progressivetracegenerator.html
124107

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"webpack-dev-server": "^3.9.0"
1515
},
1616
"dependencies": {
17-
"@arction/lcjs": "^2.2.0",
17+
"@arction/lcjs": "^3.0.0",
1818
"@arction/xydata": "^1.4.0",
1919
"clean-webpack-plugin": "^3.0.0",
2020
"webpack": "^4.41.2",

src/index.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const lcjs = require('@arction/lcjs')
77
// Extract required parts from LightningChartJS.
88
const {
99
lightningChart,
10-
DataPatterns,
1110
Themes
1211
} = lcjs
1312

@@ -20,17 +19,25 @@ const {
2019
const chart = lightningChart().ChartXY({
2120
// theme: Themes.dark
2221
})
23-
.setTitle('1 Million Points Line Trace')
2422

25-
// Create progressive line series.
26-
const series = chart.addLineSeries({ dataPattern: DataPatterns.horizontalProgressive })
23+
// Create line series optimized for regular progressive X data.
24+
const series = chart.addLineSeries({
25+
dataPattern: {
26+
// pattern: 'ProgressiveX' => Each consecutive data point has increased X coordinate.
27+
pattern: 'ProgressiveX',
28+
// regularProgressiveStep: true => The X step between each consecutive data point is regular (for example, always `1.0`).
29+
regularProgressiveStep: true,
30+
}
31+
})
2732

2833
// Generate traced points stream using 'xydata'-library.
34+
chart.setTitle('Generating test data...')
2935
createProgressiveTraceGenerator()
30-
.setNumberOfPoints(1000 * 1000)
36+
.setNumberOfPoints(1 * 1000 * 1000)
3137
.generate()
3238
.toPromise()
3339
.then(data => {
40+
chart.setTitle('1 Million Points Line Trace')
3441
setInterval(() => {
3542
series.add(data.splice(0, 20000))
3643
}, 50)

0 commit comments

Comments
 (0)