Skip to content

Commit 5dd2c44

Browse files
committed
LCJS 4.0.1
1 parent 639058f commit 5dd2c44

11 files changed

+154
-150
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: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
# JavaScript Point Clusters Chart
22

3-
![JavaScript Point Clusters Chart](pointClusters.png)
3+
![JavaScript Point Clusters Chart](pointClusters-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
This example shows how to create clusters of differently colored points, how to get the boundaries of a series and use them to draw frames around each cluster.
2323

24-
The most efficient way to draw point cloud clusters is utilizing ***PointSeries***. The description of how to configure the visual appearance of points can be found in previous tutorials and more information can be found in API documentation.
24+
The most efficient way to draw point cloud clusters is utilizing **_PointSeries_**. The description of how to configure the visual appearance of points can be found in previous tutorials and more information can be found in API documentation.
2525

2626
```javascript
2727
// Create point series which represents a single cluster.
@@ -46,7 +46,7 @@ const maxCorner = {
4646
}
4747
```
4848

49-
The boundary rectangle is defined by two points in 2D space. The same methods are applicable to all the series as well as ***progressive series*** in any directions.
49+
The boundary rectangle is defined by two points in 2D space. The same methods are applicable to all the series as well as **_progressive series_** in any directions.
5050

5151

5252
## API Links
@@ -64,28 +64,28 @@ The boundary rectangle is defined by two points in 2D space. The same methods ar
6464

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

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

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

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

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

7575
[0]: https://github.com/Arction/
76-
[1]: https://www.arction.com/lightningchart-js-api-documentation/
77-
[2]: https://www.arction.com
76+
[1]: https://lightningchart.com/lightningchart-js-api-documentation/
77+
[2]: https://lightningchart.com
7878
[3]: https://stackoverflow.com/questions/tagged/lightningchart
79-
[4]: https://www.arction.com/support-services/
79+
[4]: https://lightningchart.com/support-services/
8080

81-
© Arction Ltd 2009-2020. All rights reserved.
81+
© LightningChart Ltd 2009-2022. All rights reserved.
8282

8383

84-
[XY cartesian chart]: https://www.arction.com/lightningchart-js-api-documentation/v3.4.0/classes/chartxy.html
85-
[Point series]: https://www.arction.com/lightningchart-js-api-documentation/v3.4.0/classes/pointseries.html
86-
[Rectangle series]: https://www.arction.com/lightningchart-js-api-documentation/v3.4.0/classes/rectangleseries.html
87-
[Color palettes]: https://www.arction.com/lightningchart-js-api-documentation/v3.4.0/globals.html#colorpalettes
88-
[Solid FillStyle]: https://www.arction.com/lightningchart-js-api-documentation/v3.4.0/classes/solidfill.html
89-
[Empty FillStyle]: https://www.arction.com/lightningchart-js-api-documentation/v3.4.0/globals.html#emptyfill
90-
[Solid LineStyle]: https://www.arction.com/lightningchart-js-api-documentation/v3.4.0/classes/solidline.html
84+
[XY cartesian chart]: https://lightningchart.com/lightningchart-js-api-documentation/v4.0.0/classes/ChartXY.html
85+
[Point series]: https://lightningchart.com/lightningchart-js-api-documentation/v4.0.0/classes/PointSeries.html
86+
[Rectangle series]: https://lightningchart.com/lightningchart-js-api-documentation/v4.0.0/classes/RectangleSeries.html
87+
[Color palettes]: https://lightningchart.com/lightningchart-js-api-documentation/v4.0.0/variables/ColorPalettes.html
88+
[Solid FillStyle]: https://lightningchart.com/lightningchart-js-api-documentation/v4.0.0/classes/SolidFill.html
89+
[Empty FillStyle]: https://lightningchart.com/lightningchart-js-api-documentation/v4.0.0/variables/emptyFill-1.html
90+
[Solid LineStyle]: https://lightningchart.com/lightningchart-js-api-documentation/v4.0.0/classes/SolidLine.html
9191

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": {

pointClusters-cyberSpace.png

538 KB
Loading

pointClusters-darkGold.png

320 KB
Loading

pointClusters-light.png

233 KB
Loading

pointClusters-lightNature.png

124 KB
Loading

pointClusters-turquoiseHexagon.png

562 KB
Loading

src/index.js

Lines changed: 32 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -5,44 +5,28 @@
55
const lcjs = require('@arction/lcjs')
66

77
// Extract required parts from LightningChartJS.
8-
const {
9-
lightningChart,
10-
SolidFill,
11-
SolidLine,
12-
ColorPalettes,
13-
emptyFill,
14-
AxisTickStrategies,
15-
PointShape,
16-
Themes
17-
} = lcjs
8+
const { lightningChart, SolidFill, SolidLine, ColorPalettes, emptyFill, AxisTickStrategies, PointShape, Themes } = lcjs
189

1910
const pointSize = 10
2011
// Decide on an origin for DateTime axis.
2112
const dateOrigin = new Date(2018, 8, 1)
2213

2314
// Create a XY Chart.
24-
const chart = lightningChart().ChartXY({
25-
// theme: Themes.darkGold
26-
})
15+
const chart = lightningChart()
16+
.ChartXY({
17+
// theme: Themes.darkGold
18+
})
2719
.setTitle('Salary differences between Kuopio and Helsinki')
2820
.setPadding({
29-
right: 50
21+
right: 50,
3022
})
3123

3224
// Modify the default X Axis to use DateTime TickStrategy, and set the origin for the DateTime Axis.
33-
chart.getDefaultAxisX()
34-
.setTickStrategy(
35-
AxisTickStrategies.DateTime,
36-
(tickStrategy) => tickStrategy.setDateOrigin(dateOrigin)
37-
)
25+
chart.getDefaultAxisX().setTickStrategy(AxisTickStrategies.DateTime, (tickStrategy) => tickStrategy.setDateOrigin(dateOrigin))
3826

3927
// Add a series for each cluster of points
40-
const fstClusterSeries = chart.addPointSeries({ pointShape: PointShape.Circle })
41-
.setName('Kuopio')
42-
.setPointSize(pointSize)
43-
const sndClusterSeries = chart.addPointSeries({ pointShape: PointShape.Triangle })
44-
.setName('Helsinki')
45-
.setPointSize(pointSize)
28+
const fstClusterSeries = chart.addPointSeries({ pointShape: PointShape.Circle }).setName('Kuopio').setPointSize(pointSize)
29+
const sndClusterSeries = chart.addPointSeries({ pointShape: PointShape.Triangle }).setName('Helsinki').setPointSize(pointSize)
4630

4731
// The point supplied to series will have their X values multiplied by this value (for easier addition of DateTime-values).
4832
const dataFrequency = 1000 * 60 * 60 * 24
@@ -285,7 +269,7 @@ const kuopioPoints = [
285269
{ x: 15.557729941291585, y: 3854.5673076923076 },
286270
{ x: 12.32876712328767, y: 4174.278846153846 },
287271
{ x: 11.859099804305282, y: 4115.384615384615 },
288-
{ x: 11.330724070450097, y: 3921.875 }
272+
{ x: 11.330724070450097, y: 3921.875 },
289273
]
290274

291275
const helsinkiPoints = [
@@ -523,32 +507,27 @@ const helsinkiPoints = [
523507
{ x: 23.01369863013699, y: 2931.25 },
524508
{ x: 29, y: 2931.25 },
525509
{ x: 29, y: 2931.25 },
526-
{ x: 29, y: 2931.25 }
510+
{ x: 29, y: 2931.25 },
527511
]
528512

529513
// Create collection of rectangles which are going to be used as frame for clusters
530-
const rects = chart.addRectangleSeries()
531-
.setCursorEnabled(false)
514+
const rects = chart.addRectangleSeries().setCursorEnabled(false)
532515

533516
// Base style for strokes of frames. Line-FillStyle will be overridden per each cluster.
534-
const strokeStyle = new SolidLine()
535-
.setThickness(2)
517+
const strokeStyle = new SolidLine().setThickness(2)
536518

537519
// Setup view nicely.
538-
chart.getDefaultAxisX()
539-
.setInterval(0 * dataFrequency, 30 * dataFrequency, true, true)
520+
chart.getDefaultAxisX().setInterval({ start: 0 * dataFrequency, end: 30 * dataFrequency, animate: true })
540521

541-
chart.getDefaultAxisY()
542-
.setTitle('Salary ($)')
543-
.setInterval(1500, 6500, true, true)
522+
chart.getDefaultAxisY().setTitle('Salary ($)').setInterval({ start: 1500, end: 6500, animate: true })
544523
/**
545-
* Adds clusters of points to specified series and creates frames for them
546-
* @param {PointSeries} series Series which should hold the cluster
547-
* @return Function which receives a cluster of points
548-
*/
524+
* Adds clusters of points to specified series and creates frames for them
525+
* @param {PointSeries} series Series which should hold the cluster
526+
* @return Function which receives a cluster of points
527+
*/
549528
const drawCluster = (series, points) => {
550529
// Add points to specified series
551-
series.add(points.map(point => ({ x: point.x * dataFrequency, y: point.y })))
530+
series.add(points.map((point) => ({ x: point.x * dataFrequency, y: point.y })))
552531
// Cache top left corner of cluster area
553532
series.setCursorResultTableFormatter((builder, series, Xvalue, Yvalue) => {
554533
return builder
@@ -561,12 +540,13 @@ const drawCluster = (series, points) => {
561540
y: series.getYMin(),
562541
}
563542
// Create frame around cluster
564-
rects.add({
565-
x: topLeftCorner.x,
566-
y: topLeftCorner.y,
567-
width: series.getXMax() - topLeftCorner.x,
568-
height: series.getYMax() - topLeftCorner.y
569-
})
543+
rects
544+
.add({
545+
x: topLeftCorner.x,
546+
y: topLeftCorner.y,
547+
width: series.getXMax() - topLeftCorner.x,
548+
height: series.getYMax() - topLeftCorner.y,
549+
})
570550
// Disable filling of frame
571551
.setFillStyle(emptyFill)
572552
// Configure thickness and color of stroke via strokeStyle
@@ -577,18 +557,17 @@ drawCluster(fstClusterSeries, kuopioPoints)
577557
drawCluster(sndClusterSeries, helsinkiPoints)
578558

579559
// Enable AutoCursor auto-fill.
580-
chart.setAutoCursor(cursor => (cursor)
581-
.setResultTableAutoTextStyle(true)
582-
.setTickMarkerXAutoTextStyle(true)
583-
.setTickMarkerYAutoTextStyle(true)
560+
chart.setAutoCursor((cursor) =>
561+
cursor.setResultTableAutoTextStyle(true).setTickMarkerXAutoTextStyle(true).setTickMarkerYAutoTextStyle(true),
584562
)
585563

586564
// Finally, add LegendBox to chart.
587-
chart.addLegendBox()
565+
chart
566+
.addLegendBox()
588567
.add(fstClusterSeries)
589568
.add(sndClusterSeries)
590569
// Dispose example UI elements automatically if they take too much space. This is to avoid bad UI on mobile / etc. devices.
591570
.setAutoDispose({
592571
type: 'max-width',
593-
maxWidth: 0.30,
572+
maxWidth: 0.3,
594573
})

0 commit comments

Comments
 (0)