|
| 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 | const lcjs = require('@lightningchart/lcjs') |
2 | 13 | const { |
3 | 14 | lightningChart, |
@@ -47,19 +58,9 @@ const chart1 = lc |
47 | 58 | defaultAxisY: { type: 'linear-highPrecision' }, |
48 | 59 | theme: (() => { |
49 | 60 | const t = Themes[new URLSearchParams(window.location.search).get('theme') || 'darkGold'] || undefined |
50 | | - const smallView = window.devicePixelRatio >= 2 |
51 | | - if (!window.__lcjsDebugOverlay) { |
52 | | - window.__lcjsDebugOverlay = document.createElement('div') |
53 | | - 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' |
54 | | - if (document.body) document.body.appendChild(window.__lcjsDebugOverlay) |
55 | | - setInterval(() => { |
56 | | - if (!window.__lcjsDebugOverlay.parentNode && document.body) document.body.appendChild(window.__lcjsDebugOverlay) |
57 | | - window.__lcjsDebugOverlay.textContent = window.innerWidth + 'x' + window.innerHeight + ' dpr=' + window.devicePixelRatio + ' small=' + (window.devicePixelRatio >= 2) |
58 | | - }, 500) |
59 | | - } |
60 | | - return t && smallView ? lcjs.scaleTheme(t, 0.5) : t |
| 61 | + return t && window.lcjsSmallView ? lcjs.scaleTheme(t, 0.5) : t |
61 | 62 | })(), |
62 | | -textRenderer: window.devicePixelRatio >= 2 ? lcjs.htmlTextRenderer : undefined, |
| 63 | +textRenderer: window.lcjsSmallView ? lcjs.htmlTextRenderer : undefined, |
63 | 64 | }) |
64 | 65 | .setTitle('Scrolling Heatmap - No Aggregation') |
65 | 66 | .setTitleMargin({ top: 10, bottom: 10 }) |
@@ -118,7 +119,11 @@ const chart2 = lc |
118 | 119 | container: containerChart2, |
119 | 120 | defaultAxisX: { type: 'linear-highPrecision' }, |
120 | 121 | defaultAxisY: { type: 'linear-highPrecision' }, |
121 | | - // theme: Themes.darkGold |
| 122 | + theme: (() => { |
| 123 | + const t = Themes[new URLSearchParams(window.location.search).get('theme') || 'darkGold'] || undefined |
| 124 | + return t && window.lcjsSmallView ? lcjs.scaleTheme(t, 0.5) : t |
| 125 | +})(), |
| 126 | +textRenderer: window.lcjsSmallView ? lcjs.htmlTextRenderer : undefined, |
122 | 127 | }) |
123 | 128 | .setTitle('Scrolling Heatmap - Aggregation (Max)') |
124 | 129 | .setTitleMargin({ top: 10, bottom: 10 }) |
|
0 commit comments