Skip to content

Commit 720ef9e

Browse files
committed
LCJS 4.0.1
1 parent 20344b6 commit 720ef9e

11 files changed

+152
-143
lines changed

.github/workflows/gh-pages-deploy.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@ name: Webpack build to GitHub Pages
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [master]
66

77
jobs:
88
build:
99
runs-on: ubuntu-latest
1010

1111
steps:
12-
- uses: actions/checkout@v2
12+
- uses: actions/checkout@v2
1313

14-
- name: Use Node.js 16.x
15-
uses: actions/setup-node@v1
16-
with:
17-
node-version: '16.x'
14+
- name: Use Node.js 16.x
15+
uses: actions/setup-node@v1
16+
with:
17+
node-version: "16.x"
1818

19-
- name: Build
20-
run: |
21-
npm install
22-
npm run build
19+
- name: Build
20+
run: |
21+
npm install
22+
npm run build
2323
24-
- name: Deploy
25-
uses: peaceiris/actions-gh-pages@v3
26-
with:
27-
github_token: ${{ secrets.GITHUB_TOKEN }}
28-
publish_dir: ./dist
29-
publish_branch: gh-pages
24+
- name: Deploy
25+
uses: peaceiris/actions-gh-pages@v3
26+
with:
27+
github_token: ${{ secrets.GITHUB_TOKEN }}
28+
publish_dir: ./dist
29+
publish_branch: gh-pages

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2022 LightningChart Ltd.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
# JavaScript OHLC Chart with Automatic Packing Resolution
22

3-
![JavaScript OHLC Chart with Automatic Packing Resolution](ohlcAutomaticPackingResolution.png)
3+
![JavaScript OHLC Chart with Automatic Packing Resolution](ohlcAutomaticPackingResolution-darkGold.png)
44

55
This demo application belongs to the set of examples for LightningChart JS, data visualization library for JavaScript.
66

77
LightningChart JS is entirely GPU accelerated and performance optimized charting library for presenting massive amounts of data. It offers an easy way of creating sophisticated and interactive charts and adding them to your website or web application.
88

99
The demo can be used as an example or a seed project. Local execution requires the following steps:
1010

