Skip to content

Commit 81699fb

Browse files
committed
Actions Bar Graph in progress
1 parent 67beec5 commit 81699fb

File tree

4 files changed

+11
-62
lines changed

4 files changed

+11
-62
lines changed

src/app/components/BarGraph.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ const BarGraph = props => {
139139
}
140140

141141
// const textbox = tabs[currentTab].seriesSavedStatus === 'inputBoxOpen' ? <input type="text" className="seriesname" placeholder="Series Name" /> : null
142-
142+
console.log('dataFromBarGraph', data)
143143
return (
144144
<div className="bargraph-position">
145145
<input type="text" id ="seriesname" placeholder="Series Name" />
@@ -181,6 +181,7 @@ const BarGraph = props => {
181181
color={colorScale}
182182
>
183183
{barStacks => barStacks.map(barStack => barStack.bars.map((bar, idx) => {
184+
console.log(bar)
184185
// Hides new components if components don't exist in previous snapshots.
185186
if (Number.isNaN(bar.bar[1]) || bar.height < 0) {
186187
bar.height = 0;

src/app/components/BarGraphComparison.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,11 @@ const BarGraphComparison = props => {
215215
return comparison[series].data.barStack;
216216
}
217217
function setXpointsCurrentTab() {
218+
console.log('unprocessedData',data)
218219
data.barStack.forEach(element => {
219220
element.currentTab = 'currentTab';
220221
});
222+
console.log('processedData', data.barStack)
221223
return data.barStack;
222224
}
223225
const animateButton = function (e) {

src/app/components/BarGraphComparisonActions.tsx

Lines changed: 1 addition & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -329,64 +329,6 @@ const BarGraphComparison = props => {
329329
xOffset={snapshotIdScale.bandwidth() / 2}
330330
/>
331331
<Group top={margin.top} left={margin.left}>
332-
<BarStack
333-
// Comparison Barstack (populates based on series selected)
334-
// to set X and Y scale, it will used the passed in function and
335-
// will run it on the array thats outputted by data
336-
// setXpointsComparison()}
337-
// comparison[series].data.barStack
338-
data={!comparison[series] ? [] : setXpointsComparison()}
339-
keys={keys}
340-
x={getCurrentTab}
341-
xScale={snapshotIdScale}
342-
yScale={renderingScale}
343-
color={colorScale}
344-
>
345-
{barStacks => barStacks.map((barStack, idx) => {
346-
// Uses map method to iterate through all components,
347-
// creating a rect component (from visx) for each iteration.
348-
// height/width/etc. are calculated by visx.
349-
if (!barStack.bars[currentIndex]) {
350-
return <h1>No Comparison</h1>;
351-
}
352-
const bar = barStack.bars[currentIndex];
353-
if (Number.isNaN(bar.bar[1]) || bar.height < 0) {
354-
bar.height = 0;
355-
}
356-
return (
357-
<rect
358-
key={`bar-stack-${idx}-${bar.index}`}
359-
x={bar.x}
360-
y={bar.y}
361-
height={bar.height === 0 ? null : bar.height}
362-
width={bar.width}
363-
fill={bar.color}
364-
/* TIP TOOL EVENT HANDLERS */
365-
// Hides tool tip once cursor moves off the current rect
366-
onMouseLeave={() => {
367-
dispatch(
368-
onHoverExit(data.componentData[bar.key].rtid),
369-
(tooltipTimeout = window.setTimeout(() => {
370-
hideTooltip();
371-
}, 300)),
372-
);
373-
}}
374-
// Cursor position in window updates position of the tool tip
375-
onMouseMove={event => {
376-
dispatch(onHover(data.componentData[bar.key].rtid));
377-
if (tooltipTimeout) clearTimeout(tooltipTimeout);
378-
const top = event.clientY - margin.top - bar.height;
379-
const left = bar.x + bar.width / 2;
380-
showTooltip({
381-
tooltipData: bar,
382-
tooltipTop: top,
383-
tooltipLeft: left,
384-
});
385-
}}
386-
/>
387-
);
388-
})}
389-
</BarStack>
390332
<BarStack
391333
data={data.barStack}
392334
keys={keys}
@@ -396,6 +338,7 @@ const BarGraphComparison = props => {
396338
color={colorScale}
397339
>
398340
{barStacks => barStacks.map(barStack => barStack.bars.map((bar, idx) => {
341+
console.log(bar)
399342
// Hides new components if components don't exist in previous snapshots.
400343
if (Number.isNaN(bar.bar[1]) || bar.height < 0) {
401344
bar.height = 0;

src/app/components/PerformanceVisx.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,10 @@ const getActions = () => {
189189
if (seriesArr.length) {
190190
for (let i = 0; i < seriesArr.length; i++) {
191191
for (const action of seriesArr[i].data.barStack) {
192-
if (action.name !== '') actionsArr.push(action);
192+
if (action.name !== '') {
193+
action.seriesName = seriesArr[i].name;
194+
actionsArr.push(action);
195+
}
193196
}
194197
}
195198
}
@@ -252,11 +255,11 @@ const PerformanceVisx = (props: BarStackProps) => {
252255
return (
253256
<BarGraphComparisonActions
254257
// comparison={allStorage()}
255-
data={getActions()}
258+
data={data}
256259
width={width}
257260
height={height}
258261
setSeries={setSeries}
259-
series={series}
262+
action={action}
260263
setAction={setAction}
261264
/>
262265
);

0 commit comments

Comments
 (0)