From 6602bade283586b9f517a91e5e85d22f89af64e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niilo=20Kein=C3=A4nen?= Date: Thu, 12 Aug 2021 09:21:47 +0300 Subject: [PATCH] Bump to LCJS v.3.1 --- package-lock.json | 18 +++++++++--------- package.json | 2 +- src/app.ts | 19 +++++++++---------- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 10ff040..2c36ff5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,9 +10,9 @@ "integrity": "sha512-/443gMPcZwt+BSH5cy2/sJlYis2zT0IUbllboi/e0Ye4uk58SUloxjMecWjp2sJ7IBCGGpduaE8I73mMQmJGvw==" }, "@arction/lcjs": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@arction/lcjs/-/lcjs-3.0.0.tgz", - "integrity": "sha512-OqGm4P4pmpjwd4nEzJLryAr2A7pyUQCMQ4ruVDhGa9PrpI7RbiGzq/q9ppI8iKyt2eTPhDvC20Vdjdm/CAcvAQ==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@arction/lcjs/-/lcjs-3.1.0.tgz", + "integrity": "sha512-MgzlYga3PN7RpKXJx3SJ/GjdbuOTaoOIdTIcC58BVL8UFk6iXir+p7Tb2TIqlLxO5UHEFxybvuAq6NFLI9qUSw==", "requires": { "@arction/eventer": "^1.0.1", "earcut": "^2.2.2", @@ -2027,9 +2027,9 @@ } }, "earcut": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.2.tgz", - "integrity": "sha512-eZoZPPJcUHnfRZ0PjLvx2qBordSiO8ofC3vt+qACLM95u+4DovnbYNpQtJh0DNsWj8RnxrQytD4WA8gj5cRIaQ==" + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.3.tgz", + "integrity": "sha512-iRDI1QeCQIhMCZk48DRDMVgQSSBDmbzzNhnxIo+pwx3swkfjMh6vh0nWLq1NdvGHLKH6wIrAM3vQWeTj6qeoug==" }, "ee-first": { "version": "1.1.1", @@ -4024,9 +4024,9 @@ "dev": true }, "immutable": { - "version": "4.0.0-rc.12", - "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.0.0-rc.12.tgz", - "integrity": "sha512-0M2XxkZLx/mi3t8NVwIm1g8nHoEmM9p9UBl/G9k4+hm0kBgOVdMV/B3CY5dQ8qG8qc80NN4gDV4HQv6FTJ5q7A==" + "version": "4.0.0-rc.14", + "resolved": "https://registry.npmjs.org/immutable/-/immutable-4.0.0-rc.14.tgz", + "integrity": "sha512-pfkvmRKJSoW7JFx0QeYlAmT+kNYvn5j0u7bnpNq4N2RCvHSTlLT208G8jgaquNe+Q8kCPHKOSpxJkyvLDpYq0w==" }, "import-local": { "version": "2.0.0", diff --git a/package.json b/package.json index 1676ad4..093b679 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "webpack-dev-server": "^3.11.0" }, "dependencies": { - "@arction/lcjs": "^3.0.0", + "@arction/lcjs": "^3.1.0", "@arction/xydata": "^1.4.0" } } diff --git a/src/app.ts b/src/app.ts index 3548910..c8b96ee 100644 --- a/src/app.ts +++ b/src/app.ts @@ -3,9 +3,9 @@ import { createProgressiveTraceGenerator } from "@arction/xydata" // Use theme if provided const urlParams = new URLSearchParams(window.location.search); -let theme = Themes.dark +let theme = Themes.darkGold if (urlParams.get('theme') == 'light') - theme = Themes.light + theme = Themes.lightNew let dataAmount = 1 * 1000 * 1000 @@ -69,7 +69,7 @@ const measureRenderingSpeed = () => { const tNow = window.performance.now() const delay = tNow - tStart // Display result using UI indicator. - indicatorRenderingSpeed.setText(`Rendering speed (${(dataAmount / (1 * 1000 * 1000)).toFixed(1)}M data-points): ${delay.toFixed(0)} ms`) + indicatorRenderingSpeed.setText(`${(delay / 1000).toFixed(3)} seconds`) }) }) } @@ -86,20 +86,19 @@ const indicatorLayout = chart.addUIElement>( ) .setOrigin(UIOrigins.LeftTop) .setDraggingMode(UIDraggingModes.notDraggable) - // Set dark, tinted Background style. - .setBackground((background) => background - .setFillStyle(new SolidFill({ color: theme.seriesBackgroundFillStyle.get('color').setA(150) })) - .setStrokeStyle(emptyLine) - ) + // Reposition indicators whenever Axis scale is changed (to keep position static). const repositionIndicator = () => indicatorLayout.setPosition({ x: axisX.getInterval().start, y: axisY.getInterval().end }) repositionIndicator() axisX.onScaleChange(repositionIndicator) axisY.onScaleChange(repositionIndicator) + +indicatorLayout.addElement(UIElementBuilders.TextBox) + .setText(`Rendering speed ${(dataAmount / (1 * 1000 * 1000)).toFixed(1)} million data points:`) + // Rendering speed indicator. -const indicatorRenderingSpeed = indicatorLayout.addElement>(UIElementBuilders.TextBox) - .setText('Rendering ...') +const indicatorRenderingSpeed = indicatorLayout.addElement(UIElementBuilders.TextBox) .setTextFont((font) => font .setWeight('bold') )