@parca/profile 0.18.2 → 0.18.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [0.18.4](https://github.com/parca-dev/parca/compare/@parca/profile@0.18.3...@parca/profile@0.18.4) (2025-06-18)
7
+
8
+ **Note:** Version bump only for package @parca/profile
9
+
10
+ ## [0.18.3](https://github.com/parca-dev/parca/compare/@parca/profile@0.18.2...@parca/profile@0.18.3) (2025-06-18)
11
+
12
+ **Note:** Version bump only for package @parca/profile
13
+
6
14
  ## [0.18.2](https://github.com/parca-dev/parca/compare/@parca/profile@0.18.1...@parca/profile@0.18.2) (2025-06-17)
7
15
 
8
16
  **Note:** Version bump only for package @parca/profile
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/MetricsGraph/UtilizationMetrics/index.tsx"],"names":[],"mappings":"AAqBA,OAAO,EAAC,aAAa,EAAqD,MAAM,mBAAmB,CAAC;AAIpG,OAAO,EAAC,KAAK,kBAAkB,IAAI,YAAY,EAAC,MAAM,uBAAuB,CAAC;AAO9E,UAAU,WAAW;IACnB,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB,eAAe,EAAE,CACf,MAAM,EAAE;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,GAAG,KAAK,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAC,KACvE,IAAI,CAAC;IACV,YAAY,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,iBAAiB,EAAE,MAAM,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,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C;IACb,iBAAiB,EAAE,MAAM,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,sBAAsB,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAC,KAAK,IAAI,CAAC;CAChF;AAQD,KAAK,KAAK,GAAG,WAAW,GAAG;IACzB,IAAI,EAAE,YAAY,EAAE,CAAC;IACrB,eAAe,EAAE,CACf,MAAM,EAAE;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,GAAG,KAAK,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAC,CAAC,KACvE,IAAI,CAAC;IACV,YAAY,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC7C,yBAAyB,CAAC,EAAE,OAAO,CAAC;CACrC,CAAC;AAucF,QAAA,MAAM,kBAAkB,mIAUrB,KAAK,KAAG,GAAG,CAAC,OAiCd,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -73,7 +73,11 @@ const RawUtilizationMetrics = ({ data, addLabelMatcher, setTimeRange, width, hei
73
73
  const lineStroke = '1px';
74
74
  const lineStrokeHover = '2px';
75
75
  const lineStrokeSelected = '3px';
76
- const graphWidth = width - margin * 1.5 - margin / 2;
76
+ const graphWidth = useMemo(() => width - margin * 1.5 - margin / 2, [width, margin]);
77
+ const graphTransform = useMemo(() => {
78
+ // Adds 10px padding which aligns the graph on the grid
79
+ return `translate(10, 0) scale(${(graphWidth - 10) / graphWidth}, 1)`;
80
+ }, [graphWidth]);
77
81
  const paddedFrom = from;
78
82
  const paddedTo = to;
79
83
  const series = useMemo(() => transformToSeries(data), [data]);
@@ -211,7 +215,7 @@ const RawUtilizationMetrics = ({ data, addLabelMatcher, setTimeRange, width, hei
211
215
  transform: `translate(0, ${yScale(d)})`, children: [_jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x2: -6 }), _jsx("text", { fill: "currentColor", x: -9, dy: '0.32em', children: valueFormatter(d, getYAxisUnit(name), decimals) })] }, `tick-${i}`), _jsx("g", { children: _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: xScale(from), x2: xScale(to), y1: yScale(d), y2: yScale(d) }) }, `grid-${i}`)] }, `${i.toString()}-${d.toString()}`));