11-
- Make sure that relevant version of [Node.js](https://nodejs.org/en/download/) is installed
12-
- Open the project folder in a terminal:
11+
- Make sure that relevant version of [Node.js](https://nodejs.org/en/download/) is installed
12+
- Open the project folder in a terminal:
1313

14-
npm install # fetches dependencies
15-
npm start # builds an application and starts the development server
14+
npm install # fetches dependencies
15+
npm start # builds an application and starts the development server
1616

17-
- The application is available at *http://localhost:8080* in your browser, webpack-dev-server provides hot reload functionality.
17+
- The application is available at _http://localhost:8080_ in your browser, webpack-dev-server provides hot reload functionality.
1818

1919

2020
## Description
2121

2222
The examples purpose is to shed some light on the packing logic of OHLCSeriesWithAutomaticPacking and how it can be fit to users needs by usage of method: `setPackingResolution`.
2323

24-
This class is a variant of OHLCSeries, which adds the automatic packing of XY-points to XOHLC-points. In a nutshell, when pushing points, it simply packages these points into 'XOHLC'-objects at certain intervals (which is controlled by the packing resolution property).
24+
This class is a variant of OHLCSeries, which adds the automatic packing of XY-points to XOHLC-points. In a nutshell, when pushing points, it simply packages these points into 'XOHLC'-objects at certain intervals (which is controlled by the packing resolution property).
2525

2626
By default, or if packing resolution is explicitly set to 'undefined', the used value will be automatically computed based on current pixel-size. This effectively means that any newly pushed points will never be able to be zoomed closer than the view at the time of packing.
2727

2828
To ensure that the figures can be zoomed up to desired details, users can set an explicit value for the packing resolution, which will specify the minimum interval (in axis values) between two fully zoomed figures.
2929

30-
[//]: # "IMPORTANT: The assets will not show before README.md is built - relative path is different!"
30+
[//]: # 'IMPORTANT: The assets will not show before README.md is built - relative path is different!'
3131

3232
![](./assets/ohlcPackingResolution.png)
3333

@@ -45,26 +45,26 @@ To ensure that the figures can be zoomed up to desired details, users can set an
4545

4646
If you notice an error in the example code, please open an issue on [GitHub][0] repository of the entire example.
4747

48-
Official [API documentation][1] can be found on [Arction][2] website.
48+
Official [API documentation][1] can be found on [LightningChart][2] website.
4949

5050
If the docs and other materials do not solve your problem as well as implementation help is needed, ask on [StackOverflow][3] (tagged lightningchart).
5151

52-
If you think you found a bug in the LightningChart JavaScript library, please contact support@arction.com.
52+
If you think you found a bug in the LightningChart JavaScript library, please contact support@lightningchart.com.
5353

54-
Direct developer email support can be purchased through a [Support Plan][4] or by contacting sales@arction.com.
54+
Direct developer email support can be purchased through a [Support Plan][4] or by contacting sales@lightningchart.com.
5555

5656
[0]: https://github.com/Arction/
57-
[1]: https://www.arction.com/lightningchart-js-api-documentation/
58-
[2]: https://www.arction.com
57+
[1]: https://lightningchart.com/lightningchart-js-api-documentation/
58+
[2]: https://lightningchart.com
5959
[3]: https://stackoverflow.com/questions/tagged/lightningchart
60-
[4]: https://www.arction.com/support-services/
60+
[4]: https://lightningchart.com/support-services/
6161

62-
© Arction Ltd 2009-2020. All rights reserved.
62+
© LightningChart Ltd 2009-2022. All rights reserved.
6363

6464

65-
[Axis tick strategies]: https://www.arction.com/lightningchart-js-api-documentation/v3.4.0/globals.html#axistickstrategies
66-
[XY cartesian chart]: https://www.arction.com/lightningchart-js-api-documentation/v3.4.0/classes/chartxy.html
67-
[OHLC series types]: https://www.arction.com/lightningchart-js-api-documentation/v3.4.0/globals.html#ohlcseriestypes
68-
[Series with automatic packing]: https://www.arction.com/lightningchart-js-api-documentation/v3.4.0/classes/ohlcserieswithautomaticpacking.html
65+
[Axis tick strategies]: https://lightningchart.com/lightningchart-js-api-documentation/v4.0.0/variables/AxisTickStrategies.html
66+
[XY cartesian chart]: https://lightningchart.com/lightningchart-js-api-documentation/v4.0.0/classes/ChartXY.html
67+
[OHLC series types]: https://lightningchart.com/lightningchart-js-api-documentation/v4.0.0/variables/OHLCSeriesTypes.html
68+
[Series with automatic packing]: https://lightningchart.com/lightningchart-js-api-documentation/v4.0.0/classes/OHLCSeriesWithAutomaticPacking.html
6969
[Progressive trace generator]: https://arction.github.io/xydata/classes/progressivetracegenerator.html
7070

455 KB
Loading
225 KB
Loading
133 KB
Loading
97.2 KB
Loading
474 KB
Loading

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"build": "webpack --mode production",
55
"start": "webpack serve"
66
},
7-
"license": "Custom",
7+
"license": "MIT",
88
"private": true,
99
"main": "./src/index.js",
1010
"devDependencies": {
@@ -17,7 +17,7 @@
1717
"webpack-stream": "^7.0.0"
1818
},
1919
"dependencies": {
20-
"@arction/lcjs": "^3.4.0",
20+
"@arction/lcjs": "^4.0.1",
2121
"@arction/xydata": "^1.4.0"
2222
},
2323
"lightningChart": {

src/index.js

Lines changed: 33 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -4,90 +4,71 @@
44
// Import LightningChartJS
55
const lcjs = require('@arction/lcjs')
66

7+
// Import xydata
8+
const xydata = require('@arction/xydata')
9+
710
// Extract required parts from LightningChartJS.
8-
const {
9-
lightningChart,
10-
AxisTickStrategies,
11-
OHLCSeriesTypes,
12-
emptyLine,
13-
Themes
14-
} = lcjs
11+
const { lightningChart, AxisTickStrategies, OHLCSeriesTypes, emptyLine, Themes } = lcjs
1512

1613
// Import data-generator from 'xydata'-library.
17-
const {
18-
createProgressiveTraceGenerator
19-
} = require('@arction/xydata')
14+
const { createProgressiveTraceGenerator } = xydata
2015

2116
const dataSpan = 60 * 60 * 1000
2217
const dataFrequency = 1 * 1000
2318

2419
// Decide on an origin for DateTime axis.
2520
const dateOrigin = new Date(2018, 0, 1)
2621
// Create charts and series for two different packing resolutions.
27-
const dashboard = lightningChart().Dashboard({numberOfColumns: 1, numberOfRows: 2})
22+
const dashboard = lightningChart().Dashboard({ numberOfColumns: 1, numberOfRows: 2 })
2823
const chartDefault = dashboard.createChartXY({
2924
columnIndex: 0,
3025
rowIndex: 0,
3126
// theme: Themes.darkGold
3227
})
3328
// Use DateTime TickStrategy with custom origin date.
34-
chartDefault
35-
.getDefaultAxisX()
36-
.setTickStrategy(
37-
AxisTickStrategies.DateTime,
38-
(tickStrategy) => tickStrategy.setDateOrigin(dateOrigin)
39-
)
29+
chartDefault.getDefaultAxisX().setTickStrategy(AxisTickStrategies.DateTime, (tickStrategy) => tickStrategy.setDateOrigin(dateOrigin))
4030

41-
chartDefault
42-
.setTitle('Default packing resolution')
43-
.setAutoCursor(cursor => {
44-
cursor.disposeTickMarkerY()
45-
cursor.setGridStrokeYStyle(emptyLine)
46-
})
31+
chartDefault.setTitle('Default packing resolution').setAutoCursor((cursor) => {
32+
cursor.setTickMarkerYVisible(false)
33+
cursor.setGridStrokeYStyle(emptyLine)
34+
})
4735
// Preventing ResultTable from getting cut at the edge
4836
chartDefault.setPadding({
49-
right: 42
37+
right: 42,
5038
})
5139

5240
// show title 'USD on Y axis
53-
chartDefault.getDefaultAxisY()
54-
.setTitle('USD')
41+
chartDefault.getDefaultAxisY().setTitle('USD')
5542

5643
const chartLow = dashboard.createChartXY({
5744
columnIndex: 0,
5845
rowIndex: 1,
5946
// theme: Themes.darkGold
6047
})
6148
// Use DateTime TickStrategy with custom origin date.
62-
chartLow
63-
.getDefaultAxisX()
64-
.setTickStrategy(
65-
AxisTickStrategies.DateTime,
66-
(tickStrategy) => tickStrategy.setDateOrigin(dateOrigin)
67-
)
49+
chartLow.getDefaultAxisX().setTickStrategy(AxisTickStrategies.DateTime, (tickStrategy) => tickStrategy.setDateOrigin(dateOrigin))
6850

69-
chartLow
70-
.setTitle('Very small packing resolution')
71-
.setAutoCursor(cursor => {
72-
cursor.disposeTickMarkerY()
73-
cursor.setGridStrokeYStyle(emptyLine)
74-
})
51+
chartLow.setTitle('Very small packing resolution').setAutoCursor((cursor) => {
52+
cursor.setTickMarkerYVisible(false)
53+
cursor.setGridStrokeYStyle(emptyLine)
54+
})
7555
// Preventing ResultTable from getting cut at the edge
7656
chartLow.setPadding({
77-
right: 42
57+
right: 42,
7858
})
7959

8060
// show title 'USD on Y axis
81-
chartLow.getDefaultAxisY()
82-
.setTitle('USD')
61+
chartLow.getDefaultAxisY().setTitle('USD')
8362

84-
const seriesDefault = chartDefault.addOHLCSeries(
85-
// Specify type of OHLC-series for adding points
86-
{ seriesConstructor: OHLCSeriesTypes.AutomaticPacking }
87-
)
63+
const seriesDefault = chartDefault
64+
.addOHLCSeries(
65+
// Specify type of OHLC-series for adding points
66+
{ seriesConstructor: OHLCSeriesTypes.AutomaticPacking },
67+
)
8868
.setName('Default packing resolution')
8969

90-
const seriesLow = chartLow.addOHLCSeries({ seriesConstructor: OHLCSeriesTypes.AutomaticPacking })
70+
const seriesLow = chartLow
71+
.addOHLCSeries({ seriesConstructor: OHLCSeriesTypes.AutomaticPacking })
9172
.setName('Very small packing resolution')
9273
// Set packing resolution that is equal to the minimum resolution between two points.
9374
// (essentially allows users to zoom to full resolution)
@@ -98,9 +79,12 @@ createProgressiveTraceGenerator()
9879
.setNumberOfPoints(dataSpan / dataFrequency)
9980
.generate()
10081
.toPromise()
101-
.then((data) => data.map((p) => ({
102-
x: p.x * dataFrequency, y: p.y
103-
})))
82+
.then((data) =>
83+
data.map((p) => ({
84+
x: p.x * dataFrequency,
85+
y: p.y,
86+
})),
87+
)
10488
.then((data) => {
10589
seriesDefault.add(data)
10690
seriesLow.add(data)

0 commit comments

Comments
 (0)