Skip to content

Commit dbadc71

Browse files
feat(MetricChart): add legend to some charts
1 parent 4dd053d commit dbadc71

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

src/components/MetricChart/MetricChart.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const prepareWidgetData = (
2929
data: PreparedMetricsData,
3030
options: ChartOptions = {},
3131
): YagrWidgetData => {
32-
const {dataType, scaleRange} = options;
32+
const {dataType, scaleRange, showLegend} = options;
3333
const defaultDataFormatter = getDefaultDataFormatter(dataType);
3434

3535
const isDataEmpty = !data.metrics.length;
@@ -91,6 +91,9 @@ const prepareWidgetData = (
9191
show: true,
9292
tracking: 'sticky',
9393
},
94+
legend: {
95+
show: showLegend,
96+
},
9497
},
9598
};
9699
};

src/components/MetricChart/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export interface ChartOptions {
3838
min?: number;
3939
max?: number;
4040
};
41+
showLegend?: boolean;
4142
}
4243

4344
export type ChartDataStatus = 'loading' | 'success' | 'error';

src/containers/Tenant/Diagnostics/TenantOverview/DefaultOverviewContent/defaultDashboardConfig.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,31 +16,24 @@ export const defaultDashboardConfig: ChartConfig[] = [
1616
metrics: [
1717
{
1818
target: 'queries.latencies.p50',
19-
title: i18n('charts.transaction-latency', {
20-
percentile: 'p50',
21-
}),
19+
title: 'p50',
2220
},
2321
{
2422
target: 'queries.latencies.p75',
25-
title: i18n('charts.transaction-latency', {
26-
percentile: 'p75',
27-
}),
23+
title: 'p75',
2824
},
2925
{
3026
target: 'queries.latencies.p90',
31-
title: i18n('charts.transaction-latency', {
32-
percentile: 'p90',
33-
}),
27+
title: 'p90',
3428
},
3529
{
3630
target: 'queries.latencies.p99',
37-
title: i18n('charts.transaction-latency', {
38-
percentile: 'p99',
39-
}),
31+
title: 'p99',
4032
},
4133
],
4234
options: {
4335
dataType: 'ms',
36+
showLegend: true,
4437
},
4538
},
4639
];

src/containers/Tenant/Diagnostics/TenantOverview/TenantCpu/cpuDashboardConfig.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const cpuDashboardConfig: ChartConfig[] = [
2222
min: 0,
2323
max: 1,
2424
},
25+
showLegend: true,
2526
},
2627
},
2728
];

0 commit comments

Comments
 (0)