212
216
  }), _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: 0, x2: 0, y1: 0, y2: height - margin }), _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: xScale(to), x2: xScale(to), y1: 0, y2: height - margin }), _jsx("g", { transform: `translate(${-margin}, ${(height - margin) / 2}) rotate(270)`, children: _jsx("text", { fill: "currentColor", dy: "-0.7em", className: "text-sm capitalize", textAnchor: "middle", children: humanReadableName }) })] }), _jsxs("g", { className: "x axis", fill: "none", fontSize: "10", textAnchor: "middle", transform: `translate(0,${height - margin})`, children: [xScale.ticks(5).map((d, i) => (_jsxs(Fragment, { children: [_jsxs("g", { className: "tick",
213
217
  /* eslint-disable-next-line @typescript-eslint/restrict-template-expressions */
214
- transform: `translate(${xScale(d)}, 0)`, children: [_jsx("line", { y2: 6, className: "stroke-gray-300 dark:stroke-gray-500" }), _jsx("text", { fill: "currentColor", dy: ".71em", y: 9, children: formatDate(d, formatForTimespan(from, to), timezone) })] }, `tick-${i}`), _jsx("g", { children: _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: xScale(d), x2: xScale(d), y1: 0, y2: -height + margin }) }, `grid-${i}`)] }, `${i.toString()}-${d.toString()}`))), _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: 0, x2: graphWidth, y1: 0, y2: 0 }), _jsx("g", { transform: `translate(${(width - 2.5 * margin) / 2}, ${margin / 2})`, children: _jsx("text", { fill: "currentColor", dy: ".71em", y: 5, className: "text-sm", children: "Time" }) })] }), _jsx("g", { className: "lines fill-transparent", children: series.map((s, i) => {
218
+ transform: `translate(${xScale(d)}, 0)`, children: [_jsx("line", { y2: 6, className: "stroke-gray-300 dark:stroke-gray-500" }), _jsx("text", { fill: "currentColor", dy: ".71em", y: 9, children: formatDate(d, formatForTimespan(from, to), timezone) })] }, `tick-${i}`), _jsx("g", { children: _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: xScale(d), x2: xScale(d), y1: 0, y2: -height + margin }) }, `grid-${i}`)] }, `${i.toString()}-${d.toString()}`))), _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: 0, x2: graphWidth, y1: 0, y2: 0 }), _jsx("g", { transform: `translate(${(width - 2.5 * margin) / 2}, ${margin / 2})`, children: _jsx("text", { fill: "currentColor", dy: ".71em", y: 5, className: "text-sm", children: "Time" }) })] }), _jsx("g", { className: "lines fill-transparent", transform: graphTransform, children: series.map((s, i) => {
215
219
  const isLimit = s.metric.findIndex(m => m.name === '__type__' && m.value === 'limit') > -1;
216
220
  const strokeDasharray = isLimit ? '8 4' : '';
217
221
  return (_jsx("g", { className: "line cursor-pointer", children: _jsx(MetricsSeries, { data: s, line: l, color: getSeriesColor(s.metric), strokeWidth: s.isSelected === true
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/MetricsGraph/index.tsx"],"names":[],"mappings":"AAoBA,OAAO,EAAC,KAAK,EAAiB,aAAa,IAAI,eAAe,EAAC,MAAM,eAAe,CAAC;AACrF,OAAO,EAAC,aAAa,EAAkB,MAAM,mBAAmB,CAAC;AASjE,OAAO,EAAC,sBAAsB,EAAC,MAAM,IAAI,CAAC;AAO1C,UAAU,KAAK;IACb,IAAI,EAAE,eAAe,EAAE,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,sBAAsB,GAAG,IAAI,CAAC;IACvC,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,E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AAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,QAAA,MAAM,YAAY,qIAcf,KAAK,KAAG,GAAG,CAAC,OA2Bd,CAAC;AAEF,eAAe,YAAY,CAAC;AAE5B,eAAO,MAAM,UAAU,UAAW,MAAM,KAAG,MAAM,GAAG,IAKnD,CAAC;AAKF,eAAO,MAAM,eAAe,qIAczB,KAAK,KAAG,GAAG,CAAC,OA6fd,CAAC"}
@@ -51,7 +51,11 @@ export const RawMetricsGraph = ({ data, from, to, profile, onSampleClick, addLab
51
51
  if (width === undefined || width == null) {
52
52
  width = 0;
53
53
  }
54
- const graphWidth = width - margin * 1.5 - margin / 2;
54
+ const graphWidth = useMemo(() => width - margin * 1.5 - margin / 2, [width, margin]);
55
+ const graphTransform = useMemo(() => {
56
+ // Adds 6px padding which aligns the graph on the grid
57
+ return `translate(6, 0) scale(${(graphWidth - 6) / graphWidth}, 1)`;
58
+ }, [graphWidth]);
55
59
  const series = data.reduce(function (agg, s) {
56
60
  if (s.labelset !== undefined) {
57
61
  const metric = s.labelset.labels.sort((a, b) => a.name.localeCompare(b.name));
@@ -279,9 +283,9 @@ export const RawMetricsGraph = ({ data, from, to, profile, onSampleClick, addLab
279
283
  transform: `translate(0, ${yScale(d)})`, children: [_jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x2: -6 }), _jsx("text", { fill: "currentColor", x: -9, dy: '0.32em', children: valueFormatter(d, yAxisUnit, decimals) })] }, `tick-${i}`), _jsx("g", { children: _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: xScale(from), x2: xScale(to), y1: yScale(d), y2: yScale(d) }) }, `grid-${i}`)] }, `${i.toString()}-${d.toString()}`));
280
284
  }), _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: 0, x2: 0, y1: 0, y2: height - margin }), _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: xScale(to), x2: xScale(to), y1: 0, y2: height - margin }), _jsx("g", { transform: `translate(${-margin}, ${(height - margin) / 2}) rotate(270)`, children: _jsx("text", { fill: "currentColor", dy: "-0.7em", className: "text-sm capitalize", textAnchor: "middle", children: yAxisLabel }) })] }), _jsxs("g", { className: "x axis", fill: "none", fontSize: "10", textAnchor: "middle", transform: `translate(0,${height - margin})`, children: [xScale.ticks(5).map((d, i) => (_jsxs(Fragment, { children: [_jsxs("g", { className: "tick",
281
285
  /* eslint-disable-next-line @typescript-eslint/restrict-template-expressions */
282
- transform: `translate(${xScale(d)}, 0)`, children: [_jsx("line", { y2: 6, className: "stroke-gray-300 dark:stroke-gray-500" }), _jsx("text", { fill: "currentColor", dy: ".71em", y: 9, children: formatDate(d, formatForTimespan(from, to), timezone) })] }, `tick-${i}`), _jsx("g", { children: _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: xScale(d), x2: xScale(d), y1: 0, y2: -height + margin }) }, `grid-${i}`)] }, `${i.toString()}-${d.toString()}`))), _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: 0, x2: graphWidth, y1: 0, y2: 0 }), _jsx("g", { transform: `translate(${(width - 2.5 * margin) / 2}, ${margin / 2})`, children: _jsx("text", { fill: "currentColor", dy: ".71em", y: 5, className: "text-sm", children: "Time" }) })] }), _jsx("g", { className: "lines fill-transparent", children: series.map((s, i) => (_jsx("g", { className: "line", children: _jsx(MetricsSeries, { data: s, line: l, color: color(i.toString()), strokeWidth: hovering && highlighted != null && i === highlighted.seriesIndex
286
+ transform: `translate(${xScale(d)}, 0)`, children: [_jsx("line", { y2: 6, className: "stroke-gray-300 dark:stroke-gray-500" }), _jsx("text", { fill: "currentColor", dy: ".71em", y: 9, children: formatDate(d, formatForTimespan(from, to), timezone) })] }, `tick-${i}`), _jsx("g", { children: _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: xScale(d), x2: xScale(d), y1: 0, y2: -height + margin }) }, `grid-${i}`)] }, `${i.toString()}-${d.toString()}`))), _jsx("line", { className: "stroke-gray-300 dark:stroke-gray-500", x1: 0, x2: graphWidth, y1: 0, y2: 0 }), _jsx("g", { transform: `translate(${(width - 2.5 * margin) / 2}, ${margin / 2})`, children: _jsx("text", { fill: "currentColor", dy: ".71em", y: 5, className: "text-sm", children: "Time" }) })] }), _jsx("g", { className: "lines fill-transparent", transform: graphTransform, width: graphWidth - 100, children: series.map((s, i) => (_jsx("g", { className: "line", children: _jsx(MetricsSeries, { data: s, line: l, color: color(i.toString()), strokeWidth: hovering && highlighted != null && i === highlighted.seriesIndex
283
287
  ? lineStrokeHover
284
- : lineStroke, xScale: xScale, yScale: yScale }) }, i))) }), hovering && highlighted != null && (_jsx("g", { className: "circle-group", ref: metricPointRef, style: { fill: color(highlighted.seriesIndex.toString()) }, children: _jsx(MetricsCircle, { cx: highlighted.x, cy: highlighted.y }) })), selected != null && (_jsx("g", { className: "circle-group", style: selected?.seriesIndex != null
288
+ : lineStroke, xScale: xScale, yScale: yScale }) }, i))) }), hovering && highlighted != null && (_jsx("g", { className: "circle-group", ref: metricPointRef, style: { fill: color(highlighted.seriesIndex.toString()) }, transform: graphTransform, children: _jsx(MetricsCircle, { cx: highlighted.x, cy: highlighted.y }) })), selected != null && (_jsx("g", { className: "circle-group", style: selected?.seriesIndex != null
285
289
  ? { fill: color(selected.seriesIndex.toString()) }
286
- : {}, children: _jsx(MetricsCircle, { cx: selected.x, cy: selected.y, radius: 5 }) }))] })] }) })] }));
290
+ : {}, transform: graphTransform, children: _jsx(MetricsCircle, { cx: selected.x, cy: selected.y, radius: 5 }) }))] })] }) })] }));
287
291
  };
