betodealmeida removed a comment on issue #7690: [SQL Lab] Improve result table rendering performance URL: https://github.com/apache/incubator-superset/pull/7690#issuecomment-501443981 @etr2460 something like this: ```javascript const SVG_NS = 'http://www.w3.org/2000/svg'; const STYLE_FIELDS = [ 'font', 'fontWeight', 'fontStyle', 'fontSize', 'fontFamily', 'letterSpacing', ]; const textNode = document.createElementNS(SVG_NS, 'text'); const svg = document.createElementNS(SVG_NS, 'svg'); svg.style.position = 'absolute'; // so it won't disrupt page layout svg.style.opacity = '0'; // and not visible svg.style.pointerEvents = 'none'; // and not capturing mouse events svg.appendChild(textNode); document.body.appendChild(svg); function getTextDimension(input) { const { text, className, style = {} } = input; textNode.textContent = text; if (className !== undefined && className !== null) { textNode.setAttribute('class', className); } STYLE_FIELDS.filter( field => style[field] !== undefined && style[field] !== null, ).forEach((field) => { textNode.style[field] = `${style[field]}`; }); const bbox = textNode.getBBox(); return { height: Math.ceil(bbox.height), width: Math.ceil(bbox.width), }; } ```
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
