Skip to content

Commit e897097

Browse files
committed
improved report pdf for synthetic data
1 parent b5d3d7c commit e897097

File tree

6 files changed

+22
-6
lines changed

6 files changed

+22
-6
lines changed

src/components/graphs/CountBarChart.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,9 @@ const CountBarChart = ({ column, realData }: CountBarChartProps) => {
112112
const resizeObserver = new ResizeObserver(entries => {
113113
if (!entries || entries.length === 0) return;
114114
const { width } = entries[0].contentRect;
115-
setContainerWidth(width);
115+
if (width > 0) {
116+
setContainerWidth(width);
117+
}
116118
});
117119

118120
if (containerRef.current) {
@@ -130,7 +132,7 @@ const CountBarChart = ({ column, realData }: CountBarChartProps) => {
130132
<div
131133
ref={containerRef}
132134
style={{ width: '100%', display: 'flex', overflowX: 'auto' }}
133-
className={`min-h-[${height}px] flex-col`}
135+
className={`chart-container min-h-[${height}px] flex-col`}
134136
>
135137
<svg ref={svgRef}></svg>
136138
</div>

src/components/graphs/DistributionBarChart.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,10 @@ const DistributionBarChart = ({
214214
const resizeObserver = new ResizeObserver(entries => {
215215
if (!entries || entries.length === 0) return;
216216
const { width } = entries[0].contentRect;
217-
setContainerWidth(width);
217+
218+
if (width > 0) {
219+
setContainerWidth(width);
220+
}
218221
});
219222

220223
if (containerRef.current) {
@@ -232,7 +235,7 @@ const DistributionBarChart = ({
232235
<div
233236
ref={containerRef}
234237
style={{ width: '100%', display: 'flex', overflowX: 'auto' }}
235-
className={`min-h-[${height}px] flex-col`}
238+
className={`chart-container min-h-[${height}px] flex-col`}
236239
>
237240
<svg ref={svgRef}></svg>
238241
</div>

src/components/graphs/HeatMap.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ const HeatMapChart = ({ title, data, columns }: HeatMapChartProps) => {
168168
const resizeObserver = new ResizeObserver(entries => {
169169
if (!entries || entries.length === 0) return;
170170
const { width } = entries[0].contentRect;
171-
setContainerWidth(width); // Update the state with the new container width
171+
if (width > 0) {
172+
setContainerWidth(width);
173+
}
172174
});
173175

174176
if (containerRef.current) {

src/components/graphs/SingleBarChart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ const SingleBarChart = ({ title, data }: SingleBarChartProps) => {
201201
<div
202202
ref={containerRef}
203203
style={{ width: '100%', display: 'flex', overflowX: 'auto' }}
204-
className={`min-h-[${height}px] flex-col`}
204+
className={`chart-container min-h-[${height}px] flex-col`}
205205
>
206206
<svg ref={svgRef}></svg>
207207
</div>

src/index.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,8 @@
1212
@apply list-disc list-inside;
1313
}
1414
}
15+
16+
.showonprint .chart-container {
17+
@apply min-w-[800px];
18+
width: 800px !important;
19+
}

src/routes/SyntheticData.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ const PAGE_STYLE = `
3333
display: none !important;
3434
}
3535
36+
.showonprint {
37+
display: block !important;
38+
}
39+
3640
@page {
3741
size: landscape;
3842
margin: 30px 20px;

0 commit comments

Comments
 (0)