-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Niilo Keinänen
committed
Nov 5, 2024
0 parents
commit cca46e3
Showing
12 changed files
with
299 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: GitHub Pages | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Use Node.js 16.x | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: "16.x" | ||
|
||
- name: Build | ||
env: | ||
LCJS_LICENSE: ${{ secrets.LCJS_DEPLOY_LICENSE }} | ||
run: | | ||
npm install | ||
npm run build | ||
- name: Deploy | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./dist | ||
publish_branch: gh-pages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules | ||
dist | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2022 LightningChart Ltd. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Parallel Coordinate Chart with Range selector and Data Grid | ||
|
||
![Parallel Coordinate Chart with Range selector and Data Grid](parallelCoordChartRangeSelectors-darkGold.png) | ||
|
||
This demo application belongs to the set of examples for LightningChart JS, data visualization library for JavaScript. | ||
|
||
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. | ||
|
||
The demo can be used as an example or a seed project. Local execution requires the following steps: | ||
|
||
- Make sure that relevant version of [Node.js](https://nodejs.org/en/download/) is installed | ||
- Open the project folder in a terminal: | ||
|
||
npm install # fetches dependencies | ||
npm start # builds an application and starts the development server | ||
|
||
- The application is available at _http://localhost:8080_ in your browser, webpack-dev-server provides hot reload functionality. | ||
|
||
|
||
## Description | ||
|
||
Parallel coordinate chart has a powerful data analysis tool built-in - _Range Selectors_. | ||
|
||
A range selector defines a value range `[start, end]` along 1 specific Axis, and highlights the series whose value is within that range. | ||
|
||
Range selectors can be created in two ways: | ||
|
||
1. Built-in user interaction, double click on any Axis to create a Range selector there. | ||
|
||
2. Programmatically, using `Axis.addRangeSelector` method. | ||
|
||
Range selectors can also be freely moved/resized by dragging on them, or deleted by double clicking on one. | ||
This makes Range selectors a powerful exploratory data analysis tool that allows the user to find relations in data. | ||
|
||
You can also connect custom data analysis scripts to interact with the user interactions. | ||
In this example, the currently highlighted series are displayed in an adjacent `DataGrid`. | ||
|
||
If the chart contains several Range selectors, then only series that pass all the conditions are highlighted. | ||
|
||
## API Links | ||
|
||
|
||
|
||
## Support | ||
|
||
If you notice an error in the example code, please open an issue on [GitHub][0] repository of the entire example. | ||
|
||
Official [API documentation][1] can be found on [LightningChart][2] website. | ||
|
||
If the docs and other materials do not solve your problem as well as implementation help is needed, ask on [StackOverflow][3] (tagged lightningchart). | ||
|
||
If you think you found a bug in the LightningChart JavaScript library, please contact [email protected]. | ||
|
||
Direct developer email support can be purchased through a [Support Plan][4] or by contacting [email protected]. | ||
|
||
[0]: https://github.com/Arction/ | ||
[1]: https://lightningchart.com/lightningchart-js-api-documentation/ | ||
[2]: https://lightningchart.com | ||
[3]: https://stackoverflow.com/questions/tagged/lightningchart | ||
[4]: https://lightningchart.com/support-services/ | ||
|
||
© LightningChart Ltd 2009-2022. All rights reserved. | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"version": "2.0.0", | ||
"scripts": { | ||
"build": "webpack --mode production", | ||
"start": "webpack serve" | ||
}, | ||
"license": "MIT", | ||
"private": true, | ||
"main": "./src/index.js", | ||
"devDependencies": { | ||
"clean-webpack-plugin": "^4.0.0", | ||
"copy-webpack-plugin": "^10.0.0", | ||
"html-webpack-plugin": "^5.5.0", | ||
"webpack": "^5.64.4", | ||
"webpack-cli": "^4.9.1", | ||
"webpack-dev-server": "^4.6.0", | ||
"webpack-stream": "^7.0.0" | ||
}, | ||
"dependencies": { | ||
"@lightningchart/lcjs": "^6.0.0", | ||
"@lightningchart/xydata": "^1.4.0" | ||
}, | ||
"lightningChart": { | ||
"eID": "1705" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
const lcjs = require('@lightningchart/lcjs') | ||
const { lightningChart, Themes, LUT, regularColorSteps, LegendBoxBuilders } = lcjs | ||
|
||
const exampleContainer = document.getElementById('chart') || document.body | ||
if (exampleContainer === document.body) { | ||
exampleContainer.style.width = '100vw' | ||
exampleContainer.style.height = '100vh' | ||
exampleContainer.style.margin = '0px' | ||
} | ||
const containerChart1 = document.createElement('div') | ||
const containerChart2 = document.createElement('div') | ||
exampleContainer.append(containerChart1) | ||
exampleContainer.append(containerChart2) | ||
containerChart1.style.width = '100%' | ||
containerChart1.style.height = '50%' | ||
containerChart2.style.width = '100%' | ||
containerChart2.style.height = '50%' | ||
|
||
const lc = lightningChart({ | ||
resourcesBaseUrl: new URL(document.head.baseURI).origin + new URL(document.head.baseURI).pathname + 'resources/', | ||
}) | ||
const parallelCoordinateChart = lc | ||
.ParallelCoordinateChart({ | ||
container: containerChart1, | ||
theme: Themes[new URLSearchParams(window.location.search).get('theme') || 'darkGold'] || undefined, | ||
}) | ||
.setTitle('Double click on axis to filter') | ||
|
||
const dataGrid = lc | ||
.DataGrid({ | ||
container: containerChart2, | ||
// theme: Themes.darkGold | ||
}) | ||
.setTitle('') | ||
|
||
fetch(document.head.baseURI + 'examples/assets/1702/machine-learning-accuracy-data.json') | ||
.then((r) => r.json()) | ||
.then((data) => { | ||
const theme = parallelCoordinateChart.getTheme() | ||
const Axes = { | ||
batch_size: 0, | ||
channels_one: 1, | ||
learning_rate: 2, | ||
accuracy: 3, | ||
} | ||
parallelCoordinateChart.setAxes(Axes) | ||
parallelCoordinateChart.getAxis(Axes.accuracy).setInterval({ start: 0, end: 1 }) | ||
parallelCoordinateChart.setLUT({ | ||
axis: parallelCoordinateChart.getAxis(Axes.accuracy), | ||
lut: new LUT({ | ||
interpolate: true, | ||
steps: regularColorSteps(0, 1, theme.examples.badGoodColorPalette), | ||
}), | ||
}) | ||
data.forEach((sample) => parallelCoordinateChart.addSeries().setData(sample)) | ||
|
||
const legend = parallelCoordinateChart.addLegendBox(LegendBoxBuilders.VerticalLegendBox).add(parallelCoordinateChart) | ||
parallelCoordinateChart.setPadding({ right: 140 }) | ||
|
||
// Display data of parallel coordinate chart selected series using Data Grid | ||
parallelCoordinateChart.onSelectedSeriesChanged((_, selectedSeries) => { | ||
selectedSeries.sort((a, b) => b.getData()['accuracy'] - a.getData()['accuracy']) | ||
const tableContent = [['batch_size', 'channels_one', 'learning_rate', 'accuracy']] | ||
selectedSeries.forEach((series) => { | ||
const data = series.getData() | ||
const row = [] | ||
tableContent.push(row) | ||
row.push(Math.round(data['batch_size'])) | ||
row.push(Math.round(data['channels_one'])) | ||
row.push(data['learning_rate'].toFixed(3)) | ||
row.push(data['accuracy'].toFixed(3)) | ||
}) | ||
dataGrid | ||
.removeCells() | ||
.setTableContent(tableContent) | ||
.setRowTextFont(0, (font) => font.setWeight('bold')) | ||
}) | ||
|
||
// Add range selector programmatically. | ||
// Range selectors can also be added by double clicking on any Axis. | ||
// Similarly, existing range selectors can be moved by dragging on them, or removed by double clicking on them. | ||
parallelCoordinateChart.getAxis(Axes.accuracy).addRangeSelector().setInterval(0.85, 1.0) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
const HtmlWebpackPlugin = require('html-webpack-plugin') | ||
const { CleanWebpackPlugin } = require('clean-webpack-plugin') | ||
const CopyWebpackPlugin = require('copy-webpack-plugin') | ||
const path = require('path') | ||
const webpack = require('webpack') | ||
|
||
const targetFolderName = 'dist' | ||
const outputPath = path.resolve(__dirname, targetFolderName) | ||
const packageJSON = require('./package.json') | ||
|
||
module.exports = { | ||
mode: 'development', | ||
entry: { | ||
app: packageJSON.main, | ||
}, | ||
devServer: { | ||
static: outputPath, | ||
compress: true, | ||
}, | ||
resolve: { | ||
modules: [path.resolve('./src'), path.resolve('./node_modules')], | ||
extensions: ['.js'], | ||
}, | ||
output: { | ||
filename: 'js/[name].[contenthash].bundle.js', | ||
chunkFilename: 'js/[name].[contenthash].bundle.js', | ||
path: outputPath, | ||
}, | ||
optimization: { | ||
splitChunks: { | ||
chunks: 'all', | ||
cacheGroups: { | ||
// make separate 'vendor' chunk that contains any dependencies | ||
// allows for smaller file sizes and faster builds | ||
vendor: { | ||
test: /[\\/]node_modules[\\/]/, | ||
chunks: 'initial', | ||
name: 'vendor', | ||
priority: -10, | ||
reuseExistingChunk: true, | ||
}, | ||
}, | ||
}, | ||
runtimeChunk: 'single', | ||
}, | ||
plugins: [ | ||
new CleanWebpackPlugin(), | ||
new HtmlWebpackPlugin({ | ||
title: 'app', | ||
filename: path.resolve(__dirname, 'dist', 'index.html'), | ||
}), | ||
new CopyWebpackPlugin({ | ||
patterns: [ | ||
{ | ||
from: './assets/**/*', | ||
to: `./examples/assets/${packageJSON.lightningChart.eID}/[name][ext]`, | ||
noErrorOnMissing: true, | ||
}, | ||
{ | ||
from: './node_modules/@lightningchart/lcjs/dist/resources', | ||
to: 'resources', | ||
noErrorOnMissing: true, | ||
}, | ||
], | ||
}), | ||
new webpack.DefinePlugin({ | ||
LCJS_LICENSE: "'" + process.env.LCJS_LICENSE + "'", | ||
}), | ||
], | ||
} |