No need to re-assign

This commit is contained in:
Nathan Bierema 2023-01-02 10:49:50 -05:00
parent 976e62c4ab
commit 71be671e6b
2 changed files with 9 additions and 11 deletions

View File

@ -164,23 +164,22 @@ export default function (DOMNode: HTMLElement, options: Partial<Options> = {}) {
const root = d3.select(DOMNode);
const zoom = d3.zoom<SVGSVGElement, unknown>().scaleExtent([0.1, 3]);
let svgElement = root
const svgElement = root
.append('svg')
.attr('id', id)
.attr('preserveAspectRatio', 'xMinYMin slice');
.attr('preserveAspectRatio', 'xMinYMin slice')
.style('cursor', '-webkit-grab');
if (!chartStyles.width) {
svgElement = svgElement.attr('width', fullWidth);
svgElement.attr('width', fullWidth);
}
if (!chartStyles.width || !chartStyles.height) {
svgElement = svgElement.attr('viewBox', `0 0 ${fullWidth} ${fullHeight}`);
svgElement.attr('viewBox', `0 0 ${fullWidth} ${fullHeight}`);
}
svgElement = svgElement.style('cursor', '-webkit-grab');
for (const [key, value] of Object.entries(chartStyles)) {
svgElement = svgElement.style(key, value);
svgElement.style(key, value);
}
const vis = svgElement

View File

@ -95,13 +95,12 @@ export function tooltip<
.style('position', 'absolute')
.style('z-index', 1001)
.style('left', `${x}px`)
.style('top', `${y}px`);
.style('top', `${y}px`)
.html(() => text(node));
for (const [key, value] of Object.entries(styles)) {
el = el.style(key, value);
el.style(key, value);
}
el = el.html(() => text(node));
});
selection.on('mousemove.tip', (node) => {