Skip to content

Commit 0596d48

Browse files
committed
1 parent b7184b1 commit 0596d48

File tree

4 files changed

+146
-146
lines changed

4 files changed

+146
-146
lines changed

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
node_modules
2-
dist
1+
node_modules
2+
dist
33
package-lock.json

package.json

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
{
2-
"version": "1.0.1",
3-
"scripts": {
4-
"build": "webpack --mode production",
5-
"start": "webpack-dev-server"
6-
},
7-
"license": "Custom",
8-
"private": true,
9-
"main": "./src/index.js",
10-
"devDependencies": {
11-
"copy-webpack-plugin": "^6.0.2",
12-
"html-webpack-plugin": "^3.2.0",
13-
"webpack-cli": "^3.3.10",
14-
"webpack-dev-server": "^3.9.0"
15-
},
16-
"dependencies": {
17-
"@arction/lcjs": "^3.2.0",
18-
"@arction/xydata": "^1.4.0",
19-
"clean-webpack-plugin": "^3.0.0",
20-
"webpack": "^4.41.2",
21-
"webpack-stream": "^5.2.1"
22-
}
23-
}
1+
{
2+
"version": "1.0.1",
3+
"scripts": {
4+
"build": "webpack --mode production",
5+
"start": "webpack-dev-server"
6+
},
7+
"license": "Custom",
8+
"private": true,
9+
"main": "./src/index.js",
10+
"devDependencies": {
11+
"copy-webpack-plugin": "^6.0.2",
12+
"html-webpack-plugin": "^3.2.0",
13+
"webpack-cli": "^3.3.10",
14+
"webpack-dev-server": "^3.9.0"
15+
},
16+
"dependencies": {
17+
"@arction/lcjs": "^3.2.0",
18+
"@arction/xydata": "^1.4.0",
19+
"clean-webpack-plugin": "^3.0.0",
20+
"webpack": "^4.41.2",
21+
"webpack-stream": "^5.2.1"
22+
}
23+
}

src/index.js

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
1-
/*
2-
* LightningChartJS example that showcases a line series with 1 Million streamed points with animated transitions.
3-
*/
4-
// Import LightningChartJS
5-
const lcjs = require('@arction/lcjs')
6-
7-
// Extract required parts from LightningChartJS.
8-
const {
9-
lightningChart,
10-
Themes
11-
} = lcjs
12-
13-
// Import data-generator from 'xydata'-library.
14-
const {
15-
createProgressiveTraceGenerator
16-
} = require('@arction/xydata')
17-
18-
// Create a XY Chart.
19-
const chart = lightningChart().ChartXY({
20-
// theme: Themes.darkGold
21-
})
22-
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-
})
32-
33-
// Generate traced points stream using 'xydata'-library.
34-
chart.setTitle('Generating test data...')
35-
createProgressiveTraceGenerator()
36-
.setNumberOfPoints(1 * 1000 * 1000)
37-
.generate()
38-
.toPromise()
39-
.then(data => {
40-
chart.setTitle('1 Million Points Line Trace')
41-
setInterval(() => {
42-
series.add(data.splice(0, 20000))
43-
}, 50)
44-
})
1+
/*
2+
* LightningChartJS example that showcases a line series with 1 Million streamed points with animated transitions.
3+
*/
4+
// Import LightningChartJS
5+
const lcjs = require('@arction/lcjs')
6+
7+
// Extract required parts from LightningChartJS.
8+
const {
9+
lightningChart,
10+
Themes
11+
} = lcjs
12+
13+
// Import data-generator from 'xydata'-library.
14+
const {
15+
createProgressiveTraceGenerator
16+
} = require('@arction/xydata')
17+
18+
// Create a XY Chart.
19+
const chart = lightningChart().ChartXY({
20+
// theme: Themes.darkGold
21+
})
22+
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+
})
32+
33+
// Generate traced points stream using 'xydata'-library.
34+
chart.setTitle('Generating test data...')
35+
createProgressiveTraceGenerator()
36+
.setNumberOfPoints(1 * 1000 * 1000)
37+
.generate()
38+
.toPromise()
39+
.then(data => {
40+
chart.setTitle('1 Million Points Line Trace')
41+
setInterval(() => {
42+
series.add(data.splice(0, 20000))
43+
}, 50)
44+
})

webpack.config.js

