Skip to content

Commit 6e1b9d3

Browse files
author
Niilo Keinänen
committed
Initial
0 parents  commit 6e1b9d3

12 files changed

+294
-0
lines changed

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

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [master]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: Use Node.js 16.x
15+
uses: actions/setup-node@v1
16+
with:
17+
node-version: "16.x"
18+
19+
- name: Build
20+
env:
21+
LCJS_LICENSE: ${{ secrets.LCJS_DEPLOY_LICENSE }}
22+
run: |
23+
npm install
24+
npm run build
25+
26+
- name: Deploy
27+
uses: peaceiris/actions-gh-pages@v3
28+
with:
29+
github_token: ${{ secrets.GITHUB_TOKEN }}
30+
publish_dir: ./dist
31+
publish_branch: gh-pages

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
dist
3+

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: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Parallel Coordinate Chart with Value Thresholds
2+
3+
![Parallel Coordinate Chart with Value Thresholds](parallelCoordChartThresholds-darkGold.png)
4+
5+
This demo application belongs to the set of examples for LightningChart JS, data visualization library for JavaScript.
6+
7+
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.
8+
9+
The demo can be used as an example or a seed project. Local execution requires the following steps:
10+
11+
- Make sure that relevant version of [Node.js](https://nodejs.org/en/download/) is installed
12+
- Open the project folder in a terminal:
13+
14+
npm install # fetches dependencies
15+
npm start # builds an application and starts the development server
16+
17+
- The application is available at _http://localhost:8080_ in your browser, webpack-dev-server provides hot reload functionality.
18+
19+
20+
## Description
21+
22+
A common use case is to display value thresholds on different axes.
23+
E.g. which value range is _bad_ and which is _good_.
24+
25+
This example shows how this can be done by styling the Axis line style with a `PalettedFill`.
26+
27+
## API Links
28+
29+
30+
31+
## Support
32+
33+
If you notice an error in the example code, please open an issue on [GitHub][0] repository of the entire example.
34+
35+
Official [API documentation][1] can be found on [LightningChart][2] website.
36+
37+
If the docs and other materials do not solve your problem as well as implementation help is needed, ask on [StackOverflow][3] (tagged lightningchart).
38+
39+
If you think you found a bug in the LightningChart JavaScript library, please contact sales@lightningchart.com.
40+
41+
Direct developer email support can be purchased through a [Support Plan][4] or by contacting sales@lightningchart.com.
42+
43+
[0]: https://github.com/Arction/
44+
[1]: https://lightningchart.com/lightningchart-js-api-documentation/
45+
[2]: https://lightningchart.com
46+
[3]: https://stackoverflow.com/questions/tagged/lightningchart
47+
[4]: https://lightningchart.com/support-services/
48+
49+
© LightningChart Ltd 2009-2022. All rights reserved.
50+
51+
52+

package.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"version": "2.0.0",
3+
"scripts": {
4+
"build": "webpack --mode production",
5+
"start": "webpack serve"
6+
},
7+
"license": "MIT",
8+
"private": true,
9+
"main": "./src/index.js",
10+
"devDependencies": {
11+
"clean-webpack-plugin": "^4.0.0",
12+
"copy-webpack-plugin": "^10.0.0",
13+
"html-webpack-plugin": "^5.5.0",
14+
"webpack": "^5.64.4",
15+
"webpack-cli": "^4.9.1",
16+
"webpack-dev-server": "^4.6.0",
17+
"webpack-stream": "^7.0.0"
18+
},
19+
"dependencies": {
20+
"@lightningchart/lcjs": "^6.0.0",
21+
"@lightningchart/xydata": "^1.4.0"
22+
},
23+
"lightningChart": {
24+
"eID": "1704"
25+
}
26+
}
388 KB
Loading
166 KB
Loading
91.8 KB
Loading
92.6 KB
Loading
Loading

