Skip to content

Commit

Permalink
v6.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Niilo Keinänen committed Aug 5, 2024
1 parent 763530f commit 8b2adf3
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 108 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Direct developer email support can be purchased through a [Support Plan][4] or b
© LightningChart Ltd 2009-2022. All rights reserved.


[Data Grid]: https://lightningchart.com/js-charts/api-documentation/v5.2.0/classes/DataGrid.html
[Chart XY]: https://lightningchart.com/js-charts/api-documentation/v5.2.0/classes/ChartXY.html
[Spark Chart]: https://lightningchart.com/js-charts/api-documentation/v5.2.0/types/SparkChart.html
[Data Grid]: https://lightningchart.com/js-charts/api-documentation/v6.0.0/classes/DataGrid.html
[Chart XY]: https://lightningchart.com/js-charts/api-documentation/v6.0.0/classes/ChartXY.html
[Spark Chart]: https://lightningchart.com/js-charts/api-documentation/v6.0.0/types/SparkChart.html

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
"webpack-stream": "^7.0.0"
},
"dependencies": {
"@arction/xydata": "^1.4.0",
"@arction/lcjs": "^5.2.0"
"@lightningchart/lcjs": "^6.0.0",
"@lightningchart/xydata": "^1.4.0"
},
"lightningChart": {
"eID": "1300"
Expand Down
56 changes: 18 additions & 38 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const lcjs = require('@arction/lcjs')
const lcjs = require('@lightningchart/lcjs')
const { AxisTickStrategies, emptyTick, FormattingFunctions, SolidLine, emptyFill, SolidFill, lightningChart, Themes } = lcjs

const highlightIntensity = 0.2 // [0, 1]
Expand Down Expand Up @@ -70,6 +70,7 @@ const setDrillDown = (() => {
theme: Themes[new URLSearchParams(window.location.search).get('theme') || 'darkGold'] || undefined,
})
.setTitle(name)
.setCursor((cursor) => cursor.setTickMarkerXVisible(false))
chart
.getDefaultAxisX()
.setTickStrategy(AxisTickStrategies.DateTime)
Expand All @@ -78,68 +79,47 @@ const setDrillDown = (() => {
endMax: state.dataMax,
}))
chart.getDefaultAxisY().dispose()
const axisRate = chart.addAxisY({ iStack: 3 }).setTitle(`Rate $`).setMargins(10, 0)
const axisRate = chart.addAxisY({ iStack: 3 }).setTitle(`Rate`).setUnits('$').setMargins(10, 0)
const seriesRate = chart
.addPointLineAreaSeries({ dataPattern: 'ProgressiveX', yAxis: axisRate })
.setAreaFillStyle(emptyFill)
.setName(`${name} Rate $`)
.appendJSON(coinData.map((p) => ({ x: p.date, y: p.rate })))
.setCursorResultTableFormatter((builder, series, dataPoint) =>
builder
.addRow(series.getName())
.addRow(timeAxis.formatValue(dataPoint.x))
.addRow(`$${series.axisY.formatValue(dataPoint.y)}`),
)
.setName(`${name} Rate`)
.appendJSON(coinData, { x: 'date', y: 'rate' })

const axisVolume = chart
.addAxisY({ iStack: 2 })
.setTitle(`Volume $`)
.setTitle(`Volume`)
.setUnits('$')
.setMargins(10, 10)
.setTickStrategy(AxisTickStrategies.Numeric, (ticks) => ticks.setFormattingFunction(FormattingFunctions.NumericUnits))
const seriesVolume = chart
.addAreaSeries({ yAxis: axisVolume })
.setName(`${name} Volume $`)
.add(coinData.map((p) => ({ x: p.date, y: p.volume })))
.setCursorResultTableFormatter((builder, series, x, high, low) =>
builder
.addRow(series.getName())
.addRow(timeAxis.formatValue(x))
.addRow(`$${(high / 10 ** 9).toFixed(3)} B`),
)
.addPointLineAreaSeries({ dataPattern: 'ProgressiveX', yAxis: axisVolume })
.setName(`${name} Volume`)
.appendJSON(coinData, { x: 'date', y: 'volume' })

const axisLiquidity = chart
.addAxisY({ iStack: 1 })
.setTitle(`Liquidity $`)
.setTitle(`Liquidity`)
.setUnits('$')
.setMargins(10, 10)
.setTickStrategy(AxisTickStrategies.Numeric, (ticks) => ticks.setFormattingFunction(FormattingFunctions.NumericUnits))
const seriesLiquidity = chart
.addPointLineAreaSeries({ dataPattern: 'ProgressiveX', yAxis: axisLiquidity })
.setAreaFillStyle(emptyFill)
.setName(`${name} Liquidity $`)
.add(coinData.map((p) => ({ x: p.date, y: p.liquidity })))
.setCursorResultTableFormatter((builder, series, dataPoint) =>
builder
.addRow(series.getName())
.addRow(timeAxis.formatValue(dataPoint.x))
.addRow(`$${series.axisY.formatValue(dataPoint.y)}`),
)
.setName(`${name} Liquidity`)
.appendJSON(coinData, { x: 'date', y: 'liquidity' })

const axisCap = chart
.addAxisY({ iStack: 0 })
.setTitle(`Market Cap $`)
.setTitle(`Market Cap`)
.setUnits('$')
.setMargins(0, 10)
.setTickStrategy(AxisTickStrategies.Numeric, (ticks) => ticks.setFormattingFunction(FormattingFunctions.NumericUnits))
const seriesCap = chart
.addPointLineAreaSeries({ dataPattern: 'ProgressiveX', yAxis: axisCap })
.setAreaFillStyle(emptyFill)
.setName(`${name} Market Cap $`)
.add(coinData.map((p) => ({ x: p.date, y: p.cap })))
.setCursorResultTableFormatter((builder, series, dataPoint) =>
builder
.addRow(series.getName())
.addRow(timeAxis.formatValue(dataPoint.x))
.addRow(`$${series.axisY.formatValue(dataPoint.y)}`),
)
.setName(`${name} Market Cap`)
.appendJSON(coinData, { x: 'date', y: 'cap' })

chart.forEachAxis((axis) => axis.setAnimationScroll(false))
const timeAxis = chart.getDefaultAxisX()
Expand Down
130 changes: 65 additions & 65 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,70 +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 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");
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,
},
},
mode: 'development',
entry: {
app: packageJSON.main,
},
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/@arction/lcjs/dist/resources",
to: "resources",
noErrorOnMissing: true,
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,
},
},
},
],
}),
new webpack.DefinePlugin({
LCJS_LICENSE: "'" + process.env.LCJS_LICENSE + "'",
}),
],
};
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 8b2adf3

Please sign in to comment.