Skip to content

Commit b83ebde

Browse files
authored
Merge branch 'master' into fix/export-title-wrapping
2 parents d5a5597 + 51c5cb2 commit b83ebde

5 files changed

Lines changed: 23 additions & 14 deletions

File tree

packages/app/src/components/inference/ui/GPUGraph.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,12 @@ const GPUGraph = React.memo(
245245
const root = d3.select(svg);
246246
root
247247
.selectAll<SVGGElement, InferenceData>('.dot-group')
248-
.transition()
248+
.transition('legend-hover')
249249
.duration(150)
250250
.style('opacity', (d) => (`${d.date}_${d.hwKey}` === seriesId ? 1 : 0.15));
251251
root
252252
.selectAll<SVGPathElement, unknown>('.roofline-path')
253-
.transition()
253+
.transition('legend-hover')
254254
.duration(150)
255255
.style('opacity', function () {
256256
const key = (d3.select(this).datum() as { key: string } | null)?.key ?? '';
@@ -263,8 +263,12 @@ const GPUGraph = React.memo(
263263
const svg = chartRef.current?.getSvgElement?.();
264264
if (!svg) return;
265265
const root = d3.select(svg);
266-
root.selectAll('.dot-group').transition().duration(150).style('opacity', null);
267-
root.selectAll('.roofline-path').transition().duration(150).style('opacity', null);
266+
root.selectAll('.dot-group').transition('legend-hover').duration(150).style('opacity', null);
267+
root
268+
.selectAll('.roofline-path')
269+
.transition('legend-hover')
270+
.duration(150)
271+
.style('opacity', null);
268272
}, []);
269273

270274
if (data.length === 0) {

packages/app/src/components/inference/ui/ScatterGraph.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -489,12 +489,12 @@ const ScatterGraph = React.memo(
489489
const root = d3.select(svg);
490490
root
491491
.selectAll<SVGGElement, InferenceData>('.dot-group')
492-
.transition()
492+
.transition('legend-hover')
493493
.duration(150)
494494
.style('opacity', (d) => (!isPointVisible(d) ? 0 : String(d.hwKey) === hwKey ? 1 : 0.15));
495495
root
496496
.selectAll<SVGPathElement, unknown>('.roofline-path')
497-
.transition()
497+
.transition('legend-hover')
498498
.duration(150)
499499
.style('opacity', function () {
500500
if (!isRooflineVisible(this)) return 0;
@@ -510,12 +510,12 @@ const ScatterGraph = React.memo(
510510
const root = d3.select(svg);
511511
root
512512
.selectAll<SVGGElement, InferenceData>('.dot-group')
513-
.transition()
513+
.transition('legend-hover')
514514
.duration(150)
515515
.style('opacity', (d) => (isPointVisible(d) ? 1 : 0));
516516
root
517517
.selectAll<SVGPathElement, unknown>('.roofline-path')
518-
.transition()
518+
.transition('legend-hover')
519519
.duration(150)
520520
.style('opacity', function () {
521521
return isRooflineVisible(this) ? 1 : 0;

packages/app/src/components/ui/chart-legend-item.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ const ChartLegendItem: React.FC<CommonLegendItemProps> = ({
2626
title,
2727
isActive,
2828
onClick,
29-
onHover: _onHover,
30-
onHoverEnd: _onHoverEnd,
29+
onHover,
30+
onHoverEnd,
3131
hw,
3232
isHighlighted,
3333
asFragment = false,
@@ -53,6 +53,8 @@ const ChartLegendItem: React.FC<CommonLegendItemProps> = ({
5353
isLegendExpanded ? 'w-fit whitespace-nowrap' : '',
5454
)}
5555
title={!isLegendExpanded && isLongText ? label : title}
56+
onMouseEnter={onHover && isActive ? () => onHover(hw || name) : undefined}
57+
onMouseLeave={onHoverEnd && isActive ? onHoverEnd : undefined}
5658
>
5759
<span
5860
className="inline-block w-3 h-3 rounded-full mr-2 flex-shrink-0 transition-opacity"

packages/app/src/hooks/useChartZoom.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export function useChartZoom(options: UseChartZoomOptions): UseChartZoomResult {
9999
// apply zoom reset with animation
100100
const transition = d3
101101
.select(svgRef.current)
102-
.transition()
102+
.transition('zoom')
103103
.duration(750)
104104
.call(zoomRef.current.transform as any, defaultZoomTransform);
105105

@@ -187,7 +187,7 @@ export function useChartZoom(options: UseChartZoomOptions): UseChartZoomResult {
187187
// double-click to reset zoom
188188
svg.on('dblclick.zoom', () => {
189189
svg
190-
.transition()
190+
.transition('zoom')
191191
.duration(750)
192192
.call(zoom.transform as any, defaultZoomTransform);
193193
zoomTransformRef.current = defaultZoomTransform;

packages/app/src/lib/d3-chart/D3Chart/useD3ChartRenderer.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,10 @@ export function useD3ChartRenderer<T>(props: D3ChartProps<T>, deps: RendererDeps
334334
const newPos = this.getAttribute('transform');
335335
if (oldPos !== undefined && newPos && oldPos !== newPos) {
336336
this.setAttribute('transform', oldPos);
337-
d3.select(this).transition().duration(transitionDuration).attr('transform', newPos);
337+
d3.select(this)
338+
.transition('data-update')
339+
.duration(transitionDuration)
340+
.attr('transform', newPos);
338341
}
339342
});
340343
// Roofline paths: restore old path, then transition to current
@@ -343,7 +346,7 @@ export function useD3ChartRenderer<T>(props: D3ChartProps<T>, deps: RendererDeps
343346
const newD = this.getAttribute('d');
344347
if (oldD !== undefined && newD && oldD !== newD) {
345348
this.setAttribute('d', oldD);
346-
d3.select(this).transition().duration(transitionDuration).attr('d', newD);
349+
d3.select(this).transition('data-update').duration(transitionDuration).attr('d', newD);
347350
}
348351
});
349352
}

0 commit comments

Comments
 (0)