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 20aecb3 commit e2a73c2
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 106 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ Direct developer email support can be purchased through a [Support Plan][4] or b
© LightningChart Ltd 2009-2022. All rights reserved.


[Dashboard]: https://lightningchart.com/js-charts/api-documentation/v5.2.0/classes/Dashboard.html
[Map Chart]: https://lightningchart.com/js-charts/api-documentation/v5.2.0/classes/MapChart.html
[Chart XY]: https://lightningchart.com/js-charts/api-documentation/v5.2.0/classes/ChartXY.html
[Axis]: https://lightningchart.com/js-charts/api-documentation/v5.2.0/classes/Axis.html
[Axis scroll strategies]: https://lightningchart.com/js-charts/api-documentation/v5.2.0/variables/AxisScrollStrategies.html
[Axis tick strategies]: https://lightningchart.com/js-charts/api-documentation/v5.2.0/variables/AxisTickStrategies.html
[Lookup table]: https://lightningchart.com/js-charts/api-documentation/v5.2.0/classes/LUT.html
[Line series]: https://lightningchart.com/js-charts/api-documentation/v5.2.0/classes/LineSeries.html
[Point series]: https://lightningchart.com/js-charts/api-documentation/v5.2.0/classes/PointSeries.html
[Band]: https://lightningchart.com/js-charts/api-documentation/v5.2.0/classes/Band.html
[Dashboard]: https://lightningchart.com/js-charts/api-documentation/v6.0.0/classes/Dashboard.html
[Map Chart]: https://lightningchart.com/js-charts/api-documentation/v6.0.0/classes/MapChart.html
[Chart XY]: https://lightningchart.com/js-charts/api-documentation/v6.0.0/classes/ChartXY.html
[Axis]: https://lightningchart.com/js-charts/api-documentation/v6.0.0/classes/Axis.html
[Axis scroll strategies]: https://lightningchart.com/js-charts/api-documentation/v6.0.0/variables/AxisScrollStrategies.html
[Axis tick strategies]: https://lightningchart.com/js-charts/api-documentation/v6.0.0/variables/AxisTickStrategies.html
[Lookup table]: https://lightningchart.com/js-charts/api-documentation/v6.0.0/classes/LUT.html
[Line series]: https://lightningchart.com/js-charts/api-documentation/v6.0.0/classes/LineSeries.html
[Point series]: https://lightningchart.com/js-charts/api-documentation/v6.0.0/classes/PointSeries.html
[Band]: https://lightningchart.com/js-charts/api-documentation/v6.0.0/classes/Band.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": "1111"
Expand Down
47 changes: 18 additions & 29 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* In-depth example of map dashboard with data drill-down. Visualizes relations between CoVID vaccinations and cases
*/

