Skip to content

Commit

Permalink
fix: status label
Browse files Browse the repository at this point in the history
fix: reduce chart endtime
  • Loading branch information
mizy committed Mar 2, 2023
1 parent 62f7823 commit 1220f75
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/store/models/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ export function SereviceModelWrapper(serviceApi) {
let _start = start / 1000;
let _end = end / 1000;
_start = _start - _start % step;
_end = _end + (step - _end % step);
_end -= _end % step; // end time should be less than the current time
let query = _query;
if (!noSuffix) {
if (clusterID) {
Expand Down
27 changes: 27 additions & 0 deletions src/utils/metric.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,33 @@ export const tooltipTitle = time =>

export const updateChartByValueType = (options, chartInstance) => {
switch (options.valueType) {
case VALUE_TYPE.status:
chartInstance.axis('value', {
label: {
formatter: value => Number(value)?'online':'offline',
},
});
chartInstance.tooltip({
customItems: items =>
items.map(item => {
const value = `${Number(item.value)?'online':'offline'}`;
return {
...item,
value,
};
}),
showCrosshairs: true,
shared: true,
title: tooltipTitle,
});
chartInstance.scale({
value: {
min: 0,
max: options.maxNum || 100,
tickInterval: options.maxNum ? (options.maxNum % 10 + 10) / 5 : 25,
},
});
break;
case VALUE_TYPE.percentage:
chartInstance.axis('value', {
label: {
Expand Down

0 comments on commit 1220f75

Please sign in to comment.