From 8a883f1b5e85f7c620b66f8a8f106ea4a6b9dd7a Mon Sep 17 00:00:00 2001 From: Pranshu Chittora Date: Wed, 23 Mar 2022 22:03:57 +0530 Subject: [PATCH] feat: unit selection for value graph on dashboard (#898) --- frontend/src/container/GridGraphComponent/index.tsx | 7 ++++++- .../NewWidget/RightContainer/YAxisUnitSelector.tsx | 4 ++-- frontend/src/container/NewWidget/RightContainer/index.tsx | 6 +++++- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/frontend/src/container/GridGraphComponent/index.tsx b/frontend/src/container/GridGraphComponent/index.tsx index 7c1572fae1..3ca7f4f544 100644 --- a/frontend/src/container/GridGraphComponent/index.tsx +++ b/frontend/src/container/GridGraphComponent/index.tsx @@ -1,6 +1,7 @@ import { Typography } from 'antd'; import { ChartData } from 'chart.js'; import Graph, { graphOnClickHandler } from 'components/Graph'; +import { getYAxisFormattedValue } from 'components/Graph/yAxisConfig'; import ValueGraph from 'components/ValueGraph'; import { GRAPH_TYPES } from 'container/NewDashboard/ComponentsSlider'; import history from 'lib/history'; @@ -57,7 +58,11 @@ function GridGraphComponent({ {title} - + ); diff --git a/frontend/src/container/NewWidget/RightContainer/YAxisUnitSelector.tsx b/frontend/src/container/NewWidget/RightContainer/YAxisUnitSelector.tsx index d8202d6fdb..1af32aff45 100644 --- a/frontend/src/container/NewWidget/RightContainer/YAxisUnitSelector.tsx +++ b/frontend/src/container/NewWidget/RightContainer/YAxisUnitSelector.tsx @@ -9,7 +9,7 @@ const findCategoryById = (searchValue) => const findCategoryByName = (searchValue) => find(flattenedCategories, (option) => option.name == searchValue); -function YAxisUnitSelector({ defaultValue, onSelect }): JSX.Element { +function YAxisUnitSelector({ defaultValue, onSelect, fieldLabel }): JSX.Element { const onSelectHandler = (selectedValue: string): void => { onSelect(findCategoryByName(selectedValue)?.id); }; @@ -19,7 +19,7 @@ function YAxisUnitSelector({ defaultValue, onSelect }): JSX.Element { return (
- Y Axis Unit + {fieldLabel}
- + ); }