Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
Niilo Keinänen committed Aug 5, 2024
0 parents commit c14f101
Show file tree
Hide file tree
Showing 12 changed files with 238 additions and 0 deletions.
31 changes: 31 additions & 0 deletions .github/workflows/gh-pages-deploy.yml
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
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
21 changes: 21 additions & 0 deletions LICENSE
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.
70 changes: 70 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# JavaScript Gauge Chart

![JavaScript Gauge Chart](gaugeChart-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

This example shows a basic view of the new reworked gauge chart.

The gauge can be created with a simple line of code.

```javascript
const gauge = lightningChart().Gauge()
```

After creating the Gauge Chart the value for it can be set simply.

```javascript
gauge
// Set start and end values.
.setInterval(0, 120)
// Set the displayed value.
.setValue(60)
// Set the unit label of the value.
.setUnitLabel('km/h')
```


## API Links

* [Gauge Chart]


## 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.


[Gauge Chart]: https://lightningchart.com/js-charts/api-documentation/v6.0.0/classes/GaugeChart.html

Binary file added gaugeChart-cyberSpace.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gaugeChart-darkGold.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gaugeChart-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gaugeChart-lightNature.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added gaugeChart-turquoiseHexagon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions package.json
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": "1600"
}
}
18 changes: 18 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const lcjs = require('@lightningchart/lcjs')
const { lightningChart, Themes } = lcjs

// Create a Gauge chart
const gauge = lightningChart({
resourcesBaseUrl: new URL(document.head.baseURI).origin + new URL(document.head.baseURI).pathname + 'resources/',
})
.Gauge({
theme: Themes[new URLSearchParams(window.location.search).get('theme') || 'darkGold'] || undefined,
})
.setTitle('Speed')
.setUnitLabel('km/h')
.setInterval(0, 120)

// Randomize gauge value every 2 seconds
setInterval(() => {
gauge.setValue(Math.random() * 120)
}, 2000)
70 changes: 70 additions & 0 deletions webpack.config.js
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 + "'",
}),
],
}

0 comments on commit c14f101

Please sign in to comment.