Skip to content

Commit 6bb1907

Browse files
Update BarGraphComparison.tsx
1 parent 1d95e49 commit 6bb1907

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

src/app/components/StateRoute/PerformanceVisx/BarGraphComparison.tsx

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,7 @@ import { useTheme } from '@mui/material/styles';
1818
import { Button, InputLabel } from '@mui/material';
1919
import { onHover, onHoverExit, deleteSeries, setCurrentTabInApp } from '../../../actions/actions';
2020
import { useStoreContext } from '../../../store';
21-
import {
22-
snapshot,
23-
TooltipData,
24-
Margin,
25-
BarGraphComparisonProps,
26-
ActionObj,
27-
Series,
28-
} from '../../../FrontendTypes';
21+
import { snapshot, TooltipData, Margin, BarGraphComparisonProps, ActionObj, Series, } from '../../../FrontendTypes';
2922

3023
/* DEFAULTS */
3124
const margin: Margin = {
@@ -99,8 +92,7 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
9992
padding: 0.2,
10093
});
10194

102-
const calculateMaxTotalRender = (serie: number): number => {
103-
// This function will iterate through the snapshots of the series, and grab the highest render times (sum of all component times). We'll then use it in the renderingScale function and compare with the render time of the current tab. The max render time will determine the Y-axis's highest number.
95+
const calculateMaxTotalRender = (serie: number): number => { // This function will iterate through the snapshots of the series, and grab the highest render times (sum of all component times). We'll then use it in the renderingScale function and compare with the render time of the current tab. The max render time will determine the Y-axis's highest number.
10496
const currentSeriesBarStacks: ActionObj[] = !comparison[serie]
10597
? []
10698
: comparison[serie].data.barStack;
@@ -117,8 +109,7 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
117109
return currentMax;
118110
};
119111

120-
const renderingScale = scaleLinear<number>({
121-
// this function will use the domain array to assign each key a different color to make rectangle boxes and use range to set the color scheme each bar
112+
const renderingScale = scaleLinear<number>({ // this function will use the domain array to assign each key a different color to make rectangle boxes and use range to set the color scheme each bar
122113
domain: [0, Math.max(calculateMaxTotalRender(series), data.maxTotalRender)], // [minY, maxY] the domain array on rendering scale will set the coordinates for Y-axis points.
123114
nice: true,
124115
});
@@ -171,8 +162,7 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
171162
setPicOpen(true);
172163
};
173164

174-
function setXpointsComparison() {
175-
// manually assigning X -axis points with tab ID.
165+
function setXpointsComparison() { // manually assigning X -axis points with tab ID.
176166
comparison[series].data.barStack.forEach((elem: ActionObj) => {
177167
elem.currentTab = 'comparison';
178168
});
@@ -203,7 +193,6 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
203193
<Button
204194
variant='contained'
205195
sx={{ p: 2, color: 'white' }}
206-
// type='button'
207196
className='delete-button'
208197
onClick={() => {
209198
setButtonLoad(true);
@@ -294,10 +283,10 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
294283
</StyledSelect>
295284
</StyledFormControl>
296285
*/}
297-
</div>
298-
</div>
299286
{/*==============================================================================================================================*/}
300287
{/*==============================================================================================================================*/}
288+
</div>
289+
</div>
301290

302291
<svg ref={containerRef} width={width} height={height}>
303292
<rect x={0} y={0} width={width} height={height} fill={background} rx={14} />
@@ -313,8 +302,7 @@ const BarGraphComparison = (props: BarGraphComparisonProps): JSX.Element => {
313302
xOffset={snapshotIdScale.bandwidth() / 2}
314303
/>
315304
<Group top={margin.top} left={margin.left}>
316-
<BarStack
317-
// Current Tab bar stack.
305+
<BarStack // Current Tab bar stack.
318306
data={setXpointsCurrentTab()} // array of data that generates a stack
319307
keys={keys} // array of keys corresponding to stack layers
320308
x={getCurrentTab} // returns the value mapped to the x of a bar

0 commit comments

Comments
 (0)