diff --git a/src/components/experiment-tracking/parallel-coordinates/components/line-path.js b/src/components/experiment-tracking/parallel-coordinates/components/line-path.js
deleted file mode 100644
index 2d5438df7f..0000000000
--- a/src/components/experiment-tracking/parallel-coordinates/components/line-path.js
+++ /dev/null
@@ -1,51 +0,0 @@
-import React from 'react';
-import { useD3 } from '../../../../utils/hooks/use-d3';
-
-const grey400 = '#ABB2B7';
-const slate300 = '#1C2E3A';
-
-export const LinePath = ({
- d,
- fill,
- id,
- isHovered,
- selected,
- setHoveredId,
- stroke,
-}) => {
- const setHighlight = (el, highlighted) => {
- if (highlighted) {
- el.style('stroke', grey400);
- el.style('cursor', 'pointer');
- el.raise();
- } else {
- el.style('stroke', slate300);
- }
- };
-
- const ref = useD3((el) => {
- if (!selected) {
- el.on('mouseover', () => setHoveredId(id));
-
- el.on('mouseout', () => setHoveredId(null));
-
- if (isHovered) {
- setHighlight(el, true);
- } else {
- setHighlight(el, false);
- }
- }
- });
-
- return (
-
- );
-};
diff --git a/src/components/experiment-tracking/parallel-coordinates/parallel-coordinates.js b/src/components/experiment-tracking/parallel-coordinates/parallel-coordinates.js
index df0c6516bc..ad042e90d8 100644
--- a/src/components/experiment-tracking/parallel-coordinates/parallel-coordinates.js
+++ b/src/components/experiment-tracking/parallel-coordinates/parallel-coordinates.js
@@ -3,6 +3,9 @@ import classnames from 'classnames';
import * as d3 from 'd3';
import { HoverStateContext } from '../utils/hover-state-context';
import { v4 as uuidv4 } from 'uuid';
+import { MetricsChartsTooltip, tooltipDefaultProps } from '../tooltip/tooltip';
+import { sidebarWidth } from '../../../config';
+import { formatTimestamp } from '../../../utils/date-utils';
import './parallel-coordinates.css';
@@ -12,6 +15,11 @@ const paddingLr = 80;
const axisGapBuffer = 3;
const selectedMarkerRotate = [45, 0, 0];
+const tooltipMaxWidth = 300;
+const tooltipLeftGap = 90;
+const tooltipRightGap = 60;
+const tooltipTopGap = 150;
+
const selectedMarkerColors = ['#00E3FF', '#3BFF95', '#FFE300'];
const yAxis = {};
@@ -21,6 +29,7 @@ export const ParallelCoordinates = ({ metricsData, selectedRuns }) => {
const [hoveredAxisG, setHoveredAxisG] = useState(null);
const [chartHeight, setChartHeight] = useState(0);
const [chartWidth, setChartWidth] = useState(0);
+ const [showTooltip, setShowTooltip] = useState(tooltipDefaultProps);
const { hoveredElementId, setHoveredElementId } =
useContext(HoverStateContext);
@@ -76,11 +85,81 @@ export const ParallelCoordinates = ({ metricsData, selectedRuns }) => {
};
const handleMouseOverMetric = (e, key) => {
+ const runsCount = graph.find((each) => each[0] === key)[1].length;
setHoveredAxisG(key);
+
+ const rect = e.target.getBoundingClientRect();
+ const y = rect.y - tooltipTopGap + rect.height / 2;
+ let x, direction;
+
+ if (window.innerWidth - rect.x > tooltipMaxWidth) {
+ x = e.clientX - sidebarWidth.open - tooltipRightGap;
+ direction = 'right';
+ } else {
+ x =
+ e.clientX - sidebarWidth.open - sidebarWidth.open / 2 - tooltipLeftGap;
+ direction = 'left';
+ }
+
+ setShowTooltip({
+ content: {
+ label1: 'Metric name',
+ value1: key,
+ label2: 'Run count',
+ value2: runsCount,
+ },
+ direction,
+ position: { x, y },
+ visible: true,
+ });
};
const handleMouseOutMetric = () => {
setHoveredAxisG(null);
+ setShowTooltip(tooltipDefaultProps);
+ };
+
+ const handleMouseOverLine = (e, key) => {
+ setHoveredElementId(key);
+
+ if (e) {
+ const y = e.clientY - tooltipTopGap;
+ const parsedDate = new Date(formatTimestamp(key));
+ let x, direction;
+
+ if (window.innerWidth - e.clientX > tooltipMaxWidth) {
+ x = e.clientX - sidebarWidth.open - tooltipRightGap;
+ direction = 'right';
+ } else {
+ x =
+ e.clientX -
+ sidebarWidth.open -
+ sidebarWidth.open / 2 -
+ tooltipLeftGap;
+ direction = 'left';
+ }
+
+ setShowTooltip({
+ content: {
+ label1: 'Run name',
+ value1: key,
+ label2: 'Date',
+ value2: parsedDate.toLocaleDateString('default', {
+ day: 'numeric',
+ month: 'long',
+ year: 'numeric',
+ }),
+ },
+ direction,
+ position: { x, y },
+ visible: true,
+ });
+ }
+ };
+
+ const handleMouseOutLine = () => {
+ setHoveredElementId(null);
+ setShowTooltip(tooltipDefaultProps);
};
useEffect(() => {
@@ -95,6 +174,13 @@ export const ParallelCoordinates = ({ metricsData, selectedRuns }) => {
return (
+
+