mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 18:45:56 +08:00
fix: apply x axis date/time formatting only to panel types that have date/time in x axis (#6956)
This commit is contained in:
parent
f04589a0b2
commit
f2be856f63
@ -259,7 +259,7 @@ function AnomalyAlertEvaluationView({
|
|||||||
grid: {
|
grid: {
|
||||||
show: true,
|
show: true,
|
||||||
},
|
},
|
||||||
axes: getAxes(isDarkMode, yAxisUnit),
|
axes: getAxes({ isDarkMode, yAxisUnit }),
|
||||||
tzDate: (timestamp: number): Date =>
|
tzDate: (timestamp: number): Date =>
|
||||||
uPlot.tzDate(new Date(timestamp * 1e3), timezone.value),
|
uPlot.tzDate(new Date(timestamp * 1e3), timezone.value),
|
||||||
};
|
};
|
||||||
|
@ -122,7 +122,7 @@ export function BillingUsageGraph(props: BillingUsageGraphProps): JSX.Element {
|
|||||||
[graphCompatibleData.data.result],
|
[graphCompatibleData.data.result],
|
||||||
);
|
);
|
||||||
|
|
||||||
const axesOptions = getAxes(isDarkMode, '');
|
const axesOptions = getAxes({ isDarkMode, yAxisUnit: '' });
|
||||||
|
|
||||||
const optionsForChart: uPlot.Options = useMemo(
|
const optionsForChart: uPlot.Options = useMemo(
|
||||||
() => ({
|
() => ({
|
||||||
|
@ -387,6 +387,6 @@ export const getUPlotChartOptions = ({
|
|||||||
hiddenGraph,
|
hiddenGraph,
|
||||||
isDarkMode,
|
isDarkMode,
|
||||||
}),
|
}),
|
||||||
axes: getAxes(isDarkMode, yAxisUnit),
|
axes: getAxes({ isDarkMode, yAxisUnit, panelType }),
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -123,6 +123,7 @@ export const getUplotHistogramChartOptions = ({
|
|||||||
setGraphsVisibilityStates,
|
setGraphsVisibilityStates,
|
||||||
mergeAllQueries,
|
mergeAllQueries,
|
||||||
onClickHandler = _noop,
|
onClickHandler = _noop,
|
||||||
|
panelType,
|
||||||
}: GetUplotHistogramChartOptionsProps): uPlot.Options =>
|
}: GetUplotHistogramChartOptionsProps): uPlot.Options =>
|
||||||
({
|
({
|
||||||
id,
|
id,
|
||||||
@ -210,5 +211,5 @@ export const getUplotHistogramChartOptions = ({
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
axes: getAxes(isDarkMode),
|
axes: getAxes({ isDarkMode, panelType }),
|
||||||
} as uPlot.Options);
|
} as uPlot.Options);
|
||||||
|
@ -1,12 +1,27 @@
|
|||||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import { getToolTipValue } from 'components/Graph/yAxisConfig';
|
import { getToolTipValue } from 'components/Graph/yAxisConfig';
|
||||||
|
import { PANEL_TYPES } from 'constants/queryBuilder';
|
||||||
|
|
||||||
import { uPlotXAxisValuesFormat } from './constants';
|
import { uPlotXAxisValuesFormat } from './constants';
|
||||||
import getGridColor from './getGridColor';
|
import getGridColor from './getGridColor';
|
||||||
|
|
||||||
|
const PANEL_TYPES_WITH_X_AXIS_DATETIME_FORMAT = [
|
||||||
|
PANEL_TYPES.TIME_SERIES,
|
||||||
|
PANEL_TYPES.BAR,
|
||||||
|
PANEL_TYPES.PIE,
|
||||||
|
];
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||||
const getAxes = (isDarkMode: boolean, yAxisUnit?: string): any => [
|
const getAxes = ({
|
||||||
|
isDarkMode,
|
||||||
|
yAxisUnit,
|
||||||
|
panelType,
|
||||||
|
}: {
|
||||||
|
isDarkMode: boolean;
|
||||||
|
yAxisUnit?: string;
|
||||||
|
panelType?: PANEL_TYPES;
|
||||||
|
}): any => [
|
||||||
{
|
{
|
||||||
stroke: isDarkMode ? 'white' : 'black', // Color of the axis line
|
stroke: isDarkMode ? 'white' : 'black', // Color of the axis line
|
||||||
grid: {
|
grid: {
|
||||||
@ -19,7 +34,11 @@ const getAxes = (isDarkMode: boolean, yAxisUnit?: string): any => [
|
|||||||
width: 0.3, // Width of the tick lines,
|
width: 0.3, // Width of the tick lines,
|
||||||
show: true,
|
show: true,
|
||||||
},
|
},
|
||||||
|
...(PANEL_TYPES_WITH_X_AXIS_DATETIME_FORMAT.includes(panelType)
|
||||||
|
? {
|
||||||
values: uPlotXAxisValuesFormat,
|
values: uPlotXAxisValuesFormat,
|
||||||
|
}
|
||||||
|
: {}),
|
||||||
gap: 5,
|
gap: 5,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user