|
| 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 { AxisTickStrategies, emptyTick, FormattingFunctions, SolidLine, emptyFill, SolidFill, lightningChart, DataSetXY, Themes } = lcjs |
3 | 14 |
|
@@ -65,19 +76,9 @@ const setDrillDown = (() => { |
65 | 76 | defaultAxisX: { type: 'linear-highPrecision' }, |
66 | 77 | theme: (() => { |
67 | 78 | const t = Themes[new URLSearchParams(window.location.search).get('theme') || 'darkGold'] || undefined |
68 | | - const smallView = window.devicePixelRatio >= 2 |
69 | | - if (!window.__lcjsDebugOverlay) { |
70 | | - window.__lcjsDebugOverlay = document.createElement('div') |
71 | | - 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' |
72 | | - if (document.body) document.body.appendChild(window.__lcjsDebugOverlay) |
73 | | - setInterval(() => { |
74 | | - if (!window.__lcjsDebugOverlay.parentNode && document.body) document.body.appendChild(window.__lcjsDebugOverlay) |
75 | | - window.__lcjsDebugOverlay.textContent = window.innerWidth + 'x' + window.innerHeight + ' dpr=' + window.devicePixelRatio + ' small=' + (window.devicePixelRatio >= 2) |
76 | | - }, 500) |
77 | | - } |
78 | | - return t && smallView ? lcjs.scaleTheme(t, 0.5) : t |
| 79 | + return t && window.lcjsSmallView ? lcjs.scaleTheme(t, 0.5) : t |
79 | 80 | })(), |
80 | | -textRenderer: window.devicePixelRatio >= 2 ? lcjs.htmlTextRenderer : undefined, |
| 81 | +textRenderer: window.lcjsSmallView ? lcjs.htmlTextRenderer : undefined, |
81 | 82 | }) |
82 | 83 | .setTitle(name) |
83 | 84 | .setCursor((cursor) => cursor.setTickMarkerXVisible(false)) |
@@ -138,7 +139,11 @@ textRenderer: window.devicePixelRatio >= 2 ? lcjs.htmlTextRenderer : undefined, |
138 | 139 | setTimeout(async () => { |
139 | 140 | const dataGrid = lc.DataGrid({ |
140 | 141 | container: containerDataGrid, |
141 | | - // theme: Themes.darkGold |
| 142 | + theme: (() => { |
| 143 | + const t = Themes[new URLSearchParams(window.location.search).get('theme') || 'darkGold'] || undefined |
| 144 | + return t && window.lcjsSmallView ? lcjs.scaleTheme(t, 0.5) : t |
| 145 | +})(), |
| 146 | +textRenderer: window.lcjsSmallView ? lcjs.htmlTextRenderer : undefined, |
142 | 147 | }) |
143 | 148 |
|
144 | 149 | const gridColHighlight = 0 |
|
0 commit comments