-
Notifications
You must be signed in to change notification settings - Fork 361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
upcoming: [DI-21200] - Migration from ChartJS to Recharts in CloudPulse #11204
base: develop
Are you sure you want to change the base?
Changes from 13 commits
7be47af
c1d1808
aa9931a
48fb7bb
8482608
801ae23
3fc7ba9
ef29f34
1fda168
b1b5248
144818a
62a5f98
a979311
75adf4d
f36786d
6026adc
b8113b3
effca04
abc1fe3
de10d79
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/api-v4": Upcoming Features | ||
--- | ||
|
||
Add `DataSet` type in `types.ts` ([#11204](https://github.com/linode/manager/pull/11204)) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@linode/manager": Upcoming Features | ||
--- | ||
|
||
Replace `LineGraph` with `AreaChart` in `CloudPulseLineGraph` component. Add `connectNulls` property in `AreaChart.ts` ([#11204](https://github.com/linode/manager/pull/11204)) |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -28,7 +28,9 @@ import { | |||||
import type { TooltipProps } from 'recharts'; | ||||||
import type { MetricsDisplayRow } from 'src/components/LineGraph/MetricsDisplay'; | ||||||
|
||||||
interface AreaProps { | ||||||
export type ChartVariant = 'line' | 'area'; | ||||||
|
||||||
export interface AreaProps { | ||||||
/** | ||||||
* color for the area | ||||||
*/ | ||||||
|
@@ -53,7 +55,7 @@ interface XAxisProps { | |||||
tickGap: number; | ||||||
} | ||||||
|
||||||
interface AreaChartProps { | ||||||
export interface AreaChartProps { | ||||||
/** | ||||||
* list of areas to be displayed | ||||||
*/ | ||||||
|
@@ -64,6 +66,11 @@ interface AreaChartProps { | |||||
*/ | ||||||
ariaLabel: string; | ||||||
|
||||||
/** | ||||||
* connect nulls value between two data points | ||||||
*/ | ||||||
connectNulls? :boolean; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. updated, it was there in local changes but forgot to push. Thanks |
||||||
|
||||||
/** | ||||||
* data to be displayed on the graph | ||||||
*/ | ||||||
|
@@ -114,7 +121,7 @@ interface AreaChartProps { | |||||
* make chart appear as a line or area chart | ||||||
* @default area | ||||||
*/ | ||||||
variant?: 'area' | 'line'; | ||||||
variant?: ChartVariant; | ||||||
|
||||||
/** | ||||||
* The width of chart container. | ||||||
|
@@ -143,6 +150,7 @@ export const AreaChart = (props: AreaChartProps) => { | |||||
variant, | ||||||
width = '100%', | ||||||
xAxis, | ||||||
connectNulls | ||||||
} = props; | ||||||
|
||||||
const theme = useTheme(); | ||||||
|
@@ -274,6 +282,7 @@ export const AreaChart = (props: AreaChartProps) => { | |||||
)} | ||||||
{areas.map(({ color, dataKey }) => ( | ||||||
<Area | ||||||
connectNulls={connectNulls} | ||||||
dataKey={dataKey} | ||||||
fill={color} | ||||||
fillOpacity={variant === 'line' ? 0 : fillOpacity ?? 1} | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,15 +19,6 @@ const ROW_HEADERS = ['Max', 'Avg', 'Last'] as const; | |
type MetricKey = 'average' | 'last' | 'max'; | ||
const METRIC_KEYS: MetricKey[] = ['max', 'average', 'last']; | ||
|
||
export type LegendColor = | ||
| 'blue' | ||
| 'darkGreen' | ||
| 'green' | ||
| 'lightGreen' | ||
| 'purple' | ||
| 'red' | ||
| 'yellow'; | ||
|
||
interface Props { | ||
/** | ||
* Array of rows to hide. Each row should contain the legend title. | ||
|
@@ -47,7 +38,7 @@ export interface MetricsDisplayRow { | |
data: Metrics; | ||
format: (n: number) => string; | ||
handleLegendClick?: () => void; | ||
legendColor: LegendColor; | ||
legendColor: string; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks worse from a type safety perspective. Is this change necessary? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes it is already been discussed with @jaalah-akamai that instead of restricting to the 7 predefined colors, it should accept any color, so that legend rows greater than 7 won't collide with same color. Also, I don't think color has anything related to typesafety. |
||
legendTitle: string; | ||
} | ||
|
||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interfaces in the API SDK should correspond to responses from a particular endpoint. This definition may be more appropriately located in
CloudPulseWidgetUtils.ts
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated, thanks