diff --git a/packages/app/src/components/inference/ui/GPUGraph.tsx b/packages/app/src/components/inference/ui/GPUGraph.tsx index 8ed748c..6c328a4 100644 --- a/packages/app/src/components/inference/ui/GPUGraph.tsx +++ b/packages/app/src/components/inference/ui/GPUGraph.tsx @@ -245,12 +245,12 @@ const GPUGraph = React.memo( const root = d3.select(svg); root .selectAll('.dot-group') - .transition() + .transition('legend-hover') .duration(150) .style('opacity', (d) => (`${d.date}_${d.hwKey}` === seriesId ? 1 : 0.15)); root .selectAll('.roofline-path') - .transition() + .transition('legend-hover') .duration(150) .style('opacity', function () { const key = (d3.select(this).datum() as { key: string } | null)?.key ?? ''; @@ -263,8 +263,12 @@ const GPUGraph = React.memo( const svg = chartRef.current?.getSvgElement?.(); if (!svg) return; const root = d3.select(svg); - root.selectAll('.dot-group').transition().duration(150).style('opacity', null); - root.selectAll('.roofline-path').transition().duration(150).style('opacity', null); + root.selectAll('.dot-group').transition('legend-hover').duration(150).style('opacity', null); + root + .selectAll('.roofline-path') + .transition('legend-hover') + .duration(150) + .style('opacity', null); }, []); if (data.length === 0) { diff --git a/packages/app/src/components/inference/ui/ScatterGraph.tsx b/packages/app/src/components/inference/ui/ScatterGraph.tsx index 3b832f5..fd595d6 100644 --- a/packages/app/src/components/inference/ui/ScatterGraph.tsx +++ b/packages/app/src/components/inference/ui/ScatterGraph.tsx @@ -489,12 +489,12 @@ const ScatterGraph = React.memo( const root = d3.select(svg); root .selectAll('.dot-group') - .transition() + .transition('legend-hover') .duration(150) .style('opacity', (d) => (!isPointVisible(d) ? 0 : String(d.hwKey) === hwKey ? 1 : 0.15)); root .selectAll('.roofline-path') - .transition() + .transition('legend-hover') .duration(150) .style('opacity', function () { if (!isRooflineVisible(this)) return 0; @@ -510,12 +510,12 @@ const ScatterGraph = React.memo( const root = d3.select(svg); root .selectAll('.dot-group') - .transition() + .transition('legend-hover') .duration(150) .style('opacity', (d) => (isPointVisible(d) ? 1 : 0)); root .selectAll('.roofline-path') - .transition() + .transition('legend-hover') .duration(150) .style('opacity', function () { return isRooflineVisible(this) ? 1 : 0; diff --git a/packages/app/src/components/ui/chart-legend-item.tsx b/packages/app/src/components/ui/chart-legend-item.tsx index 5031000..8437eb5 100644 --- a/packages/app/src/components/ui/chart-legend-item.tsx +++ b/packages/app/src/components/ui/chart-legend-item.tsx @@ -26,8 +26,8 @@ const ChartLegendItem: React.FC = ({ title, isActive, onClick, - onHover: _onHover, - onHoverEnd: _onHoverEnd, + onHover, + onHoverEnd, hw, isHighlighted, asFragment = false, @@ -53,6 +53,8 @@ const ChartLegendItem: React.FC = ({ isLegendExpanded ? 'w-fit whitespace-nowrap' : '', )} title={!isLegendExpanded && isLongText ? label : title} + onMouseEnter={onHover && isActive ? () => onHover(hw || name) : undefined} + onMouseLeave={onHoverEnd && isActive ? onHoverEnd : undefined} > { svg - .transition() + .transition('zoom') .duration(750) .call(zoom.transform as any, defaultZoomTransform); zoomTransformRef.current = defaultZoomTransform; diff --git a/packages/app/src/lib/d3-chart/D3Chart/useD3ChartRenderer.ts b/packages/app/src/lib/d3-chart/D3Chart/useD3ChartRenderer.ts index a95a60b..71ae75d 100644 --- a/packages/app/src/lib/d3-chart/D3Chart/useD3ChartRenderer.ts +++ b/packages/app/src/lib/d3-chart/D3Chart/useD3ChartRenderer.ts @@ -334,7 +334,10 @@ export function useD3ChartRenderer(props: D3ChartProps, deps: RendererDeps const newPos = this.getAttribute('transform'); if (oldPos !== undefined && newPos && oldPos !== newPos) { this.setAttribute('transform', oldPos); - d3.select(this).transition().duration(transitionDuration).attr('transform', newPos); + d3.select(this) + .transition('data-update') + .duration(transitionDuration) + .attr('transform', newPos); } }); // Roofline paths: restore old path, then transition to current @@ -343,7 +346,7 @@ export function useD3ChartRenderer(props: D3ChartProps, deps: RendererDeps const newD = this.getAttribute('d'); if (oldD !== undefined && newD && oldD !== newD) { this.setAttribute('d', oldD); - d3.select(this).transition().duration(transitionDuration).attr('d', newD); + d3.select(this).transition('data-update').duration(transitionDuration).attr('d', newD); } }); }