Skip to content

Commit c39ca8f

Browse files
committed
LCJS 4.0.1
1 parent f26aba9 commit c39ca8f

File tree

11 files changed

+155
-133
lines changed

11 files changed

+155
-133
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

3dScatter-cyberSpace.png

680 KB
Loading

3dScatter-darkGold.png

495 KB
Loading

3dScatter-light.png

426 KB
Loading

3dScatter-lightNature.png

387 KB
Loading

3dScatter-turquoiseHexagon.png

747 KB
Loading

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,25 +1,25 @@
11
# JavaScript 3D Scatter Chart
22

3-
![JavaScript 3D Scatter Chart](3dScatter.png)
3+
![JavaScript 3D Scatter Chart](3dScatter-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

22-
*Also known as a Scatter Graph, Scatter Series, Point Graph, Scatter diagram or Scattergram*
22+
_Also known as a Scatter Graph, Scatter Series, Point Graph, Scatter diagram or Scattergram_
2323

2424
This example shows a simple 3D Point Graph with points drawn using 3D PointSeries for a visual representation of the data points 'markers'. The point graph is a type of chart or mathematical diagram drawn on a Cartesian coordinate system and represents the relationship between two variables.
2525

@@ -43,9 +43,9 @@ series.add({ x: 50, y: 60, z: 40 })
4343

4444
// Multiple points at once.
4545
series.add([
46-
{ x: 55, y: 60, z:40 },
47-
{ x: 60, y: 62, z:40 },
48-
{ x: 65, y: 65, z:50 }
46+
{ x: 55, y: 60, z: 40 },
47+
{ x: 60, y: 62, z: 40 },
48+
{ x: 65, y: 65, z: 50 },
4949
])
5050
```
5151

@@ -60,23 +60,23 @@ series.add([
6060

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

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

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

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

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

7171
[0]: https://github.com/Arction/
72-
[1]: https://www.arction.com/lightningchart-js-api-documentation/
73-
[2]: https://www.arction.com
72+
[1]: https://lightningchart.com/lightningchart-js-api-documentation/
73+
[2]: https://lightningchart.com
7474
[3]: https://stackoverflow.com/questions/tagged/lightningchart
75-
[4]: https://www.arction.com/support-services/
75+
[4]: https://lightningchart.com/support-services/
7676

77-
© Arction Ltd 2009-2020. All rights reserved.
77+
© LightningChart Ltd 2009-2022. All rights reserved.
7878

7979

80-
[3D chart]: https://www.arction.com/lightningchart-js-api-documentation/v3.4.0/classes/chart3d.html
81-
[3D point series]: https://www.arction.com/lightningchart-js-api-documentation/v3.4.0/classes/pointseries3d.html
80+
[3D chart]: https://lightningchart.com/lightningchart-js-api-documentation/v4.0.0/classes/Chart3D.html
81+
[3D point series]: https://lightningchart.com/lightningchart-js-api-documentation/v4.0.0/classes/PointSeries3D.html
8282

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: 36 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,20 @@
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-
SolidFill,
11-
ColorRGBA,
12-
PointStyle3D,
13-
Themes
14-
} = lcjs
11+
const { lightningChart, SolidFill, ColorRGBA, PointStyle3D, Themes } = lcjs
1512

1613
// Extract required parts from xyData.
17-
const {
18-
createWaterDropDataGenerator
19-
} = require('@arction/xydata')
14+
const { createWaterDropDataGenerator } = xydata
2015

2116
// Initiate chart
22-
const chart3D = lightningChart().Chart3D({
23-
disableAnimations: true,
24-
// theme: Themes.darkGold
25-
})
17+
const chart3D = lightningChart()
18+
.Chart3D({
19+
// theme: Themes.darkGold
20+
})
2621
.setTitle('3D Scatter Chart')
2722

2823
// Set Axis titles
@@ -31,29 +26,32 @@ chart3D.getDefaultAxisY().setTitle('Axis Y')
3126
chart3D.getDefaultAxisZ().setTitle('Axis Z')
3227

3328
// Create Point Series for rendering max Y coords.
34-
const pointSeriesMaxCoords = chart3D.addPointSeries()
35-
.setPointStyle(new PointStyle3D.Triangulated({
36-
fillStyle: new SolidFill({ color: ColorRGBA(224, 152, 0) }),
29+
const pointSeriesMaxCoords = chart3D.addPointSeries().setName('Max coords')
30+
pointSeriesMaxCoords.setPointStyle(
31+
new PointStyle3D.Triangulated({
32+
fillStyle: pointSeriesMaxCoords.getPointStyle().getFillStyle(),
3733
size: 10,
38-
shape: 'sphere'
39-
}))
40-
.setName('Max coords')
34+
shape: 'sphere',
35+
}),
36+
)
4137

4238
// Create another Point Series for rendering other Y coords than Max.
43-
const pointSeriesOtherCoords = chart3D.addPointSeries()
44-
.setPointStyle(new PointStyle3D.Triangulated({
45-
fillStyle: new SolidFill({ color: ColorRGBA(255, 0, 0) }),
39+
const pointSeriesOtherCoords = chart3D.addPointSeries({ automaticColorIndex: 2 }).setName('Below Max')
40+
pointSeriesOtherCoords.setPointStyle(
41+
new PointStyle3D.Triangulated({
42+
fillStyle: pointSeriesOtherCoords.getPointStyle().getFillStyle(),
4643
size: 5,
47-
shape: 'cube'
48-
}))
49-
.setName('Below Max')
44+
shape: 'cube',
45+
}),
46+
)
5047

5148
// Add LegendBox to chart.
52-
chart3D.addLegendBox()
49+
chart3D
50+
.addLegendBox()
5351
// Dispose example UI elements automatically if they take too much space. This is to avoid bad UI on mobile / etc. devices.
5452
.setAutoDispose({
5553
type: 'max-width',
56-
maxWidth: 0.30,
54+
maxWidth: 0.3,
5755
})
5856
.add(chart3D)
5957

@@ -62,31 +60,30 @@ let totalPointsAmount = 0
6260
const rows = 40
6361
const columns = 60
6462
createWaterDropDataGenerator()
65-
.setRows( rows )
66-
.setColumns( columns )
63+
.setRows(rows)
64+
.setColumns(columns)
6765
.generate()
68-
.then( data => {
66+
.then((data) => {
6967
// 'data' is a number Matrix number[][], that can be read as data[row][column].
70-
for ( let row = 0; row < rows; row ++ ) {
71-
for ( let column = 0; column < columns; column ++ ) {
68+
for (let row = 0; row < rows; row++) {
69+
for (let column = 0; column < columns; column++) {
7270
const value = data[row][column]
7371
// Generate 'value' amount of points along this XZ coordinate,
7472
// with the Y coordinate range based on 'value'.
75-
const pointsAmount = Math.ceil( value / 100 )
73+
const pointsAmount = Math.ceil(value / 100)
7674
const yMin = 0
7775
const yMax = value
78-
for ( let iPoint = 0; iPoint < pointsAmount; iPoint ++ ) {
76+
for (let iPoint = 0; iPoint < pointsAmount; iPoint++) {
7977
const y = yMin + Math.random() * (yMax - yMin)
8078
pointSeriesOtherCoords.add({ x: row, z: column, y })
81-
totalPointsAmount ++
79+
totalPointsAmount++
8280
}
8381
pointSeriesMaxCoords.add({ x: row, z: column, y: yMax })
84-
totalPointsAmount ++
82+
totalPointsAmount++
8583
}
8684
}
8785

8886
chart3D.setTitle(chart3D.getTitle() + ` (${totalPointsAmount} data points)`)
8987
// Set explicit Y Axis interval.
90-
chart3D.getDefaultAxisY().setInterval(0, 150, 2000, true)
88+
chart3D.getDefaultAxisY().setInterval({ start: 0, end: 150, animate: 2000 })
9189
})
92-

0 commit comments

Comments
 (0)