Lines changed: 77 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,77 @@
1-
const HtmlWebpackPlugin = require('html-webpack-plugin')
2-
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
3-
const CopyWebpackPlugin = require('copy-webpack-plugin')
4-
const path = require('path')
5-
6-
const targetFolderName = 'dist'
7-
const outputPath = path.resolve(__dirname, targetFolderName)
8-
const packageJSON = require('./package.json')
9-
10-
11-
module.exports = {
12-
mode: 'development',
13-
entry: {
14-
app: packageJSON.main
15-
},
16-
node: {
17-
buffer: false,
18-
setImmediate: false
19-
},
20-
devServer: {
21-
contentBase: outputPath,
22-
compress: true,
23-
// handle asset renaming
24-
before: function(app, server, compiler){
25-
app.get('/examples/assets/*', (req, res, next)=>{
26-
if(req.originalUrl.match(/lcjs_example_\d*_\w*-/g)){
27-
res.redirect(req.originalUrl.replace(/lcjs_example_\d*_\w*-/g,''))
28-
}
29-
else{
30-
next()
31-
}
32-
})
33-
}
34-
},
35-
resolve: {
36-
modules: [
37-
path.resolve('./src'),
38-
path.resolve('./node_modules')
39-
],
40-
extensions: ['.js']
41-
},
42-
output: {
43-
filename: 'js/[name].[contenthash].bundle.js',
44-
chunkFilename: 'js/[name].[contenthash].bundle.js',
45-
path: outputPath
46-
},
47-
optimization: {
48-
splitChunks: {
49-
chunks: 'all',
50-
cacheGroups: {
51-
// make separate 'vendor' chunk that contains any depenedencies
52-
// allows for smaller file sizes and faster builds
53-
vendor: {
54-
test: /node_modules/,
55-
chunks: 'initial',
56-
name: 'vendor',
57-
priority: 10,
58-
enforce: true
59-
}
60-
}
61-
},
62-
runtimeChunk: 'single'
63-
},
64-
plugins: [
65-
new CleanWebpackPlugin(),
66-
new HtmlWebpackPlugin({
67-
title: "app",
68-
filename: path.resolve(__dirname, 'dist', 'index.html')
69-
}),
70-
new CopyWebpackPlugin({
71-
patterns: [
72-
{ from: './assets/**/*', to: './examples/assets', flatten: true, noErrorOnMissing: true },
73-
{ from: './node_modules/@arction/lcjs/dist/resources', to: 'resources', noErrorOnMissing: true },
74-
]
75-
})
76-
]
77-
}
1+
const HtmlWebpackPlugin = require('html-webpack-plugin')
2+
const { CleanWebpackPlugin } = require('clean-webpack-plugin')
3+
const CopyWebpackPlugin = require('copy-webpack-plugin')
4+
const path = require('path')
5+
6+
const targetFolderName = 'dist'
7+
const outputPath = path.resolve(__dirname, targetFolderName)
8+
const packageJSON = require('./package.json')
9+
10+
11+
module.exports = {
12+
mode: 'development',
13+
entry: {
14+
app: packageJSON.main
15+
},
16+
node: {
17+
buffer: false,
18+
setImmediate: false
19+
},
20+
devServer: {
21+
contentBase: outputPath,
22+
compress: true,
23+
// handle asset renaming
24+
before: function(app, server, compiler){
25+
app.get('/examples/assets/*', (req, res, next)=>{
26+
if(req.originalUrl.match(/lcjs_example_\d*_\w*-/g)){
27+
res.redirect(req.originalUrl.replace(/lcjs_example_\d*_\w*-/g,''))
28+
}
29+
else{
30+
next()
31+
}
32+
})
33+
}
34+
},
35+
resolve: {
36+
modules: [
37+
path.resolve('./src'),
38+
path.resolve('./node_modules')
39+
],
40+
extensions: ['.js']
41+
},
42+
output: {
43+
filename: 'js/[name].[contenthash].bundle.js',
44+
chunkFilename: 'js/[name].[contenthash].bundle.js',
45+
path: outputPath
46+
},
47+
optimization: {
48+
splitChunks: {
49+
chunks: 'all',
50+
cacheGroups: {
51+
// make separate 'vendor' chunk that contains any depenedencies
52+
// allows for smaller file sizes and faster builds
53+
vendor: {
54+
test: /node_modules/,
55+
chunks: 'initial',
56+
name: 'vendor',
57+
priority: 10,
58+
enforce: true
59+
}
60+
}
61+
},
62+
runtimeChunk: 'single'
63+
},
64+
plugins: [
65+
new CleanWebpackPlugin(),
66+
new HtmlWebpackPlugin({
67+
title: "app",
68+
filename: path.resolve(__dirname, 'dist', 'index.html')
69+
}),
70+
new CopyWebpackPlugin({
71+
patterns: [
72+
{ from: './assets/**/*', to: './examples/assets', flatten: true, noErrorOnMissing: true },
73+
{ from: './node_modules/@arction/lcjs/dist/resources', to: 'resources', noErrorOnMissing: true },
74+
]
75+
})
76+
]
77+
}

0 commit comments

Comments
 (0)