Skip to content

Commit 27325a5

Browse files
authored
Merge pull request #16 from trechriron/danny-bug-fixes
Minor bug fixes
2 parents abbc189 + b0e0765 commit 27325a5

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

src/App/DevResultGraph.jsx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ const devGraphStyles = {
173173
circleStyle: {
174174
fill: "black",
175175
},
176+
svg: {
177+
height: "30px",
178+
}
176179
};
177180

178181
function nearestRoundUp(number) {
@@ -275,17 +278,24 @@ const renderBackgroundLines = () => {
275278
function calculateTierHeight(currentTierCount, previousTierCount, style) {
276279
const previousY = calculateYPoint(previousTierCount, yMax);
277280
const currentY = calculateYPoint(currentTierCount, yMax);
278-
281+
279282
// Calculate the height of the tier relative to y-axis lines
280283
const height = previousY - currentY;
281284

285+
// meaning that tier is too high so skip render
286+
if (!height) {
287+
return null;
288+
}
289+
282290
// Calculate the y-position of the tier based on y-axis lines
283291
const yPosition = Math.min(previousY - height, yInnerMaxHeight - 5);
284-
292+
285293
// if too small, barely render
286294
if (yInnerMaxHeight - ySingleUnit < yPosition) {
287295
return <rect x="50" y={previousY + 1} style={style} height={1}></rect>;
288296
}
297+
298+
289299
return <rect x="50" y={yPosition} style={style} height={Math.max(height, 29)}></rect>;
290300
}
291301

@@ -353,23 +363,23 @@ return (
353363
</div>
354364
<div style={devGraphStyles.row}>
355365
<div style={devGraphStyles.column2}>
356-
<svg>
366+
<svg style={devGraphStyles.svg}>
357367
<g>
358368
<rect x="0" y="0" style={devGraphStyles.freeTierSquare}></rect>
359369
<text x="35" y="20" style={devGraphStyles.textStyle6}>Free Tier</text>
360370
</g>
361371
</svg>
362372
</div>
363373
<div style={devGraphStyles.column2}>
364-
<svg>
374+
<svg style={devGraphStyles.svg}>
365375
<g>
366376
<rect x="0" y="0" style={devGraphStyles.tierOneSquare}></rect>
367377
<text x="35" y="20" style={devGraphStyles.textStyle6}>Tier 1</text>
368378
</g>
369379
</svg>
370380
</div>
371381
<div style={devGraphStyles.column2}>
372-
<svg>
382+
<svg style={devGraphStyles.svg}>
373383
<g>
374384
<rect x="0" y="0" style={devGraphStyles.tiertwoSquare}></rect>
375385
<text x="35" y="20" style={devGraphStyles.textStyle6}>Tier 2</text>

0 commit comments

Comments
 (0)