@@ -5,10 +5,11 @@ interface MetricsSeriesProps {
5
5
  color: string;
6
6
  strokeWidth: string;
7
7
  strokeDasharray?: string;
8
+ strokeLinecap?: React.CSSProperties['strokeLinecap'];
8
9
  xScale: (input: number) => number;
9
10
  yScale: (input: number) => number;
10
11
  onClick?: () => void;
11
12
  }
12
- declare const MetricsSeries: ({ data, line, color, strokeWidth, strokeDasharray, onClick, }: MetricsSeriesProps) => JSX.Element;
13
+ declare const MetricsSeries: ({ data, line, color, strokeWidth, strokeDasharray, strokeLinecap, onClick, }: MetricsSeriesProps) => JSX.Element;
13
14
  export default MetricsSeries;
14
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/MetricsSeries/index.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,UAAU,kBAAkB;IAC1B,IAAI,EAAE,GAAG,CAAC;IACV,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAClC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,QAAA,MAAM,aAAa,kEAOhB,kBAAkB,KAAG,GAAG,CAAC,OAa3B,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/MetricsSeries/index.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAEzB,UAAU,kBAAkB;IAC1B,IAAI,EAAE,GAAG,CAAC;IACV,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,eAAe,CAAC,CAAC;IACrD,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAClC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAClC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,QAAA,MAAM,aAAa,iFAQhB,kBAAkB,KAAG,GAAG,CAAC,OAc3B,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- const MetricsSeries = ({ data, line, color, strokeWidth, strokeDasharray = '', onClick, }) => (_jsx("g", { className: "line-group", children: _jsx("path", { className: "line", d: line(data.values) ?? undefined, style: {
2
+ const MetricsSeries = ({ data, line, color, strokeWidth, strokeDasharray = '', strokeLinecap = 'round', onClick, }) => (_jsx("g", { className: "line-group", children: _jsx("path", { className: "line", d: line(data.values) ?? undefined, style: {
3
3
  stroke: color,
4
4
  strokeWidth,
5
5
  strokeDasharray,
6
+ strokeLinecap,
6
7
  }, onClick: onClick }) }));
7
8
  export default MetricsSeries;
@@ -28,7 +28,7 @@ export function QueryControls({ showProfileTypeSelector, profileTypesData, profi
28
28
  setUserSumBySelection(newValue.map(option => option.value));
29
29
  }, placeholder: "Labels...", styles: {
30
30
  indicatorSeparator: () => ({ display: 'none' }),
31
- menu: provided => ({ ...provided, width: 'max-content' }),
31
+ menu: provided => ({ ...provided, width: 'max-content', zIndex: 50 }), // Setting the same zIndex as drop down menus
32
32
  }, isLoading: sumBySelectionLoading, isDisabled: !profileType.delta,
33
33
  // @ts-expect-error
34
34
  ref: sumByRef, onKeyDown: e => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parca/profile",
3
- "version": "0.18.2",
3
+ "version": "0.18.4",
4
4
  "description": "Profile viewing libraries",
5
5
  "dependencies": {
6
6
  "@headlessui/react": "^1.7.19",
@@ -77,5 +77,5 @@
77
77
  "access": "public",
78
78
  "registry": "https://registry.npmjs.org/"
79
79
  },
80
- "gitHead": "d32c2be676d39ea179551b46c464324627be27d0"
80
+ "gitHead": "50183ea5ca7122a2450eacb3f49cbebf7e6046fc"
81
81
  }
@@ -129,7 +129,11 @@ const RawUtilizationMetrics = ({
129
129
  const lineStrokeHover = '2px';
130
130
  const lineStrokeSelected = '3px';
131
131
 
132
- const graphWidth = width - margin * 1.5 - margin / 2;
132
+ const graphWidth = useMemo(() => width - margin * 1.5 - margin / 2, [width, margin]);
133
+ const graphTransform = useMemo(() => {
134
+ // Adds 10px padding which aligns the graph on the grid
135
+ return `translate(10, 0) scale(${(graphWidth - 10) / graphWidth}, 1)`;
136
+ }, [graphWidth]);
133
137
 
134
138
  const paddedFrom = from;
135
139
  const paddedTo = to;
@@ -461,7 +465,7 @@ const RawUtilizationMetrics = ({
461
465
  </text>
462
466
  </g>
463
467
  </g>
464
- <g className="lines fill-transparent">
468
+ <g className="lines fill-transparent" transform={graphTransform}>
465
469
  {series.map((s, i) => {
466
470
  const isLimit =
467
471
  s.metric.findIndex(m => m.name === '__type__' && m.value === 'limit') > -1;
@@ -158,7 +158,11 @@ export const RawMetricsGraph = ({
158
158
  width = 0;
159
159
  }
160
160
 
161
- const graphWidth = width - margin * 1.5 - margin / 2;
161
+ const graphWidth = useMemo(() => width - margin * 1.5 - margin / 2, [width, margin]);
162
+ const graphTransform = useMemo(() => {
163
+ // Adds 6px padding which aligns the graph on the grid
164
+ return `translate(6, 0) scale(${(graphWidth - 6) / graphWidth}, 1)`;
165
+ }, [graphWidth]);
162
166
 
163
167
  const series: Series[] = data.reduce<Series[]>(function (agg: Series[], s: MetricsSeriesPb) {
164
168
  if (s.labelset !== undefined) {
@@ -595,7 +599,11 @@ export const RawMetricsGraph = ({
595
599
  </text>
596
600
  </g>
597
601
  </g>
598
- <g className="lines fill-transparent">
602
+ <g
603
+ className="lines fill-transparent"
604
+ transform={graphTransform}
605
+ width={graphWidth - 100}
606
+ >
599
607
  {series.map((s, i) => (
600
608
  <g key={i} className="line">
601
609
  <MetricsSeries
@@ -618,6 +626,7 @@ export const RawMetricsGraph = ({
618
626
  className="circle-group"
619
627
  ref={metricPointRef}
620
628
  style={{fill: color(highlighted.seriesIndex.toString())}}
629
+ transform={graphTransform}
621
630
  >
622
631
  <MetricsCircle cx={highlighted.x} cy={highlighted.y} />
623
632
  </g>
@@ -630,6 +639,7 @@ export const RawMetricsGraph = ({
630
639
  ? {fill: color(selected.seriesIndex.toString())}
631
640
  : {}
632
641
  }
642
+ transform={graphTransform}
633
643
  >
634
644
  <MetricsCircle cx={selected.x} cy={selected.y} radius={5} />
635
645
  </g>
@@ -19,6 +19,7 @@ interface MetricsSeriesProps {
19
19
  color: string;
20
20
  strokeWidth: string;
21
21
  strokeDasharray?: string;
22
+ strokeLinecap?: React.CSSProperties['strokeLinecap'];
22
23
  xScale: (input: number) => number;
23
24
  yScale: (input: number) => number;
24
25
  onClick?: () => void;
@@ -30,6 +31,7 @@ const MetricsSeries = ({
30
31
  color,
31
32
  strokeWidth,
32
33
  strokeDasharray = '',
34
+ strokeLinecap = 'round',
33
35
  onClick,
34
36
  }: MetricsSeriesProps): JSX.Element => (
35
37
  <g className="line-group">
@@ -40,6 +42,7 @@ const MetricsSeries = ({
40
42
  stroke: color,
41
43
  strokeWidth,
42
44
  strokeDasharray,
45
+ strokeLinecap,
43
46
  }}
44
47
  onClick={onClick}
45
48
  />
@@ -189,7 +189,7 @@ export function QueryControls({
189
189
  placeholder="Labels..."
190
190
  styles={{
191
191
  indicatorSeparator: () => ({display: 'none'}),
192
- menu: provided => ({...provided, width: 'max-content'}),
192
+ menu: provided => ({...provided, width: 'max-content', zIndex: 50}), // Setting the same zIndex as drop down menus
193
193
  }}
194
194
  isLoading={sumBySelectionLoading}
195
195
  isDisabled={!profileType.delta}