Skip to content

Commit

Permalink
change: [M3-7668] - Right align chart tooltip data points (#10078)
Browse files Browse the repository at this point in the history
## Description 📝
Right justify the chart tooltip datapoints so that they are more discernible as suggested by Kendall/Andrew

## How to test 🧪

### Prerequisites
(How to setup test environment)
- Have a Linode that's been running for a while

### Verification steps 
(How to verify changes)
- Hover over a chart (like in the Linode Details Analytics tab) to see the tooltip text. Data points should be right aligned
  • Loading branch information
hana-akamai authored Jan 18, 2024
1 parent ba45d60 commit 162f471
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-10078-changed-1705616003861.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Changed
---

Right align chart tooltip data points ([#10078](https://github.com/linode/manager/pull/10078))
18 changes: 14 additions & 4 deletions packages/manager/src/components/AreaChart/AreaChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ import {
} from 'recharts';

import { AccessibleAreaChart } from 'src/components/AreaChart/AccessibleAreaChart';
import { MetricsDisplayRow } from 'src/components/LineGraph/MetricsDisplay';
import { Box } from 'src/components/Box';
import MetricsDisplay from 'src/components/LineGraph/MetricsDisplay';
import { MetricsDisplayRow } from 'src/components/LineGraph/MetricsDisplay';
import { Paper } from 'src/components/Paper';
import { StyledBottomLegend } from 'src/features/NodeBalancers/NodeBalancerDetail/NodeBalancerSummary/TablesPanel';

Expand Down Expand Up @@ -94,9 +95,18 @@ export const AreaChart = (props: AreaChartProps) => {
<StyledTooltipPaper>
<Typography>{tooltipLabelFormatter(label, timezone)}</Typography>
{payload.map((item) => (
<Typography fontFamily={theme.font.bold} key={item.dataKey}>
{item.dataKey}: {tooltipValueFormatter(item.value, unit)}
</Typography>
<Box
display="flex"
justifyContent="space-between"
key={item.dataKey}
>
<Typography fontFamily={theme.font.bold}>
{item.dataKey}
</Typography>
<Typography fontFamily={theme.font.bold} marginLeft={2}>
{tooltipValueFormatter(item.value, unit)}
</Typography>
</Box>
))}
</StyledTooltipPaper>
);
Expand Down

0 comments on commit 162f471

Please sign in to comment.