const lcjs = require('@arction/lcjs')
const lcjs = require('@lightningchart/lcjs')
const {
AxisScrollStrategies,
AxisTickStrategies,
Expand All @@ -21,7 +21,6 @@ const {
SolidFill,
emptyLine,
synchronizeAxisIntervals,
translatePoint,
transparentFill,
UIOrigins,
MouseStyles,
Expand Down Expand Up @@ -228,7 +227,7 @@ dashboard.onResize(() => {
rowIndex: 1,
})
.setTitle('Global CoVID daily new cases history')
.setAutoCursorMode(AutoCursorModes.disabled)
.setCursorMode(undefined)
.setMouseInteractions(false)

const timeLineHighlighterAxis = timelineChart
Expand All @@ -243,10 +242,7 @@ dashboard.onResize(() => {
.setTextFormatter((time) => new Date(time).toLocaleDateString('fin', {}))
synchronizeAxisIntervals(timelineChart.getDefaultAxisX(), timeLineHighlighterAxis)

timelineChart
.addLineSeries({ dataPattern: { pattern: 'ProgressiveX' } })
.setCursorInterpolationEnabled(false)
.add(newCasesHistoryDataXY)
timelineChart.addLineSeries({ dataPattern: { pattern: 'ProgressiveX' } }).add(newCasesHistoryDataXY)
timelineChart
.getDefaultAxisY()
.setMouseInteractions(false)
Expand All @@ -263,7 +259,6 @@ dashboard.onResize(() => {
.setInterval({ start: 0, end: 100 })
timelineChart
.addLineSeries({ dataPattern: { pattern: 'ProgressiveX' }, yAxis: axisVaccinated })
.setCursorInterpolationEnabled(false)
.add(vaccinatedPerHundredHistoryDataXY)
.setStrokeStyle(
new SolidLine({
Expand Down Expand Up @@ -334,7 +329,7 @@ dashboard.onResize(() => {
rowIndex: 0,
type: mapType,
})
.setAutoCursorMode(AutoCursorModes.disabled)
.setCursorMode(undefined)
.setMouseInteractions(false)
.setPadding({ top: 40 })

Expand All @@ -347,7 +342,7 @@ dashboard.onResize(() => {
.setBackgroundFillStyle(transparentFill)
.setSeriesBackgroundFillStyle(transparentFill)
.setSeriesBackgroundStrokeStyle(emptyLine)
.setAutoCursorMode(AutoCursorModes.disabled)
.setCursorMode(undefined)
.setMouseInteractions(false)

mapChartXY.forEachAxis((axis) => axis.setTickStrategy(AxisTickStrategies.Empty).setStrokeStyle(emptyLine))
Expand Down Expand Up @@ -376,12 +371,12 @@ dashboard.onResize(() => {
)

const scatterSeries = mapChartXY
.addPointSeries({ pointShape: PointShape.Circle })
.setIndividualPointSizeEnabled(true)
.setIndividualPointValueEnabled(true)
.addPointLineAreaSeries({ dataPattern: null, sizes: true, lookupValues: true, ids: true })
.setStrokeStyle(emptyLine)
.setPointFillStyle(new PalettedFill({ lut: lutNewCasesPerMillion }))
.setMouseInteractions(false)

let regions = []
const setDisplayTime = (time, updateTimeLineBand = false) => {
activeDisplayedTime = time
const timeNumber = time.getTime()
Expand All @@ -391,6 +386,8 @@ dashboard.onResize(() => {

scatterSeries.clear()

let iRegion = 0
regions = []
mapChart.invalidateRegionValues((region, prev) => {
const countryCode = region.ISO_A3
const countryCovidData = covidData[countryCode]
Expand Down Expand Up @@ -421,14 +418,14 @@ dashboard.onResize(() => {
? 0
: clampNumber((25 * smoothedNewCasesPerMillion) / 1000, mapType === 'World' ? 1 : 5, 25)
scatterSeries.add({
countryCode,
smoothedNewCasesPerMillion,
peopleVaccinatedPerHundred,
id: iRegion,
x: longitude,
y: latitude,
value: smoothedNewCasesPerMillion,
lookupValue: smoothedNewCasesPerMillion,
size: pointSize,
})
regions.push(region)
iRegion += 1

// Return value is used for map region coloring.
return peopleVaccinatedPerHundred
Expand Down Expand Up @@ -494,7 +491,6 @@ dashboard.onResize(() => {
return {
series: chartOverlayCursor
.addLineSeries({ yAxis, dataPattern: { pattern: 'ProgressiveX' } })
.setCursorInterpolationEnabled(false)
.setStrokeStyle((stroke) => stroke.setFillStyle(fill)),
label: ChartOverlayItem(label).setTextFillStyle(fill),
valueLabel: chartOverlayCursor
Expand Down Expand Up @@ -568,9 +564,10 @@ dashboard.onResize(() => {
})

mapChartXY.onSeriesBackgroundMouseMove((_, event) => {
const nearest = scatterSeries.solveNearestFromScreen(event)
if (nearest) {
cursorTarget = nearest.location
const nearest = scatterSeries.solveNearest(event)
const region = regions[nearest?.id]
if (nearest && region) {
cursorTarget = { countryCode: region.ISO_A3, ...nearest }
cursorLastPointedCountry = cursorTarget.countryCode
}
})
Expand Down Expand Up @@ -839,10 +836,6 @@ dashboard.onResize(() => {
dataPattern: { pattern: 'ProgressiveX' },
})
.setName(`${countryInformation.name.common}`)
.setCursorInterpolationEnabled(false)
.setCursorResultTableFormatter((builder, _, x, y, dataPoint) =>
builder.addRow(`${countryInformation.name.common}`).addRow(axisX.formatValue(dataPoint.x)).addRow(trend.format(y)),
)
const dataXY = trend.dataSet.data
.map((sample) => ({
x: ISODateToTime(sample.date),
Expand All @@ -859,10 +852,6 @@ dashboard.onResize(() => {
dataPattern: { pattern: 'ProgressiveX' },
})
.setName('Global average')
.setCursorInterpolationEnabled(false)
.setCursorResultTableFormatter((builder, _, x, y, dataPoint) =>
builder.addRow(`Global average`).addRow(axisX.formatValue(dataPoint.x)).addRow(trend.format(y)),
)
.add(averageData)
const styleNormal = series.getStrokeStyle()
seriesAverage.setStrokeStyle(styleNormal.setFillStyle(styleNormal.getFillStyle().setA(100)))
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 e2a73c2

Please sign in to comment.