|
| 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 | +} |
1 | 12 | /* |
2 | 13 | * LightningChartJS example that showcases a real life application used in Fiber Monitoring |
3 | 14 | */ |
@@ -89,19 +100,9 @@ const chart = lightningChart({ |
89 | 100 | legend: { addEntriesAutomatically: false }, |
90 | 101 | theme: (() => { |
91 | 102 | const t = Themes[new URLSearchParams(window.location.search).get('theme') || 'darkGold'] || undefined |
92 | | - const smallView = window.devicePixelRatio >= 2 |
93 | | - if (!window.__lcjsDebugOverlay) { |
94 | | - window.__lcjsDebugOverlay = document.createElement('div') |
95 | | - 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' |
96 | | - if (document.body) document.body.appendChild(window.__lcjsDebugOverlay) |
97 | | - setInterval(() => { |
98 | | - if (!window.__lcjsDebugOverlay.parentNode && document.body) document.body.appendChild(window.__lcjsDebugOverlay) |
99 | | - window.__lcjsDebugOverlay.textContent = window.innerWidth + 'x' + window.innerHeight + ' dpr=' + window.devicePixelRatio + ' small=' + (window.devicePixelRatio >= 2) |
100 | | - }, 500) |
101 | | - } |
102 | | - return t && smallView ? lcjs.scaleTheme(t, 0.5) : t |
| 103 | + return t && window.lcjsSmallView ? lcjs.scaleTheme(t, 0.5) : t |
103 | 104 | })(), |
104 | | -textRenderer: window.devicePixelRatio >= 2 ? lcjs.htmlTextRenderer : undefined, |
| 105 | +textRenderer: window.lcjsSmallView ? lcjs.htmlTextRenderer : undefined, |
105 | 106 | }) |
106 | 107 | .setTitle('Distance Intensity Chart') |
107 | 108 |
|
|
0 commit comments