Skip to content

Commit bc32976

Browse files
committed
feat: Allow to set table headers
1 parent 636b085 commit bc32976

File tree

2 files changed

+47
-14
lines changed

2 files changed

+47
-14
lines changed

.changeset/wise-wombats-hunt.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@hyperdx/app': patch
3+
'@hyperdx/api': patch
4+
---
5+
6+
feat: Allow to set table headers and chart line names

packages/app/src/EditChartForm.tsx

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
Group,
1111
Paper,
1212
Switch,
13+
TextInput,
1314
Tooltip,
1415
} from '@mantine/core';
1516

@@ -958,22 +959,48 @@ export const EditMultiSeriesChartForm = ({
958959
<Divider
959960
label={
960961
<Group gap="xs">
961-
{editedChart.seriesReturnType === 'column' && (
962-
<ColorSwatchInput
963-
value={series.color}
964-
onChange={(color?: string) => {
965-
setEditedChart(
966-
produce(editedChart, draft => {
967-
const draftSeries = draft.series[i];
968-
if (draftSeries.type === chartType) {
969-
draftSeries.color = color;
970-
}
971-
}),
972-
);
973-
}}
974-
/>
962+
{(series.type === 'table' || series.type === 'time') && (
963+
<>
964+
<TextInput
965+
leftSection={
966+
<i className="bi bi-chat-left-quote-fill fs-8.5" />
967+
}
968+
title="Table header name"
969+
size="xs"
970+
w={200}
971+
value={series.displayName}
972+
onChange={event => {
973+
setEditedChart(
974+
produce(editedChart, draft => {
975+
const s = draft.series[i];
976+
if (s.type === 'table' || s.type === 'time') {
977+
s.displayName = event.currentTarget.value;
978+
}
979+
}),
980+
);
981+
}}
982+
placeholder={`${series.aggFn}(${series.field || ''})`}
983+
/>
984+
</>
975985
)}
976986

987+
{editedChart.seriesReturnType === 'column' &&
988+
chartType === 'time' && (
989+
<ColorSwatchInput
990+
value={series.color}
991+
onChange={(color?: string) => {
992+
setEditedChart(
993+
produce(editedChart, draft => {
994+
const draftSeries = draft.series[i];
995+
if (draftSeries.type === chartType) {
996+
draftSeries.color = color;
997+
}
998+
}),
999+
);
1000+
}}
1001+
/>
1002+
)}
1003+
9771004
{editedChart.series.length > 1 && (
9781005
<Button
9791006
variant="subtle"

0 commit comments

Comments
 (0)