src/index.js

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
const lcjs = require('@lightningchart/lcjs')
2+
const { lightningChart, Themes, SolidLine, PalettedFill, LUT, ColorRGBA } = lcjs
3+
4+
const lc = lightningChart({
5+
resourcesBaseUrl: new URL(document.head.baseURI).origin + new URL(document.head.baseURI).pathname + 'resources/',
6+
})
7+
const chart = lc
8+
.ParallelCoordinateChart({
9+
theme: Themes[new URLSearchParams(window.location.search).get('theme') || 'darkGold'] || undefined,
10+
})
11+
.setTitle('Parallel Coordinate Chart with Value thresholds')
12+
13+
const Axes = {
14+
'Variable A': 0,
15+
'Variable B': 1,
16+
'Variable C': 2,
17+
}
18+
chart.setAxes(Axes)
19+
chart.getAxis(Axes['Variable A']).setInterval({ start: 20, end: 60 })
20+
chart.getAxis(Axes['Variable B']).setInterval({ start: 80, end: 120 })
21+
chart.getAxis(Axes['Variable C']).setInterval({ start: 0.0, end: 2.5 })
22+
23+
const series1 = chart.addSeries().setName('Sample 1').setData({
24+
'Variable A': 36,
25+
'Variable B': 100,
26+
'Variable C': 1.1,
27+
})
28+
29+
const series2 = chart.addSeries().setName('Sample 2').setData({
30+
'Variable A': 32,
31+
'Variable B': 115,
32+
'Variable C': 0.5,
33+
})
34+
35+
const series3 = chart.addSeries().setName('Sample 3').setData({
36+
'Variable A': 35,
37+
'Variable B': 82,
38+
'Variable C': 0.9,
39+
})
40+
41+
// Show value range warning thresholds for each axis.
42+
// This can be done by styling the Axis stroke with color lookup by Y
43+
const theme = chart.getTheme()
44+
const colorOK = ColorRGBA(0, 0, 0, 0)
45+
const colorWarning = theme.examples.badGoodColorPalette[0]
46+
chart.getAxis(Axes['Variable A']).setStrokeStyle(
47+
new SolidLine({
48+
thickness: 4,
49+
fillStyle: new PalettedFill({
50+
lookUpProperty: 'y',
51+
lut: new LUT({
52+
interpolate: false,
53+
steps: [
54+
{ value: 0, color: colorOK },
55+
{ value: 50, color: colorWarning },
56+
],
57+
}),
58+
}),
59+
}),
60+
)
61+
chart.getAxis(Axes['Variable B']).setStrokeStyle(
62+
new SolidLine({
63+
thickness: 4,
64+
fillStyle: new PalettedFill({
65+
lookUpProperty: 'y',
66+
lut: new LUT({
67+
interpolate: false,
68+
steps: [
69+
{ value: 0, color: colorWarning },
70+
{ value: 85, color: colorOK },
71+
],
72+
}),
73+
}),
74+
}),
75+
)
76+
chart.getAxis(Axes['Variable C']).setStrokeStyle(
77+
new SolidLine({
78+
thickness: 4,
79+
fillStyle: new PalettedFill({
80+
lookUpProperty: 'y',
81+
lut: new LUT({
82+
interpolate: false,
83+
steps: [
84+
{ value: 0, color: colorWarning },
85+
{ value: 0.2, color: colorOK },
86+
{ value: 1.5, color: colorWarning },
87+
],
88+
}),
89+
}),
90+
}),
91+
)

webpack.config.js

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
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+
const webpack = require('webpack')
6+
7+
const targetFolderName = 'dist'
8+
const outputPath = path.resolve(__dirname, targetFolderName)
9+
const packageJSON = require('./package.json')
10+
11+
module.exports = {
12+
mode: 'development',
13+
entry: {
14+
app: packageJSON.main,
15+
},
16+
devServer: {
17+
static: outputPath,
18+
compress: true,
19+
},
20+
resolve: {
21+
modules: [path.resolve('./src'), path.resolve('./node_modules')],
22+
extensions: ['.js'],
23+
},
24+
output: {
25+
filename: 'js/[name].[contenthash].bundle.js',
26+
chunkFilename: 'js/[name].[contenthash].bundle.js',
27+
path: outputPath,
28+
},
29+
optimization: {
30+
splitChunks: {
31+
chunks: 'all',
32+
cacheGroups: {
33+
// make separate 'vendor' chunk that contains any dependencies
34+
// allows for smaller file sizes and faster builds
35+
vendor: {
36+
test: /[\\/]node_modules[\\/]/,
37+
chunks: 'initial',
38+
name: 'vendor',
39+
priority: -10,
40+
reuseExistingChunk: true,
41+
},
42+
},
43+
},
44+
runtimeChunk: 'single',
45+
},
46+
plugins: [
47+
new CleanWebpackPlugin(),
48+
new HtmlWebpackPlugin({
49+
title: 'app',
50+
filename: path.resolve(__dirname, 'dist', 'index.html'),
51+
}),
52+
new CopyWebpackPlugin({
53+
patterns: [
54+
{
55+
from: './assets/**/*',
56+
to: `./examples/assets/${packageJSON.lightningChart.eID}/[name][ext]`,
57+
noErrorOnMissing: true,
58+
},
59+
{
60+
from: './node_modules/@lightningchart/lcjs/dist/resources',
61+
to: 'resources',
62+
noErrorOnMissing: true,
63+
},
64+
],
65+
}),
66+
new webpack.DefinePlugin({
67+
LCJS_LICENSE: "'" + process.env.LCJS_LICENSE + "'",
68+
}),
69+
],
70+
}

0 commit comments

Comments
 (0)