in packages/timebrush/src/TimeBrush.ts [690:716]
private undoPBIScale(width: number, height: number, margin: any) {
const actualDims = this.element[0].getBoundingClientRect();
const actualWidth = actualDims.right - actualDims.left;
// Default to 1 if we have no data
const scale = actualWidth > 0 && this.dimensions.width > 0 ? this.dimensions.width / actualWidth : 1;
// This translates the scaling done by PBI from css scaling to svg scaling.
const svgWidth = width + margin.left + margin.right;
const svgHeight = height + margin.top + margin.bottom;
const invertScale = 1 / scale;
const renderedWidth = Math.floor(svgWidth * invertScale);
const renderedHeight = Math.floor(svgHeight * invertScale);
const translateX = Math.ceil((svgWidth - renderedWidth) / 2);
const translateY = Math.ceil((svgHeight - renderedHeight) / 2);
this.svg
.attr("width", renderedWidth)
.attr("height", renderedHeight)
.attr("style", `transform:translate(${translateX}px, ${translateY}px) scale(${scale})`);
this.clip
.attr("width", width)
.attr("height", height);
this.context
.attr("transform", `scale(${invertScale}) translate(${margin.left},${margin.top})`);
}