Skip to content

Commit 1ed87b1

Browse files
author
Niilo Keinänen
committed
Update examples
1 parent 7294730 commit 1ed87b1

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

src/index.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
window.lcjsSmallView = window.devicePixelRatio >= 2
2+
if (!window.__lcjsDebugOverlay) {
3+
window.__lcjsDebugOverlay = document.createElement('div')
4+
window.__lcjsDebugOverlay.style.cssText = 'position:fixed;top:10px;left:10px;background:rgba(0,0,0,0.7);color:#fff;padding:4px 8px;z-index:99999;font:12px monospace;pointer-events:none'
5+
const attach = () => { if (document.body && !window.__lcjsDebugOverlay.parentNode) document.body.appendChild(window.__lcjsDebugOverlay) }
6+
attach()
7+
setInterval(() => {
8+
attach()
9+
window.__lcjsDebugOverlay.textContent = window.innerWidth + 'x' + window.innerHeight + ' dpr=' + window.devicePixelRatio + ' small=' + window.lcjsSmallView
10+
}, 500)
11+
}
112
/*
213
* LightningChartJS example that showcases LineSeries in a 3D Chart.
314
*/
@@ -33,19 +44,9 @@ const chart3D = lightningChart({
3344
.Chart3D({
3445
theme: (() => {
3546
const t = Themes[new URLSearchParams(window.location.search).get('theme') || 'darkGold'] || undefined
36-
const smallView = window.devicePixelRatio >= 2
37-
if (!window.__lcjsDebugOverlay) {
38-
window.__lcjsDebugOverlay = document.createElement('div')
39-
window.__lcjsDebugOverlay.style.cssText = 'position:fixed;top:0;left:0;background:rgba(0,0,0,0.7);color:#fff;padding:4px 8px;z-index:99999;font:12px monospace;pointer-events:none'
40-
if (document.body) document.body.appendChild(window.__lcjsDebugOverlay)
41-
setInterval(() => {
42-
if (!window.__lcjsDebugOverlay.parentNode && document.body) document.body.appendChild(window.__lcjsDebugOverlay)
43-
window.__lcjsDebugOverlay.textContent = window.innerWidth + 'x' + window.innerHeight + ' dpr=' + window.devicePixelRatio + ' small=' + (window.devicePixelRatio >= 2)
44-
}, 500)
45-
}
46-
return t && smallView ? lcjs.scaleTheme(t, 0.5) : t
47+
return t && window.lcjsSmallView ? lcjs.scaleTheme(t, 0.5) : t
4748
})(),
48-
textRenderer: window.devicePixelRatio >= 2 ? lcjs.htmlTextRenderer : undefined,
49+
textRenderer: window.lcjsSmallView ? lcjs.htmlTextRenderer : undefined,
4950
})
5051
.setTitle('Simple 3D Surface Mesh')
5152

0 commit comments

Comments
 (0)