Skip to content

Commit 5d05b16

Browse files
DennisLpzkev-ngoCourageWolfC-STYRdemircaner
committed
Fixed current bar placement on comparison feature
Co-authored-by: kev-ngo <[email protected]> Co-authored-by: CourageWolf <[email protected]> Co-authored-by: C-STYR <[email protected]> Co-authored-by: demircaner <[email protected]>
1 parent 5757075 commit 5d05b16

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

src/app/components/BarGraphComparison.tsx

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ const BarGraphComparison = (props) => {
102102
const getSnapshotId = (d: snapshot) => d.snapshotId;
103103
const formatSnapshotId = (id) => `Snapshot ID: ${id}`;
104104
const formatRenderTime = (time) => `${time} ms `;
105-
const getTabID = (storedSeries) => storedSeries.currentTab;
105+
const getCurrentTab = (storedSeries) => storedSeries.currentTab;
106106
// create visualization SCALES with cleaned data
107107
//const xAxisPoints = [...titleFilter(comparison).map(getTabID), currentTab];
108108
//the domain array elements will place the bars along the x-axis
@@ -185,14 +185,20 @@ const BarGraphComparison = (props) => {
185185
};
186186

187187
//manually assignin X -axis points with tab ID.
188-
function setXpoints() {
188+
function setXpointsComparison() {
189189
comparison[series].data.barStack.forEach((elem) => {
190190
elem.currentTab = 'comparison';
191191
});
192192
//comparison[series].data.barStack.currentTab = currentTab;
193193
return comparison[series].data.barStack;
194194
}
195-
195+
function setXpointsCurrentTab() {
196+
data.barStack.forEach((element) => {
197+
element.currentTab = 'currentTab';
198+
});
199+
return data.barStack;
200+
}
201+
//console.log('set x on current bar', setXpointsCurrentTab());
196202
return (
197203
<div>
198204
<div className='series-options-container'>
@@ -259,9 +265,9 @@ const BarGraphComparison = (props) => {
259265
<Group top={margin.top} left={margin.left}>
260266
<BarStack
261267
// OG Barstack
262-
data={data.barStack}
268+
data={setXpointsCurrentTab()}
263269
keys={keys}
264-
x={getSnapshotId}
270+
x={getCurrentTab}
265271
xScale={snapshotIdScale}
266272
yScale={renderingScale}
267273
color={colorScale}
@@ -306,9 +312,9 @@ const BarGraphComparison = (props) => {
306312
</BarStack>
307313
<BarStack
308314
// Comparison Barstack
309-
data={!comparison[series] ? [] : setXpoints()}
315+
data={!comparison[series] ? [] : setXpointsComparison()}
310316
keys={keys}
311-
x={getTabID}
317+
x={getCurrentTab}
312318
xScale={snapshotIdScale}
313319
yScale={renderingScale}
314320
color={colorScale}

0 commit comments

Comments
 (0)