|
| 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, |
@@ -46,19 +57,9 @@ const chart3D = lc |
46 | 57 | }, |
47 | 58 | theme: (() => { |
48 | 59 | const t = Themes[new URLSearchParams(window.location.search).get('theme') || 'darkGold'] || undefined |
49 | | - const smallView = window.devicePixelRatio >= 2 |
50 | | - if (!window.__lcjsDebugOverlay) { |
51 | | - window.__lcjsDebugOverlay = document.createElement('div') |
52 | | - 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' |
53 | | - if (document.body) document.body.appendChild(window.__lcjsDebugOverlay) |
54 | | - setInterval(() => { |
55 | | - if (!window.__lcjsDebugOverlay.parentNode && document.body) document.body.appendChild(window.__lcjsDebugOverlay) |
56 | | - window.__lcjsDebugOverlay.textContent = window.innerWidth + 'x' + window.innerHeight + ' dpr=' + window.devicePixelRatio + ' small=' + (window.devicePixelRatio >= 2) |
57 | | - }, 500) |
58 | | - } |
59 | | - return t && smallView ? lcjs.scaleTheme(t, 0.5) : t |
| 60 | + return t && window.lcjsSmallView ? lcjs.scaleTheme(t, 0.5) : t |
60 | 61 | })(), |
61 | | -textRenderer: window.devicePixelRatio >= 2 ? lcjs.htmlTextRenderer : undefined, |
| 62 | +textRenderer: window.lcjsSmallView ? lcjs.htmlTextRenderer : undefined, |
62 | 63 | }) |
63 | 64 | .setTitle('3D view — select a point to update 2D slices') |
64 | 65 | .setTitleMargin(0) |
@@ -101,7 +102,11 @@ const chartWD = lc |
101 | 102 | legend: { |
102 | 103 | visible: false, |
103 | 104 | }, |
104 | | - // theme: Themes.darkGold |
| 105 | + theme: (() => { |
| 106 | + const t = Themes[new URLSearchParams(window.location.search).get('theme') || 'darkGold'] || undefined |
| 107 | + return t && window.lcjsSmallView ? lcjs.scaleTheme(t, 0.5) : t |
| 108 | +})(), |
| 109 | +textRenderer: window.lcjsSmallView ? lcjs.htmlTextRenderer : undefined, |
105 | 110 | }) |
106 | 111 | .setTitle('Width vs Depth') |
107 | 112 | .setUserInteractions(undefined) |
@@ -137,7 +142,11 @@ const chartWH = lc |
137 | 142 | legend: { |
138 | 143 | visible: false, |
139 | 144 | }, |
140 | | - // theme: Themes.darkGold |
| 145 | + theme: (() => { |
| 146 | + const t = Themes[new URLSearchParams(window.location.search).get('theme') || 'darkGold'] || undefined |
| 147 | + return t && window.lcjsSmallView ? lcjs.scaleTheme(t, 0.5) : t |
| 148 | +})(), |
| 149 | +textRenderer: window.lcjsSmallView ? lcjs.htmlTextRenderer : undefined, |
141 | 150 | }) |
142 | 151 | .setTitle('Width vs Height') |
143 | 152 | .setUserInteractions(undefined) |
@@ -173,7 +182,11 @@ const chartDH = lc |
173 | 182 | legend: { |
174 | 183 | visible: false, |
175 | 184 | }, |
176 | | - // theme: Themes.darkGold |
| 185 | + theme: (() => { |
| 186 | + const t = Themes[new URLSearchParams(window.location.search).get('theme') || 'darkGold'] || undefined |
| 187 | + return t && window.lcjsSmallView ? lcjs.scaleTheme(t, 0.5) : t |
| 188 | +})(), |
| 189 | +textRenderer: window.lcjsSmallView ? lcjs.htmlTextRenderer : undefined, |
177 | 190 | }) |
178 | 191 | .setTitle('Depth vs Height') |
179 | 192 | .setUserInteractions(undefined) |
|
0 commit comments