230 lines
6.6 KiB
TypeScript
Raw Normal View History

import { QueryParams } from 'constants/query';
import { PANEL_TYPES } from 'constants/queryBuilder';
import { useGetQueryRange } from 'hooks/queryBuilder/useGetQueryRange';
import { useStepInterval } from 'hooks/queryBuilder/useStepInterval';
feat: uplot graph is added and some re-rendering is reduced (#3771) * feat: uplot graph is added and some re-rendering is reduced * chore: uplot is updated * feat: changes for the graph is updated * refactor: added y-axis unit in uplot graph (#3818) * refactor: added y-axis unit in uplot graph * refactor: removed the ticks stroke from both access * feat: create tooltip plugin for uplot charts (#3823) * feat: create tooltip plugin for uplot charts * feat: show labels in legends section --------- Co-authored-by: Yunus M <myounis.ar@live.com> * feat: uplot points is handled (#3817) * chore: resize is updated * chore: uplot chart dark mode is updated * chore: widget is updated * chore: options is updated * chore: value panel is updated * feat: uplot chart is updated * feat: onDrag is updated * feat: data for graph is updated * feat: alert section is fixed * feat: not found is updated * feat: fix dashboard title section and other uplot parity issues (#3839) * feat: fix dashboard title section and other uplot parity issues * feat: update scrollbar style for legend container * chore: initial width is updated * feat: onlcick is updated * feat: widget full view fixes (#3847) Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: show labels in tooltip overlay (#3867) * chore: memo is added * feat: toggle is updated * fix: Tooltip values is now fixed (#3894) * chore: tooltip is updated * chore: avoided the compute based on show * chore: tooltip data is updated * feat: resize graph based on the y axis max label length (#3895) * chore: build is in progress to fix * [Feat]: Full View (#3896) * fix: initial setup for full view done * refactor: done with the graph manager logic * refactor: done with the toggle issue in full view * refactor: done with toggle of data * refactor: done with legend to table mapping * refactor: ts error * chore: utils is updated * refactor: updated types * fix: option type fix --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: use spline renderer to plot curved line graphs, full view impor… (#3919) * feat: use spline renderer to plot curved line graphs, full view imporvements * feat: increase min height for panel * chore: move code to utils and plugins in uplot folder * chore: update tooltip styles * fix: add panel issue in dashboard (#3920) * fix: update on click plugin opts import path * feat: replace time series graph in logs explorer and trace explorer with uplot (#3925) * feat: alert threshold is added (#3931) * feat: uplot styles are fixed (#3941) * Fix/app dex aligment (#3944) * feat: uplot styles are fixed * fix: app dex aligment * fix: full view after saving is fixed * feat: css is updated (#3948) * feat: on click handler position - factor in the padding on top and left * fix: timestamp for start and end is updated for view trace (#3966) * fix: timestamp for start and end is updated for view trace * chore: timestamp is added * fix: loading over flow is fixed (#3969) --------- Co-authored-by: Rajat Dabade <rajat@signoz.io> Co-authored-by: Yunus M <myounis.ar@live.com>
2023-11-15 15:33:45 +05:30
import { useIsDarkMode } from 'hooks/useDarkMode';
import { useResizeObserver } from 'hooks/useDimensions';
import { useIntersectionObserver } from 'hooks/useIntersectionObserver';
import useUrlQuery from 'hooks/useUrlQuery';
import { getDashboardVariables } from 'lib/dashbaordVariables/getDashboardVariables';
2024-01-17 13:57:05 +05:30
import GetMinMax from 'lib/getMinMax';
import getTimeString from 'lib/getTimeString';
import history from 'lib/history';
import { getUPlotChartOptions } from 'lib/uPlotLib/getUplotChartOptions';
import { getUPlotChartData } from 'lib/uPlotLib/utils/getUplotChartData';
import isEmpty from 'lodash-es/isEmpty';
feat: uplot graph is added and some re-rendering is reduced (#3771) * feat: uplot graph is added and some re-rendering is reduced * chore: uplot is updated * feat: changes for the graph is updated * refactor: added y-axis unit in uplot graph (#3818) * refactor: added y-axis unit in uplot graph * refactor: removed the ticks stroke from both access * feat: create tooltip plugin for uplot charts (#3823) * feat: create tooltip plugin for uplot charts * feat: show labels in legends section --------- Co-authored-by: Yunus M <myounis.ar@live.com> * feat: uplot points is handled (#3817) * chore: resize is updated * chore: uplot chart dark mode is updated * chore: widget is updated * chore: options is updated * chore: value panel is updated * feat: uplot chart is updated * feat: onDrag is updated * feat: data for graph is updated * feat: alert section is fixed * feat: not found is updated * feat: fix dashboard title section and other uplot parity issues (#3839) * feat: fix dashboard title section and other uplot parity issues * feat: update scrollbar style for legend container * chore: initial width is updated * feat: onlcick is updated * feat: widget full view fixes (#3847) Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: show labels in tooltip overlay (#3867) * chore: memo is added * feat: toggle is updated * fix: Tooltip values is now fixed (#3894) * chore: tooltip is updated * chore: avoided the compute based on show * chore: tooltip data is updated * feat: resize graph based on the y axis max label length (#3895) * chore: build is in progress to fix * [Feat]: Full View (#3896) * fix: initial setup for full view done * refactor: done with the graph manager logic * refactor: done with the toggle issue in full view * refactor: done with toggle of data * refactor: done with legend to table mapping * refactor: ts error * chore: utils is updated * refactor: updated types * fix: option type fix --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: use spline renderer to plot curved line graphs, full view impor… (#3919) * feat: use spline renderer to plot curved line graphs, full view imporvements * feat: increase min height for panel * chore: move code to utils and plugins in uplot folder * chore: update tooltip styles * fix: add panel issue in dashboard (#3920) * fix: update on click plugin opts import path * feat: replace time series graph in logs explorer and trace explorer with uplot (#3925) * feat: alert threshold is added (#3931) * feat: uplot styles are fixed (#3941) * Fix/app dex aligment (#3944) * feat: uplot styles are fixed * fix: app dex aligment * fix: full view after saving is fixed * feat: css is updated (#3948) * feat: on click handler position - factor in the padding on top and left * fix: timestamp for start and end is updated for view trace (#3966) * fix: timestamp for start and end is updated for view trace * chore: timestamp is added * fix: loading over flow is fixed (#3969) --------- Co-authored-by: Rajat Dabade <rajat@signoz.io> Co-authored-by: Yunus M <myounis.ar@live.com>
2023-11-15 15:33:45 +05:30
import _noop from 'lodash-es/noop';
import { useDashboard } from 'providers/Dashboard/Dashboard';
import { memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { useLocation } from 'react-router-dom';
import { UpdateTimeInterval } from 'store/actions';
import { AppState } from 'store/reducers';
import { GlobalReducer } from 'types/reducer/globalTime';
import { getTimeRange } from 'utils/getTimeRange';
import EmptyWidget from '../EmptyWidget';
import { MenuItemKeys } from '../WidgetHeader/contants';
import { GridCardGraphProps } from './types';
import WidgetGraphComponent from './WidgetGraphComponent';
function GridCardGraph({
widget,
name,
feat: uplot graph is added and some re-rendering is reduced (#3771) * feat: uplot graph is added and some re-rendering is reduced * chore: uplot is updated * feat: changes for the graph is updated * refactor: added y-axis unit in uplot graph (#3818) * refactor: added y-axis unit in uplot graph * refactor: removed the ticks stroke from both access * feat: create tooltip plugin for uplot charts (#3823) * feat: create tooltip plugin for uplot charts * feat: show labels in legends section --------- Co-authored-by: Yunus M <myounis.ar@live.com> * feat: uplot points is handled (#3817) * chore: resize is updated * chore: uplot chart dark mode is updated * chore: widget is updated * chore: options is updated * chore: value panel is updated * feat: uplot chart is updated * feat: onDrag is updated * feat: data for graph is updated * feat: alert section is fixed * feat: not found is updated * feat: fix dashboard title section and other uplot parity issues (#3839) * feat: fix dashboard title section and other uplot parity issues * feat: update scrollbar style for legend container * chore: initial width is updated * feat: onlcick is updated * feat: widget full view fixes (#3847) Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: show labels in tooltip overlay (#3867) * chore: memo is added * feat: toggle is updated * fix: Tooltip values is now fixed (#3894) * chore: tooltip is updated * chore: avoided the compute based on show * chore: tooltip data is updated * feat: resize graph based on the y axis max label length (#3895) * chore: build is in progress to fix * [Feat]: Full View (#3896) * fix: initial setup for full view done * refactor: done with the graph manager logic * refactor: done with the toggle issue in full view * refactor: done with toggle of data * refactor: done with legend to table mapping * refactor: ts error * chore: utils is updated * refactor: updated types * fix: option type fix --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: use spline renderer to plot curved line graphs, full view impor… (#3919) * feat: use spline renderer to plot curved line graphs, full view imporvements * feat: increase min height for panel * chore: move code to utils and plugins in uplot folder * chore: update tooltip styles * fix: add panel issue in dashboard (#3920) * fix: update on click plugin opts import path * feat: replace time series graph in logs explorer and trace explorer with uplot (#3925) * feat: alert threshold is added (#3931) * feat: uplot styles are fixed (#3941) * Fix/app dex aligment (#3944) * feat: uplot styles are fixed * fix: app dex aligment * fix: full view after saving is fixed * feat: css is updated (#3948) * feat: on click handler position - factor in the padding on top and left * fix: timestamp for start and end is updated for view trace (#3966) * fix: timestamp for start and end is updated for view trace * chore: timestamp is added * fix: loading over flow is fixed (#3969) --------- Co-authored-by: Rajat Dabade <rajat@signoz.io> Co-authored-by: Yunus M <myounis.ar@live.com>
2023-11-15 15:33:45 +05:30
onClickHandler = _noop,
headerMenuList = [MenuItemKeys.View],
isQueryEnabled,
threshold,
feat: uplot graph is added and some re-rendering is reduced (#3771) * feat: uplot graph is added and some re-rendering is reduced * chore: uplot is updated * feat: changes for the graph is updated * refactor: added y-axis unit in uplot graph (#3818) * refactor: added y-axis unit in uplot graph * refactor: removed the ticks stroke from both access * feat: create tooltip plugin for uplot charts (#3823) * feat: create tooltip plugin for uplot charts * feat: show labels in legends section --------- Co-authored-by: Yunus M <myounis.ar@live.com> * feat: uplot points is handled (#3817) * chore: resize is updated * chore: uplot chart dark mode is updated * chore: widget is updated * chore: options is updated * chore: value panel is updated * feat: uplot chart is updated * feat: onDrag is updated * feat: data for graph is updated * feat: alert section is fixed * feat: not found is updated * feat: fix dashboard title section and other uplot parity issues (#3839) * feat: fix dashboard title section and other uplot parity issues * feat: update scrollbar style for legend container * chore: initial width is updated * feat: onlcick is updated * feat: widget full view fixes (#3847) Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: show labels in tooltip overlay (#3867) * chore: memo is added * feat: toggle is updated * fix: Tooltip values is now fixed (#3894) * chore: tooltip is updated * chore: avoided the compute based on show * chore: tooltip data is updated * feat: resize graph based on the y axis max label length (#3895) * chore: build is in progress to fix * [Feat]: Full View (#3896) * fix: initial setup for full view done * refactor: done with the graph manager logic * refactor: done with the toggle issue in full view * refactor: done with toggle of data * refactor: done with legend to table mapping * refactor: ts error * chore: utils is updated * refactor: updated types * fix: option type fix --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: use spline renderer to plot curved line graphs, full view impor… (#3919) * feat: use spline renderer to plot curved line graphs, full view imporvements * feat: increase min height for panel * chore: move code to utils and plugins in uplot folder * chore: update tooltip styles * fix: add panel issue in dashboard (#3920) * fix: update on click plugin opts import path * feat: replace time series graph in logs explorer and trace explorer with uplot (#3925) * feat: alert threshold is added (#3931) * feat: uplot styles are fixed (#3941) * Fix/app dex aligment (#3944) * feat: uplot styles are fixed * fix: app dex aligment * fix: full view after saving is fixed * feat: css is updated (#3948) * feat: on click handler position - factor in the padding on top and left * fix: timestamp for start and end is updated for view trace (#3966) * fix: timestamp for start and end is updated for view trace * chore: timestamp is added * fix: loading over flow is fixed (#3969) --------- Co-authored-by: Rajat Dabade <rajat@signoz.io> Co-authored-by: Yunus M <myounis.ar@live.com>
2023-11-15 15:33:45 +05:30
variables,
fillSpans = false,
}: GridCardGraphProps): JSX.Element {
const dispatch = useDispatch();
const [errorMessage, setErrorMessage] = useState<string>();
const { toScrollWidgetId, setToScrollWidgetId } = useDashboard();
const [minTimeScale, setMinTimeScale] = useState<number>();
const [maxTimeScale, setMaxTimeScale] = useState<number>();
const urlQuery = useUrlQuery();
const location = useLocation();
2024-01-17 13:57:05 +05:30
const { minTime, maxTime, selectedTime: globalSelectedInterval } = useSelector<
AppState,
GlobalReducer
>((state) => state.globalTime);
feat: uplot graph is added and some re-rendering is reduced (#3771) * feat: uplot graph is added and some re-rendering is reduced * chore: uplot is updated * feat: changes for the graph is updated * refactor: added y-axis unit in uplot graph (#3818) * refactor: added y-axis unit in uplot graph * refactor: removed the ticks stroke from both access * feat: create tooltip plugin for uplot charts (#3823) * feat: create tooltip plugin for uplot charts * feat: show labels in legends section --------- Co-authored-by: Yunus M <myounis.ar@live.com> * feat: uplot points is handled (#3817) * chore: resize is updated * chore: uplot chart dark mode is updated * chore: widget is updated * chore: options is updated * chore: value panel is updated * feat: uplot chart is updated * feat: onDrag is updated * feat: data for graph is updated * feat: alert section is fixed * feat: not found is updated * feat: fix dashboard title section and other uplot parity issues (#3839) * feat: fix dashboard title section and other uplot parity issues * feat: update scrollbar style for legend container * chore: initial width is updated * feat: onlcick is updated * feat: widget full view fixes (#3847) Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: show labels in tooltip overlay (#3867) * chore: memo is added * feat: toggle is updated * fix: Tooltip values is now fixed (#3894) * chore: tooltip is updated * chore: avoided the compute based on show * chore: tooltip data is updated * feat: resize graph based on the y axis max label length (#3895) * chore: build is in progress to fix * [Feat]: Full View (#3896) * fix: initial setup for full view done * refactor: done with the graph manager logic * refactor: done with the toggle issue in full view * refactor: done with toggle of data * refactor: done with legend to table mapping * refactor: ts error * chore: utils is updated * refactor: updated types * fix: option type fix --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: use spline renderer to plot curved line graphs, full view impor… (#3919) * feat: use spline renderer to plot curved line graphs, full view imporvements * feat: increase min height for panel * chore: move code to utils and plugins in uplot folder * chore: update tooltip styles * fix: add panel issue in dashboard (#3920) * fix: update on click plugin opts import path * feat: replace time series graph in logs explorer and trace explorer with uplot (#3925) * feat: alert threshold is added (#3931) * feat: uplot styles are fixed (#3941) * Fix/app dex aligment (#3944) * feat: uplot styles are fixed * fix: app dex aligment * fix: full view after saving is fixed * feat: css is updated (#3948) * feat: on click handler position - factor in the padding on top and left * fix: timestamp for start and end is updated for view trace (#3966) * fix: timestamp for start and end is updated for view trace * chore: timestamp is added * fix: loading over flow is fixed (#3969) --------- Co-authored-by: Rajat Dabade <rajat@signoz.io> Co-authored-by: Yunus M <myounis.ar@live.com>
2023-11-15 15:33:45 +05:30
const onDragSelect = useCallback(
(start: number, end: number): void => {
const startTimestamp = Math.trunc(start);
const endTimestamp = Math.trunc(end);
feat: uplot graph is added and some re-rendering is reduced (#3771) * feat: uplot graph is added and some re-rendering is reduced * chore: uplot is updated * feat: changes for the graph is updated * refactor: added y-axis unit in uplot graph (#3818) * refactor: added y-axis unit in uplot graph * refactor: removed the ticks stroke from both access * feat: create tooltip plugin for uplot charts (#3823) * feat: create tooltip plugin for uplot charts * feat: show labels in legends section --------- Co-authored-by: Yunus M <myounis.ar@live.com> * feat: uplot points is handled (#3817) * chore: resize is updated * chore: uplot chart dark mode is updated * chore: widget is updated * chore: options is updated * chore: value panel is updated * feat: uplot chart is updated * feat: onDrag is updated * feat: data for graph is updated * feat: alert section is fixed * feat: not found is updated * feat: fix dashboard title section and other uplot parity issues (#3839) * feat: fix dashboard title section and other uplot parity issues * feat: update scrollbar style for legend container * chore: initial width is updated * feat: onlcick is updated * feat: widget full view fixes (#3847) Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: show labels in tooltip overlay (#3867) * chore: memo is added * feat: toggle is updated * fix: Tooltip values is now fixed (#3894) * chore: tooltip is updated * chore: avoided the compute based on show * chore: tooltip data is updated * feat: resize graph based on the y axis max label length (#3895) * chore: build is in progress to fix * [Feat]: Full View (#3896) * fix: initial setup for full view done * refactor: done with the graph manager logic * refactor: done with the toggle issue in full view * refactor: done with toggle of data * refactor: done with legend to table mapping * refactor: ts error * chore: utils is updated * refactor: updated types * fix: option type fix --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: use spline renderer to plot curved line graphs, full view impor… (#3919) * feat: use spline renderer to plot curved line graphs, full view imporvements * feat: increase min height for panel * chore: move code to utils and plugins in uplot folder * chore: update tooltip styles * fix: add panel issue in dashboard (#3920) * fix: update on click plugin opts import path * feat: replace time series graph in logs explorer and trace explorer with uplot (#3925) * feat: alert threshold is added (#3931) * feat: uplot styles are fixed (#3941) * Fix/app dex aligment (#3944) * feat: uplot styles are fixed * fix: app dex aligment * fix: full view after saving is fixed * feat: css is updated (#3948) * feat: on click handler position - factor in the padding on top and left * fix: timestamp for start and end is updated for view trace (#3966) * fix: timestamp for start and end is updated for view trace * chore: timestamp is added * fix: loading over flow is fixed (#3969) --------- Co-authored-by: Rajat Dabade <rajat@signoz.io> Co-authored-by: Yunus M <myounis.ar@live.com>
2023-11-15 15:33:45 +05:30
if (startTimestamp !== endTimestamp) {
dispatch(UpdateTimeInterval('custom', [startTimestamp, endTimestamp]));
}
2024-01-17 13:57:05 +05:30
const { maxTime, minTime } = GetMinMax('custom', [
startTimestamp,
endTimestamp,
]);
urlQuery.set(QueryParams.startTime, minTime.toString());
urlQuery.set(QueryParams.endTime, maxTime.toString());
const generatedUrl = `${location.pathname}?${urlQuery.toString()}`;
history.push(generatedUrl);
feat: uplot graph is added and some re-rendering is reduced (#3771) * feat: uplot graph is added and some re-rendering is reduced * chore: uplot is updated * feat: changes for the graph is updated * refactor: added y-axis unit in uplot graph (#3818) * refactor: added y-axis unit in uplot graph * refactor: removed the ticks stroke from both access * feat: create tooltip plugin for uplot charts (#3823) * feat: create tooltip plugin for uplot charts * feat: show labels in legends section --------- Co-authored-by: Yunus M <myounis.ar@live.com> * feat: uplot points is handled (#3817) * chore: resize is updated * chore: uplot chart dark mode is updated * chore: widget is updated * chore: options is updated * chore: value panel is updated * feat: uplot chart is updated * feat: onDrag is updated * feat: data for graph is updated * feat: alert section is fixed * feat: not found is updated * feat: fix dashboard title section and other uplot parity issues (#3839) * feat: fix dashboard title section and other uplot parity issues * feat: update scrollbar style for legend container * chore: initial width is updated * feat: onlcick is updated * feat: widget full view fixes (#3847) Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: show labels in tooltip overlay (#3867) * chore: memo is added * feat: toggle is updated * fix: Tooltip values is now fixed (#3894) * chore: tooltip is updated * chore: avoided the compute based on show * chore: tooltip data is updated * feat: resize graph based on the y axis max label length (#3895) * chore: build is in progress to fix * [Feat]: Full View (#3896) * fix: initial setup for full view done * refactor: done with the graph manager logic * refactor: done with the toggle issue in full view * refactor: done with toggle of data * refactor: done with legend to table mapping * refactor: ts error * chore: utils is updated * refactor: updated types * fix: option type fix --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: use spline renderer to plot curved line graphs, full view impor… (#3919) * feat: use spline renderer to plot curved line graphs, full view imporvements * feat: increase min height for panel * chore: move code to utils and plugins in uplot folder * chore: update tooltip styles * fix: add panel issue in dashboard (#3920) * fix: update on click plugin opts import path * feat: replace time series graph in logs explorer and trace explorer with uplot (#3925) * feat: alert threshold is added (#3931) * feat: uplot styles are fixed (#3941) * Fix/app dex aligment (#3944) * feat: uplot styles are fixed * fix: app dex aligment * fix: full view after saving is fixed * feat: css is updated (#3948) * feat: on click handler position - factor in the padding on top and left * fix: timestamp for start and end is updated for view trace (#3966) * fix: timestamp for start and end is updated for view trace * chore: timestamp is added * fix: loading over flow is fixed (#3969) --------- Co-authored-by: Rajat Dabade <rajat@signoz.io> Co-authored-by: Yunus M <myounis.ar@live.com>
2023-11-15 15:33:45 +05:30
},
[dispatch, location.pathname, urlQuery],
feat: uplot graph is added and some re-rendering is reduced (#3771) * feat: uplot graph is added and some re-rendering is reduced * chore: uplot is updated * feat: changes for the graph is updated * refactor: added y-axis unit in uplot graph (#3818) * refactor: added y-axis unit in uplot graph * refactor: removed the ticks stroke from both access * feat: create tooltip plugin for uplot charts (#3823) * feat: create tooltip plugin for uplot charts * feat: show labels in legends section --------- Co-authored-by: Yunus M <myounis.ar@live.com> * feat: uplot points is handled (#3817) * chore: resize is updated * chore: uplot chart dark mode is updated * chore: widget is updated * chore: options is updated * chore: value panel is updated * feat: uplot chart is updated * feat: onDrag is updated * feat: data for graph is updated * feat: alert section is fixed * feat: not found is updated * feat: fix dashboard title section and other uplot parity issues (#3839) * feat: fix dashboard title section and other uplot parity issues * feat: update scrollbar style for legend container * chore: initial width is updated * feat: onlcick is updated * feat: widget full view fixes (#3847) Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: show labels in tooltip overlay (#3867) * chore: memo is added * feat: toggle is updated * fix: Tooltip values is now fixed (#3894) * chore: tooltip is updated * chore: avoided the compute based on show * chore: tooltip data is updated * feat: resize graph based on the y axis max label length (#3895) * chore: build is in progress to fix * [Feat]: Full View (#3896) * fix: initial setup for full view done * refactor: done with the graph manager logic * refactor: done with the toggle issue in full view * refactor: done with toggle of data * refactor: done with legend to table mapping * refactor: ts error * chore: utils is updated * refactor: updated types * fix: option type fix --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: use spline renderer to plot curved line graphs, full view impor… (#3919) * feat: use spline renderer to plot curved line graphs, full view imporvements * feat: increase min height for panel * chore: move code to utils and plugins in uplot folder * chore: update tooltip styles * fix: add panel issue in dashboard (#3920) * fix: update on click plugin opts import path * feat: replace time series graph in logs explorer and trace explorer with uplot (#3925) * feat: alert threshold is added (#3931) * feat: uplot styles are fixed (#3941) * Fix/app dex aligment (#3944) * feat: uplot styles are fixed * fix: app dex aligment * fix: full view after saving is fixed * feat: css is updated (#3948) * feat: on click handler position - factor in the padding on top and left * fix: timestamp for start and end is updated for view trace (#3966) * fix: timestamp for start and end is updated for view trace * chore: timestamp is added * fix: loading over flow is fixed (#3969) --------- Co-authored-by: Rajat Dabade <rajat@signoz.io> Co-authored-by: Yunus M <myounis.ar@live.com>
2023-11-15 15:33:45 +05:30
);
2024-01-17 13:57:05 +05:30
const handleBackNavigation = (): void => {
const searchParams = new URLSearchParams(window.location.search);
const startTime = searchParams.get(QueryParams.startTime);
const endTime = searchParams.get(QueryParams.endTime);
if (startTime && endTime && startTime !== endTime) {
dispatch(
UpdateTimeInterval('custom', [
2024-01-17 14:04:38 +05:30
parseInt(getTimeString(startTime), 10),
parseInt(getTimeString(endTime), 10),
2024-01-17 13:57:05 +05:30
]),
);
}
};
useEffect(() => {
window.addEventListener('popstate', handleBackNavigation);
return (): void => {
window.removeEventListener('popstate', handleBackNavigation);
};
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
feat: uplot graph is added and some re-rendering is reduced (#3771) * feat: uplot graph is added and some re-rendering is reduced * chore: uplot is updated * feat: changes for the graph is updated * refactor: added y-axis unit in uplot graph (#3818) * refactor: added y-axis unit in uplot graph * refactor: removed the ticks stroke from both access * feat: create tooltip plugin for uplot charts (#3823) * feat: create tooltip plugin for uplot charts * feat: show labels in legends section --------- Co-authored-by: Yunus M <myounis.ar@live.com> * feat: uplot points is handled (#3817) * chore: resize is updated * chore: uplot chart dark mode is updated * chore: widget is updated * chore: options is updated * chore: value panel is updated * feat: uplot chart is updated * feat: onDrag is updated * feat: data for graph is updated * feat: alert section is fixed * feat: not found is updated * feat: fix dashboard title section and other uplot parity issues (#3839) * feat: fix dashboard title section and other uplot parity issues * feat: update scrollbar style for legend container * chore: initial width is updated * feat: onlcick is updated * feat: widget full view fixes (#3847) Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: show labels in tooltip overlay (#3867) * chore: memo is added * feat: toggle is updated * fix: Tooltip values is now fixed (#3894) * chore: tooltip is updated * chore: avoided the compute based on show * chore: tooltip data is updated * feat: resize graph based on the y axis max label length (#3895) * chore: build is in progress to fix * [Feat]: Full View (#3896) * fix: initial setup for full view done * refactor: done with the graph manager logic * refactor: done with the toggle issue in full view * refactor: done with toggle of data * refactor: done with legend to table mapping * refactor: ts error * chore: utils is updated * refactor: updated types * fix: option type fix --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: use spline renderer to plot curved line graphs, full view impor… (#3919) * feat: use spline renderer to plot curved line graphs, full view imporvements * feat: increase min height for panel * chore: move code to utils and plugins in uplot folder * chore: update tooltip styles * fix: add panel issue in dashboard (#3920) * fix: update on click plugin opts import path * feat: replace time series graph in logs explorer and trace explorer with uplot (#3925) * feat: alert threshold is added (#3931) * feat: uplot styles are fixed (#3941) * Fix/app dex aligment (#3944) * feat: uplot styles are fixed * fix: app dex aligment * fix: full view after saving is fixed * feat: css is updated (#3948) * feat: on click handler position - factor in the padding on top and left * fix: timestamp for start and end is updated for view trace (#3966) * fix: timestamp for start and end is updated for view trace * chore: timestamp is added * fix: loading over flow is fixed (#3969) --------- Co-authored-by: Rajat Dabade <rajat@signoz.io> Co-authored-by: Yunus M <myounis.ar@live.com>
2023-11-15 15:33:45 +05:30
const graphRef = useRef<HTMLDivElement>(null);
feat: uplot graph is added and some re-rendering is reduced (#3771) * feat: uplot graph is added and some re-rendering is reduced * chore: uplot is updated * feat: changes for the graph is updated * refactor: added y-axis unit in uplot graph (#3818) * refactor: added y-axis unit in uplot graph * refactor: removed the ticks stroke from both access * feat: create tooltip plugin for uplot charts (#3823) * feat: create tooltip plugin for uplot charts * feat: show labels in legends section --------- Co-authored-by: Yunus M <myounis.ar@live.com> * feat: uplot points is handled (#3817) * chore: resize is updated * chore: uplot chart dark mode is updated * chore: widget is updated * chore: options is updated * chore: value panel is updated * feat: uplot chart is updated * feat: onDrag is updated * feat: data for graph is updated * feat: alert section is fixed * feat: not found is updated * feat: fix dashboard title section and other uplot parity issues (#3839) * feat: fix dashboard title section and other uplot parity issues * feat: update scrollbar style for legend container * chore: initial width is updated * feat: onlcick is updated * feat: widget full view fixes (#3847) Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: show labels in tooltip overlay (#3867) * chore: memo is added * feat: toggle is updated * fix: Tooltip values is now fixed (#3894) * chore: tooltip is updated * chore: avoided the compute based on show * chore: tooltip data is updated * feat: resize graph based on the y axis max label length (#3895) * chore: build is in progress to fix * [Feat]: Full View (#3896) * fix: initial setup for full view done * refactor: done with the graph manager logic * refactor: done with the toggle issue in full view * refactor: done with toggle of data * refactor: done with legend to table mapping * refactor: ts error * chore: utils is updated * refactor: updated types * fix: option type fix --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: use spline renderer to plot curved line graphs, full view impor… (#3919) * feat: use spline renderer to plot curved line graphs, full view imporvements * feat: increase min height for panel * chore: move code to utils and plugins in uplot folder * chore: update tooltip styles * fix: add panel issue in dashboard (#3920) * fix: update on click plugin opts import path * feat: replace time series graph in logs explorer and trace explorer with uplot (#3925) * feat: alert threshold is added (#3931) * feat: uplot styles are fixed (#3941) * Fix/app dex aligment (#3944) * feat: uplot styles are fixed * fix: app dex aligment * fix: full view after saving is fixed * feat: css is updated (#3948) * feat: on click handler position - factor in the padding on top and left * fix: timestamp for start and end is updated for view trace (#3966) * fix: timestamp for start and end is updated for view trace * chore: timestamp is added * fix: loading over flow is fixed (#3969) --------- Co-authored-by: Rajat Dabade <rajat@signoz.io> Co-authored-by: Yunus M <myounis.ar@live.com>
2023-11-15 15:33:45 +05:30
const isVisible = useIntersectionObserver(graphRef, undefined, true);
useEffect(() => {
if (toScrollWidgetId === widget.id) {
graphRef.current?.scrollIntoView({
behavior: 'smooth',
block: 'center',
});
graphRef.current?.focus();
setToScrollWidgetId('');
}
}, [toScrollWidgetId, setToScrollWidgetId, widget.id]);
const updatedQuery = useStepInterval(widget?.query);
const isEmptyWidget =
widget?.id === PANEL_TYPES.EMPTY_WIDGET || isEmpty(widget);
const queryResponse = useGetQueryRange(
{
selectedTime: widget?.timePreferance,
graphType: widget?.panelTypes,
query: updatedQuery,
globalSelectedInterval,
feat: uplot graph is added and some re-rendering is reduced (#3771) * feat: uplot graph is added and some re-rendering is reduced * chore: uplot is updated * feat: changes for the graph is updated * refactor: added y-axis unit in uplot graph (#3818) * refactor: added y-axis unit in uplot graph * refactor: removed the ticks stroke from both access * feat: create tooltip plugin for uplot charts (#3823) * feat: create tooltip plugin for uplot charts * feat: show labels in legends section --------- Co-authored-by: Yunus M <myounis.ar@live.com> * feat: uplot points is handled (#3817) * chore: resize is updated * chore: uplot chart dark mode is updated * chore: widget is updated * chore: options is updated * chore: value panel is updated * feat: uplot chart is updated * feat: onDrag is updated * feat: data for graph is updated * feat: alert section is fixed * feat: not found is updated * feat: fix dashboard title section and other uplot parity issues (#3839) * feat: fix dashboard title section and other uplot parity issues * feat: update scrollbar style for legend container * chore: initial width is updated * feat: onlcick is updated * feat: widget full view fixes (#3847) Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: show labels in tooltip overlay (#3867) * chore: memo is added * feat: toggle is updated * fix: Tooltip values is now fixed (#3894) * chore: tooltip is updated * chore: avoided the compute based on show * chore: tooltip data is updated * feat: resize graph based on the y axis max label length (#3895) * chore: build is in progress to fix * [Feat]: Full View (#3896) * fix: initial setup for full view done * refactor: done with the graph manager logic * refactor: done with the toggle issue in full view * refactor: done with toggle of data * refactor: done with legend to table mapping * refactor: ts error * chore: utils is updated * refactor: updated types * fix: option type fix --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: use spline renderer to plot curved line graphs, full view impor… (#3919) * feat: use spline renderer to plot curved line graphs, full view imporvements * feat: increase min height for panel * chore: move code to utils and plugins in uplot folder * chore: update tooltip styles * fix: add panel issue in dashboard (#3920) * fix: update on click plugin opts import path * feat: replace time series graph in logs explorer and trace explorer with uplot (#3925) * feat: alert threshold is added (#3931) * feat: uplot styles are fixed (#3941) * Fix/app dex aligment (#3944) * feat: uplot styles are fixed * fix: app dex aligment * fix: full view after saving is fixed * feat: css is updated (#3948) * feat: on click handler position - factor in the padding on top and left * fix: timestamp for start and end is updated for view trace (#3966) * fix: timestamp for start and end is updated for view trace * chore: timestamp is added * fix: loading over flow is fixed (#3969) --------- Co-authored-by: Rajat Dabade <rajat@signoz.io> Co-authored-by: Yunus M <myounis.ar@live.com>
2023-11-15 15:33:45 +05:30
variables: getDashboardVariables(variables),
},
{
queryKey: [
maxTime,
minTime,
globalSelectedInterval,
feat: uplot graph is added and some re-rendering is reduced (#3771) * feat: uplot graph is added and some re-rendering is reduced * chore: uplot is updated * feat: changes for the graph is updated * refactor: added y-axis unit in uplot graph (#3818) * refactor: added y-axis unit in uplot graph * refactor: removed the ticks stroke from both access * feat: create tooltip plugin for uplot charts (#3823) * feat: create tooltip plugin for uplot charts * feat: show labels in legends section --------- Co-authored-by: Yunus M <myounis.ar@live.com> * feat: uplot points is handled (#3817) * chore: resize is updated * chore: uplot chart dark mode is updated * chore: widget is updated * chore: options is updated * chore: value panel is updated * feat: uplot chart is updated * feat: onDrag is updated * feat: data for graph is updated * feat: alert section is fixed * feat: not found is updated * feat: fix dashboard title section and other uplot parity issues (#3839) * feat: fix dashboard title section and other uplot parity issues * feat: update scrollbar style for legend container * chore: initial width is updated * feat: onlcick is updated * feat: widget full view fixes (#3847) Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: show labels in tooltip overlay (#3867) * chore: memo is added * feat: toggle is updated * fix: Tooltip values is now fixed (#3894) * chore: tooltip is updated * chore: avoided the compute based on show * chore: tooltip data is updated * feat: resize graph based on the y axis max label length (#3895) * chore: build is in progress to fix * [Feat]: Full View (#3896) * fix: initial setup for full view done * refactor: done with the graph manager logic * refactor: done with the toggle issue in full view * refactor: done with toggle of data * refactor: done with legend to table mapping * refactor: ts error * chore: utils is updated * refactor: updated types * fix: option type fix --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: use spline renderer to plot curved line graphs, full view impor… (#3919) * feat: use spline renderer to plot curved line graphs, full view imporvements * feat: increase min height for panel * chore: move code to utils and plugins in uplot folder * chore: update tooltip styles * fix: add panel issue in dashboard (#3920) * fix: update on click plugin opts import path * feat: replace time series graph in logs explorer and trace explorer with uplot (#3925) * feat: alert threshold is added (#3931) * feat: uplot styles are fixed (#3941) * Fix/app dex aligment (#3944) * feat: uplot styles are fixed * fix: app dex aligment * fix: full view after saving is fixed * feat: css is updated (#3948) * feat: on click handler position - factor in the padding on top and left * fix: timestamp for start and end is updated for view trace (#3966) * fix: timestamp for start and end is updated for view trace * chore: timestamp is added * fix: loading over flow is fixed (#3969) --------- Co-authored-by: Rajat Dabade <rajat@signoz.io> Co-authored-by: Yunus M <myounis.ar@live.com>
2023-11-15 15:33:45 +05:30
variables,
2023-10-12 17:27:51 +05:30
widget?.query,
widget?.panelTypes,
widget.timePreferance,
],
keepPreviousData: true,
feat: uplot graph is added and some re-rendering is reduced (#3771) * feat: uplot graph is added and some re-rendering is reduced * chore: uplot is updated * feat: changes for the graph is updated * refactor: added y-axis unit in uplot graph (#3818) * refactor: added y-axis unit in uplot graph * refactor: removed the ticks stroke from both access * feat: create tooltip plugin for uplot charts (#3823) * feat: create tooltip plugin for uplot charts * feat: show labels in legends section --------- Co-authored-by: Yunus M <myounis.ar@live.com> * feat: uplot points is handled (#3817) * chore: resize is updated * chore: uplot chart dark mode is updated * chore: widget is updated * chore: options is updated * chore: value panel is updated * feat: uplot chart is updated * feat: onDrag is updated * feat: data for graph is updated * feat: alert section is fixed * feat: not found is updated * feat: fix dashboard title section and other uplot parity issues (#3839) * feat: fix dashboard title section and other uplot parity issues * feat: update scrollbar style for legend container * chore: initial width is updated * feat: onlcick is updated * feat: widget full view fixes (#3847) Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: show labels in tooltip overlay (#3867) * chore: memo is added * feat: toggle is updated * fix: Tooltip values is now fixed (#3894) * chore: tooltip is updated * chore: avoided the compute based on show * chore: tooltip data is updated * feat: resize graph based on the y axis max label length (#3895) * chore: build is in progress to fix * [Feat]: Full View (#3896) * fix: initial setup for full view done * refactor: done with the graph manager logic * refactor: done with the toggle issue in full view * refactor: done with toggle of data * refactor: done with legend to table mapping * refactor: ts error * chore: utils is updated * refactor: updated types * fix: option type fix --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: use spline renderer to plot curved line graphs, full view impor… (#3919) * feat: use spline renderer to plot curved line graphs, full view imporvements * feat: increase min height for panel * chore: move code to utils and plugins in uplot folder * chore: update tooltip styles * fix: add panel issue in dashboard (#3920) * fix: update on click plugin opts import path * feat: replace time series graph in logs explorer and trace explorer with uplot (#3925) * feat: alert threshold is added (#3931) * feat: uplot styles are fixed (#3941) * Fix/app dex aligment (#3944) * feat: uplot styles are fixed * fix: app dex aligment * fix: full view after saving is fixed * feat: css is updated (#3948) * feat: on click handler position - factor in the padding on top and left * fix: timestamp for start and end is updated for view trace (#3966) * fix: timestamp for start and end is updated for view trace * chore: timestamp is added * fix: loading over flow is fixed (#3969) --------- Co-authored-by: Rajat Dabade <rajat@signoz.io> Co-authored-by: Yunus M <myounis.ar@live.com>
2023-11-15 15:33:45 +05:30
enabled: isVisible && !isEmptyWidget && isQueryEnabled,
refetchOnMount: false,
onError: (error) => {
setErrorMessage(error.message);
},
},
);
const isEmptyLayout = widget?.id === PANEL_TYPES.EMPTY_WIDGET;
feat: uplot graph is added and some re-rendering is reduced (#3771) * feat: uplot graph is added and some re-rendering is reduced * chore: uplot is updated * feat: changes for the graph is updated * refactor: added y-axis unit in uplot graph (#3818) * refactor: added y-axis unit in uplot graph * refactor: removed the ticks stroke from both access * feat: create tooltip plugin for uplot charts (#3823) * feat: create tooltip plugin for uplot charts * feat: show labels in legends section --------- Co-authored-by: Yunus M <myounis.ar@live.com> * feat: uplot points is handled (#3817) * chore: resize is updated * chore: uplot chart dark mode is updated * chore: widget is updated * chore: options is updated * chore: value panel is updated * feat: uplot chart is updated * feat: onDrag is updated * feat: data for graph is updated * feat: alert section is fixed * feat: not found is updated * feat: fix dashboard title section and other uplot parity issues (#3839) * feat: fix dashboard title section and other uplot parity issues * feat: update scrollbar style for legend container * chore: initial width is updated * feat: onlcick is updated * feat: widget full view fixes (#3847) Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: show labels in tooltip overlay (#3867) * chore: memo is added * feat: toggle is updated * fix: Tooltip values is now fixed (#3894) * chore: tooltip is updated * chore: avoided the compute based on show * chore: tooltip data is updated * feat: resize graph based on the y axis max label length (#3895) * chore: build is in progress to fix * [Feat]: Full View (#3896) * fix: initial setup for full view done * refactor: done with the graph manager logic * refactor: done with the toggle issue in full view * refactor: done with toggle of data * refactor: done with legend to table mapping * refactor: ts error * chore: utils is updated * refactor: updated types * fix: option type fix --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: use spline renderer to plot curved line graphs, full view impor… (#3919) * feat: use spline renderer to plot curved line graphs, full view imporvements * feat: increase min height for panel * chore: move code to utils and plugins in uplot folder * chore: update tooltip styles * fix: add panel issue in dashboard (#3920) * fix: update on click plugin opts import path * feat: replace time series graph in logs explorer and trace explorer with uplot (#3925) * feat: alert threshold is added (#3931) * feat: uplot styles are fixed (#3941) * Fix/app dex aligment (#3944) * feat: uplot styles are fixed * fix: app dex aligment * fix: full view after saving is fixed * feat: css is updated (#3948) * feat: on click handler position - factor in the padding on top and left * fix: timestamp for start and end is updated for view trace (#3966) * fix: timestamp for start and end is updated for view trace * chore: timestamp is added * fix: loading over flow is fixed (#3969) --------- Co-authored-by: Rajat Dabade <rajat@signoz.io> Co-authored-by: Yunus M <myounis.ar@live.com>
2023-11-15 15:33:45 +05:30
const containerDimensions = useResizeObserver(graphRef);
useEffect((): void => {
const { startTime, endTime } = getTimeRange(queryResponse);
setMinTimeScale(startTime);
setMaxTimeScale(endTime);
}, [maxTime, minTime, globalSelectedInterval, queryResponse]);
const chartData = getUPlotChartData(queryResponse?.data?.payload, fillSpans);
feat: uplot graph is added and some re-rendering is reduced (#3771) * feat: uplot graph is added and some re-rendering is reduced * chore: uplot is updated * feat: changes for the graph is updated * refactor: added y-axis unit in uplot graph (#3818) * refactor: added y-axis unit in uplot graph * refactor: removed the ticks stroke from both access * feat: create tooltip plugin for uplot charts (#3823) * feat: create tooltip plugin for uplot charts * feat: show labels in legends section --------- Co-authored-by: Yunus M <myounis.ar@live.com> * feat: uplot points is handled (#3817) * chore: resize is updated * chore: uplot chart dark mode is updated * chore: widget is updated * chore: options is updated * chore: value panel is updated * feat: uplot chart is updated * feat: onDrag is updated * feat: data for graph is updated * feat: alert section is fixed * feat: not found is updated * feat: fix dashboard title section and other uplot parity issues (#3839) * feat: fix dashboard title section and other uplot parity issues * feat: update scrollbar style for legend container * chore: initial width is updated * feat: onlcick is updated * feat: widget full view fixes (#3847) Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: show labels in tooltip overlay (#3867) * chore: memo is added * feat: toggle is updated * fix: Tooltip values is now fixed (#3894) * chore: tooltip is updated * chore: avoided the compute based on show * chore: tooltip data is updated * feat: resize graph based on the y axis max label length (#3895) * chore: build is in progress to fix * [Feat]: Full View (#3896) * fix: initial setup for full view done * refactor: done with the graph manager logic * refactor: done with the toggle issue in full view * refactor: done with toggle of data * refactor: done with legend to table mapping * refactor: ts error * chore: utils is updated * refactor: updated types * fix: option type fix --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: use spline renderer to plot curved line graphs, full view impor… (#3919) * feat: use spline renderer to plot curved line graphs, full view imporvements * feat: increase min height for panel * chore: move code to utils and plugins in uplot folder * chore: update tooltip styles * fix: add panel issue in dashboard (#3920) * fix: update on click plugin opts import path * feat: replace time series graph in logs explorer and trace explorer with uplot (#3925) * feat: alert threshold is added (#3931) * feat: uplot styles are fixed (#3941) * Fix/app dex aligment (#3944) * feat: uplot styles are fixed * fix: app dex aligment * fix: full view after saving is fixed * feat: css is updated (#3948) * feat: on click handler position - factor in the padding on top and left * fix: timestamp for start and end is updated for view trace (#3966) * fix: timestamp for start and end is updated for view trace * chore: timestamp is added * fix: loading over flow is fixed (#3969) --------- Co-authored-by: Rajat Dabade <rajat@signoz.io> Co-authored-by: Yunus M <myounis.ar@live.com>
2023-11-15 15:33:45 +05:30
const isDarkMode = useIsDarkMode();
const menuList =
widget.panelTypes === PANEL_TYPES.TABLE
? headerMenuList.filter((menu) => menu !== MenuItemKeys.CreateAlerts)
: headerMenuList;
feat: uplot graph is added and some re-rendering is reduced (#3771) * feat: uplot graph is added and some re-rendering is reduced * chore: uplot is updated * feat: changes for the graph is updated * refactor: added y-axis unit in uplot graph (#3818) * refactor: added y-axis unit in uplot graph * refactor: removed the ticks stroke from both access * feat: create tooltip plugin for uplot charts (#3823) * feat: create tooltip plugin for uplot charts * feat: show labels in legends section --------- Co-authored-by: Yunus M <myounis.ar@live.com> * feat: uplot points is handled (#3817) * chore: resize is updated * chore: uplot chart dark mode is updated * chore: widget is updated * chore: options is updated * chore: value panel is updated * feat: uplot chart is updated * feat: onDrag is updated * feat: data for graph is updated * feat: alert section is fixed * feat: not found is updated * feat: fix dashboard title section and other uplot parity issues (#3839) * feat: fix dashboard title section and other uplot parity issues * feat: update scrollbar style for legend container * chore: initial width is updated * feat: onlcick is updated * feat: widget full view fixes (#3847) Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: show labels in tooltip overlay (#3867) * chore: memo is added * feat: toggle is updated * fix: Tooltip values is now fixed (#3894) * chore: tooltip is updated * chore: avoided the compute based on show * chore: tooltip data is updated * feat: resize graph based on the y axis max label length (#3895) * chore: build is in progress to fix * [Feat]: Full View (#3896) * fix: initial setup for full view done * refactor: done with the graph manager logic * refactor: done with the toggle issue in full view * refactor: done with toggle of data * refactor: done with legend to table mapping * refactor: ts error * chore: utils is updated * refactor: updated types * fix: option type fix --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: use spline renderer to plot curved line graphs, full view impor… (#3919) * feat: use spline renderer to plot curved line graphs, full view imporvements * feat: increase min height for panel * chore: move code to utils and plugins in uplot folder * chore: update tooltip styles * fix: add panel issue in dashboard (#3920) * fix: update on click plugin opts import path * feat: replace time series graph in logs explorer and trace explorer with uplot (#3925) * feat: alert threshold is added (#3931) * feat: uplot styles are fixed (#3941) * Fix/app dex aligment (#3944) * feat: uplot styles are fixed * fix: app dex aligment * fix: full view after saving is fixed * feat: css is updated (#3948) * feat: on click handler position - factor in the padding on top and left * fix: timestamp for start and end is updated for view trace (#3966) * fix: timestamp for start and end is updated for view trace * chore: timestamp is added * fix: loading over flow is fixed (#3969) --------- Co-authored-by: Rajat Dabade <rajat@signoz.io> Co-authored-by: Yunus M <myounis.ar@live.com>
2023-11-15 15:33:45 +05:30
const options = useMemo(
() =>
getUPlotChartOptions({
id: widget?.id,
apiResponse: queryResponse.data?.payload,
dimensions: containerDimensions,
isDarkMode,
onDragSelect,
yAxisUnit: widget?.yAxisUnit,
onClickHandler,
thresholds: widget.thresholds,
minTimeScale,
maxTimeScale,
softMax: widget.softMax === undefined ? null : widget.softMax,
softMin: widget.softMin === undefined ? null : widget.softMin,
feat: uplot graph is added and some re-rendering is reduced (#3771) * feat: uplot graph is added and some re-rendering is reduced * chore: uplot is updated * feat: changes for the graph is updated * refactor: added y-axis unit in uplot graph (#3818) * refactor: added y-axis unit in uplot graph * refactor: removed the ticks stroke from both access * feat: create tooltip plugin for uplot charts (#3823) * feat: create tooltip plugin for uplot charts * feat: show labels in legends section --------- Co-authored-by: Yunus M <myounis.ar@live.com> * feat: uplot points is handled (#3817) * chore: resize is updated * chore: uplot chart dark mode is updated * chore: widget is updated * chore: options is updated * chore: value panel is updated * feat: uplot chart is updated * feat: onDrag is updated * feat: data for graph is updated * feat: alert section is fixed * feat: not found is updated * feat: fix dashboard title section and other uplot parity issues (#3839) * feat: fix dashboard title section and other uplot parity issues * feat: update scrollbar style for legend container * chore: initial width is updated * feat: onlcick is updated * feat: widget full view fixes (#3847) Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: show labels in tooltip overlay (#3867) * chore: memo is added * feat: toggle is updated * fix: Tooltip values is now fixed (#3894) * chore: tooltip is updated * chore: avoided the compute based on show * chore: tooltip data is updated * feat: resize graph based on the y axis max label length (#3895) * chore: build is in progress to fix * [Feat]: Full View (#3896) * fix: initial setup for full view done * refactor: done with the graph manager logic * refactor: done with the toggle issue in full view * refactor: done with toggle of data * refactor: done with legend to table mapping * refactor: ts error * chore: utils is updated * refactor: updated types * fix: option type fix --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: use spline renderer to plot curved line graphs, full view impor… (#3919) * feat: use spline renderer to plot curved line graphs, full view imporvements * feat: increase min height for panel * chore: move code to utils and plugins in uplot folder * chore: update tooltip styles * fix: add panel issue in dashboard (#3920) * fix: update on click plugin opts import path * feat: replace time series graph in logs explorer and trace explorer with uplot (#3925) * feat: alert threshold is added (#3931) * feat: uplot styles are fixed (#3941) * Fix/app dex aligment (#3944) * feat: uplot styles are fixed * fix: app dex aligment * fix: full view after saving is fixed * feat: css is updated (#3948) * feat: on click handler position - factor in the padding on top and left * fix: timestamp for start and end is updated for view trace (#3966) * fix: timestamp for start and end is updated for view trace * chore: timestamp is added * fix: loading over flow is fixed (#3969) --------- Co-authored-by: Rajat Dabade <rajat@signoz.io> Co-authored-by: Yunus M <myounis.ar@live.com>
2023-11-15 15:33:45 +05:30
}),
[
widget?.id,
widget?.yAxisUnit,
widget.thresholds,
widget.softMax,
widget.softMin,
feat: uplot graph is added and some re-rendering is reduced (#3771) * feat: uplot graph is added and some re-rendering is reduced * chore: uplot is updated * feat: changes for the graph is updated * refactor: added y-axis unit in uplot graph (#3818) * refactor: added y-axis unit in uplot graph * refactor: removed the ticks stroke from both access * feat: create tooltip plugin for uplot charts (#3823) * feat: create tooltip plugin for uplot charts * feat: show labels in legends section --------- Co-authored-by: Yunus M <myounis.ar@live.com> * feat: uplot points is handled (#3817) * chore: resize is updated * chore: uplot chart dark mode is updated * chore: widget is updated * chore: options is updated * chore: value panel is updated * feat: uplot chart is updated * feat: onDrag is updated * feat: data for graph is updated * feat: alert section is fixed * feat: not found is updated * feat: fix dashboard title section and other uplot parity issues (#3839) * feat: fix dashboard title section and other uplot parity issues * feat: update scrollbar style for legend container * chore: initial width is updated * feat: onlcick is updated * feat: widget full view fixes (#3847) Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: show labels in tooltip overlay (#3867) * chore: memo is added * feat: toggle is updated * fix: Tooltip values is now fixed (#3894) * chore: tooltip is updated * chore: avoided the compute based on show * chore: tooltip data is updated * feat: resize graph based on the y axis max label length (#3895) * chore: build is in progress to fix * [Feat]: Full View (#3896) * fix: initial setup for full view done * refactor: done with the graph manager logic * refactor: done with the toggle issue in full view * refactor: done with toggle of data * refactor: done with legend to table mapping * refactor: ts error * chore: utils is updated * refactor: updated types * fix: option type fix --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: use spline renderer to plot curved line graphs, full view impor… (#3919) * feat: use spline renderer to plot curved line graphs, full view imporvements * feat: increase min height for panel * chore: move code to utils and plugins in uplot folder * chore: update tooltip styles * fix: add panel issue in dashboard (#3920) * fix: update on click plugin opts import path * feat: replace time series graph in logs explorer and trace explorer with uplot (#3925) * feat: alert threshold is added (#3931) * feat: uplot styles are fixed (#3941) * Fix/app dex aligment (#3944) * feat: uplot styles are fixed * fix: app dex aligment * fix: full view after saving is fixed * feat: css is updated (#3948) * feat: on click handler position - factor in the padding on top and left * fix: timestamp for start and end is updated for view trace (#3966) * fix: timestamp for start and end is updated for view trace * chore: timestamp is added * fix: loading over flow is fixed (#3969) --------- Co-authored-by: Rajat Dabade <rajat@signoz.io> Co-authored-by: Yunus M <myounis.ar@live.com>
2023-11-15 15:33:45 +05:30
queryResponse.data?.payload,
containerDimensions,
isDarkMode,
onDragSelect,
onClickHandler,
minTimeScale,
maxTimeScale,
feat: uplot graph is added and some re-rendering is reduced (#3771) * feat: uplot graph is added and some re-rendering is reduced * chore: uplot is updated * feat: changes for the graph is updated * refactor: added y-axis unit in uplot graph (#3818) * refactor: added y-axis unit in uplot graph * refactor: removed the ticks stroke from both access * feat: create tooltip plugin for uplot charts (#3823) * feat: create tooltip plugin for uplot charts * feat: show labels in legends section --------- Co-authored-by: Yunus M <myounis.ar@live.com> * feat: uplot points is handled (#3817) * chore: resize is updated * chore: uplot chart dark mode is updated * chore: widget is updated * chore: options is updated * chore: value panel is updated * feat: uplot chart is updated * feat: onDrag is updated * feat: data for graph is updated * feat: alert section is fixed * feat: not found is updated * feat: fix dashboard title section and other uplot parity issues (#3839) * feat: fix dashboard title section and other uplot parity issues * feat: update scrollbar style for legend container * chore: initial width is updated * feat: onlcick is updated * feat: widget full view fixes (#3847) Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: show labels in tooltip overlay (#3867) * chore: memo is added * feat: toggle is updated * fix: Tooltip values is now fixed (#3894) * chore: tooltip is updated * chore: avoided the compute based on show * chore: tooltip data is updated * feat: resize graph based on the y axis max label length (#3895) * chore: build is in progress to fix * [Feat]: Full View (#3896) * fix: initial setup for full view done * refactor: done with the graph manager logic * refactor: done with the toggle issue in full view * refactor: done with toggle of data * refactor: done with legend to table mapping * refactor: ts error * chore: utils is updated * refactor: updated types * fix: option type fix --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: use spline renderer to plot curved line graphs, full view impor… (#3919) * feat: use spline renderer to plot curved line graphs, full view imporvements * feat: increase min height for panel * chore: move code to utils and plugins in uplot folder * chore: update tooltip styles * fix: add panel issue in dashboard (#3920) * fix: update on click plugin opts import path * feat: replace time series graph in logs explorer and trace explorer with uplot (#3925) * feat: alert threshold is added (#3931) * feat: uplot styles are fixed (#3941) * Fix/app dex aligment (#3944) * feat: uplot styles are fixed * fix: app dex aligment * fix: full view after saving is fixed * feat: css is updated (#3948) * feat: on click handler position - factor in the padding on top and left * fix: timestamp for start and end is updated for view trace (#3966) * fix: timestamp for start and end is updated for view trace * chore: timestamp is added * fix: loading over flow is fixed (#3969) --------- Co-authored-by: Rajat Dabade <rajat@signoz.io> Co-authored-by: Yunus M <myounis.ar@live.com>
2023-11-15 15:33:45 +05:30
],
);
return (
feat: uplot graph is added and some re-rendering is reduced (#3771) * feat: uplot graph is added and some re-rendering is reduced * chore: uplot is updated * feat: changes for the graph is updated * refactor: added y-axis unit in uplot graph (#3818) * refactor: added y-axis unit in uplot graph * refactor: removed the ticks stroke from both access * feat: create tooltip plugin for uplot charts (#3823) * feat: create tooltip plugin for uplot charts * feat: show labels in legends section --------- Co-authored-by: Yunus M <myounis.ar@live.com> * feat: uplot points is handled (#3817) * chore: resize is updated * chore: uplot chart dark mode is updated * chore: widget is updated * chore: options is updated * chore: value panel is updated * feat: uplot chart is updated * feat: onDrag is updated * feat: data for graph is updated * feat: alert section is fixed * feat: not found is updated * feat: fix dashboard title section and other uplot parity issues (#3839) * feat: fix dashboard title section and other uplot parity issues * feat: update scrollbar style for legend container * chore: initial width is updated * feat: onlcick is updated * feat: widget full view fixes (#3847) Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: show labels in tooltip overlay (#3867) * chore: memo is added * feat: toggle is updated * fix: Tooltip values is now fixed (#3894) * chore: tooltip is updated * chore: avoided the compute based on show * chore: tooltip data is updated * feat: resize graph based on the y axis max label length (#3895) * chore: build is in progress to fix * [Feat]: Full View (#3896) * fix: initial setup for full view done * refactor: done with the graph manager logic * refactor: done with the toggle issue in full view * refactor: done with toggle of data * refactor: done with legend to table mapping * refactor: ts error * chore: utils is updated * refactor: updated types * fix: option type fix --------- Co-authored-by: Palash Gupta <palashgdev@gmail.com> * feat: use spline renderer to plot curved line graphs, full view impor… (#3919) * feat: use spline renderer to plot curved line graphs, full view imporvements * feat: increase min height for panel * chore: move code to utils and plugins in uplot folder * chore: update tooltip styles * fix: add panel issue in dashboard (#3920) * fix: update on click plugin opts import path * feat: replace time series graph in logs explorer and trace explorer with uplot (#3925) * feat: alert threshold is added (#3931) * feat: uplot styles are fixed (#3941) * Fix/app dex aligment (#3944) * feat: uplot styles are fixed * fix: app dex aligment * fix: full view after saving is fixed * feat: css is updated (#3948) * feat: on click handler position - factor in the padding on top and left * fix: timestamp for start and end is updated for view trace (#3966) * fix: timestamp for start and end is updated for view trace * chore: timestamp is added * fix: loading over flow is fixed (#3969) --------- Co-authored-by: Rajat Dabade <rajat@signoz.io> Co-authored-by: Yunus M <myounis.ar@live.com>
2023-11-15 15:33:45 +05:30
<div style={{ height: '100%', width: '100%' }} ref={graphRef}>
{isEmptyLayout ? (
<EmptyWidget />
) : (
<WidgetGraphComponent
data={chartData}
options={options}
widget={widget}
queryResponse={queryResponse}
errorMessage={errorMessage}
isWarning={false}
name={name}
onDragSelect={onDragSelect}
threshold={threshold}
headerMenuList={menuList}
onClickHandler={onClickHandler}
/>
)}
</div>
);
}
GridCardGraph.defaultProps = {
onDragSelect: undefined,
onClickHandler: undefined,
isQueryEnabled: true,
threshold: undefined,
headerMenuList: [MenuItemKeys.View],
};
export default memo(GridCardGraph);