mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-13 10:59:02 +08:00
feat: add support to configure units for pie chart values (#5960)
* feat: add units for pie chart * chore: set the default to none in case no unit present * chore: rename the y axis unit to unit --------- Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
This commit is contained in:
parent
b444c1e6b1
commit
3573c0863c
@ -74,7 +74,7 @@ export const panelTypeVsYAxisUnit: { [key in PANEL_TYPES]: boolean } = {
|
|||||||
[PANEL_TYPES.VALUE]: true,
|
[PANEL_TYPES.VALUE]: true,
|
||||||
[PANEL_TYPES.TABLE]: false,
|
[PANEL_TYPES.TABLE]: false,
|
||||||
[PANEL_TYPES.LIST]: false,
|
[PANEL_TYPES.LIST]: false,
|
||||||
[PANEL_TYPES.PIE]: false,
|
[PANEL_TYPES.PIE]: true,
|
||||||
[PANEL_TYPES.BAR]: true,
|
[PANEL_TYPES.BAR]: true,
|
||||||
[PANEL_TYPES.HISTOGRAM]: false,
|
[PANEL_TYPES.HISTOGRAM]: false,
|
||||||
[PANEL_TYPES.TRACE]: false,
|
[PANEL_TYPES.TRACE]: false,
|
||||||
|
@ -211,7 +211,11 @@ function RightContainer({
|
|||||||
<YAxisUnitSelector
|
<YAxisUnitSelector
|
||||||
defaultValue={yAxisUnit}
|
defaultValue={yAxisUnit}
|
||||||
onSelect={setYAxisUnit}
|
onSelect={setYAxisUnit}
|
||||||
fieldLabel={selectedGraphType === 'Value' ? 'Unit' : 'Y Axis Unit'}
|
fieldLabel={
|
||||||
|
selectedGraphType === 'Value' || selectedGraphType === 'Pie'
|
||||||
|
? 'Unit'
|
||||||
|
: 'Y Axis Unit'
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{allowSoftMinMax && (
|
{allowSoftMinMax && (
|
||||||
|
@ -4,6 +4,7 @@ import { Color } from '@signozhq/design-tokens';
|
|||||||
import { Group } from '@visx/group';
|
import { Group } from '@visx/group';
|
||||||
import { Pie } from '@visx/shape';
|
import { Pie } from '@visx/shape';
|
||||||
import { useTooltip, useTooltipInPortal } from '@visx/tooltip';
|
import { useTooltip, useTooltipInPortal } from '@visx/tooltip';
|
||||||
|
import { getYAxisFormattedValue } from 'components/Graph/yAxisConfig';
|
||||||
import { themeColors } from 'constants/theme';
|
import { themeColors } from 'constants/theme';
|
||||||
import { useIsDarkMode } from 'hooks/useDarkMode';
|
import { useIsDarkMode } from 'hooks/useDarkMode';
|
||||||
import { generateColor } from 'lib/uPlotLib/utils/generateColor';
|
import { generateColor } from 'lib/uPlotLib/utils/generateColor';
|
||||||
@ -129,7 +130,12 @@ function PiePanelWrapper({
|
|||||||
showTooltip({
|
showTooltip({
|
||||||
tooltipData: {
|
tooltipData: {
|
||||||
label,
|
label,
|
||||||
value: arc.data.value,
|
// do not update the unit in the data as the arc allotment is based on value
|
||||||
|
// and treats 4K smaller than 40
|
||||||
|
value: getYAxisFormattedValue(
|
||||||
|
arc.data.value,
|
||||||
|
widget?.yAxisUnit || 'none',
|
||||||
|
),
|
||||||
color: arc.data.color,
|
color: arc.data.color,
|
||||||
key: label,
|
key: label,
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user