-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[charts] Improve properties JSDoc #10931
Conversation
Deploy preview: https://deploy-preview-10931--material-ui-x.netlify.app/ |
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.
Nice improvement! 👏
WDYT about changing the PR title to [charts] Improve properties JSDoc
?
It seems that the PR targets props that are also only dev facing, not only the ones that end up in API docs. 🤔
Complete nitpick: Should this PR maybe target next
as the source of truth and then be cherry-picked to master?
height: number; | ||
viewBox?: ViewBox; | ||
className?: string; | ||
title?: string; | ||
desc?: string; | ||
sx?: SxProps<Theme>; | ||
children?: React.ReactNode; | ||
/** | ||
* If true, the charts will not listen to the mouse move event. |
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.
* If true, the charts will not listen to the mouse move event. | |
* If `true`, the charts will not listen to the mouse move event. |
height: number; | ||
viewBox?: ViewBox; | ||
className?: string; | ||
title?: string; | ||
desc?: string; | ||
sx?: SxProps<Theme>; | ||
children?: React.ReactNode; | ||
/** | ||
* If true, the charts will not listen to the mouse move event. | ||
* It might breaks interactive features, but save some computation power. |
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.
* It might breaks interactive features, but save some computation power. | |
* It might break interactive features but will improve performance. |
@@ -55,6 +55,13 @@ export interface LineChartProps | |||
Omit<ChartsAxisProps, 'slots' | 'slotProps'> { | |||
series: MakeOptional<LineSeriesType, 'type'>[]; | |||
tooltip?: ChartsTooltipProps; | |||
/** | |||
* Object `{ x, y }` that defines how the charts highlight the mouse position along x and y axes. | |||
* The two proerties accept the next values: |
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.
* The two proerties accept the next values: | |
* The two properties accept the following values: |
@@ -55,6 +55,13 @@ export interface LineChartProps | |||
Omit<ChartsAxisProps, 'slots' | 'slotProps'> { | |||
series: MakeOptional<LineSeriesType, 'type'>[]; | |||
tooltip?: ChartsTooltipProps; | |||
/** | |||
* Object `{ x, y }` that defines how the charts highlight the mouse position along x and y axes. |
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.
* Object `{ x, y }` that defines how the charts highlight the mouse position along x and y axes. | |
* Object `{ x, y }` that defines how the charts highlight the mouse position along the x and y axes. |
* The two proerties accept the next values: | ||
* - 'none': display nothing. | ||
* - 'line': display a line at the current mouse position. | ||
* - 'band': display a band at the current mouse position. Only available with band scale. |
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.
* - 'band': display a band at the current mouse position. Only available with band scale. | |
* - 'band': display a band at the current mouse position. Only available with band scale. |
@@ -8,5 +8,11 @@ export interface CardinalDirections<T> { | |||
export type LayoutConfig = { | |||
width: number; | |||
height: number; | |||
/** | |||
* The margin between the SVG and the drawing area. | |||
* It's used for leving space for extra information wuch as axes, or legend. |
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.
* It's used for leving space for extra information wuch as axes, or legend. | |
* It's used for leaving space for extra information such as axes, or legend. |
/** | ||
* The margin between the SVG and the drawing area. | ||
* It's used for leving space for extra information wuch as axes, or legend. | ||
* Accept and object with some of the next properties: `top`, `bottom`, `left`, and `right`. |
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.
* Accept and object with some of the next properties: `top`, `bottom`, `left`, and `right`. | |
* Accepts an object with some of the following properties: `top`, `bottom`, `left`, and `right`. |
yAxisKey?: string; | ||
}; | ||
|
||
export type StackableSeriesType = { | ||
/** | ||
* The key that identify the stacking group. |
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.
* The key that identify the stacking group. | |
* The key that identifies the stacking group. |
stack?: string; | ||
/** | ||
* Defines hos staked series handle negative values. |
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.
* Defines hos staked series handle negative values. | |
* Defines how stacked series handles negative values. |
stackOffset?: StackOffsetType; | ||
/** | ||
* The order in which series of the same staking group are staked together. |
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.
* The order in which series of the same staking group are staked together. | |
* The order in which series of the same staking group are staked together. |
As long as there is no breaking change, I backport everything. |
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.
SRY for all the comments. A ton of them are duplicates, but midway through I couldn't stop anymore! 🙇🏼 🙇🏼 🙇🏼
stackOffset?: StackOffsetType; | ||
/** | ||
* The order in which series of the same staking group are staked together. |
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.
* The order in which series of the same staking group are staked together. | |
* The order in which series' of the same group are stacked together. |
stack?: string; | ||
/** | ||
* Defines hos staked series handle negative values. |
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.
* Defines hos staked series handle negative values. | |
* Defines how stacked series handle negative values. |
yAxisKey?: string; | ||
}; | ||
|
||
export type StackableSeriesType = { | ||
/** | ||
* The key that identify the stacking group. |
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.
* The key that identify the stacking group. | |
* The key that identifies the stacking group. |
/** | ||
* The margin between the SVG and the drawing area. | ||
* It's used for leving space for extra information wuch as axes, or legend. | ||
* Accept and object with some of the next properties: `top`, `bottom`, `left`, and `right`. | ||
* @default object depends on the charts type. | ||
*/ |
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.
/** | |
* The margin between the SVG and the drawing area. | |
* It's used for leving space for extra information wuch as axes, or legend. | |
* Accept and object with some of the next properties: `top`, `bottom`, `left`, and `right`. | |
* @default object depends on the charts type. | |
*/ | |
/** | |
* The margin between the SVG and the drawing area. | |
* It's used for leaving some space for extra information such as the x- and y-axis or legend. | |
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`. | |
* @default object Depends on the charts type. | |
*/ |
packages/x-charts/src/models/axis.ts
Outdated
@@ -202,6 +216,9 @@ export type AxisDefaultized<S extends ScaleName = ScaleName, V = any> = Omit< | |||
'scaleType' | |||
> & | |||
AxisScaleConfig[S] & { | |||
/** | |||
* An indication of the number of ticks expected. |
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.
Not to sure about this indication
.
Could be either ...
* An indication of the number of ticks expected. | |
* An indication of the expected number of ticks. |
or ...
* An indication of the number of ticks expected. | |
* The expected number of ticks. |
/** | ||
* If true, the charts will not listen to the mouse move event. | ||
* It might breaks interactive features, but save some computation power. | ||
* @default false | ||
*/ |
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.
/** | |
* If true, the charts will not listen to the mouse move event. | |
* It might breaks interactive features, but save some computation power. | |
* @default false | |
*/ | |
/** | |
* If `true`, the charts will not listen to the mouse move event. | |
* It might break interactive features, but is improving performance. | |
* @default false | |
*/ |
/** | ||
* If true, the charts will not listen to the mouse move event. | ||
* It might breaks interactive features, but save some computation power. | ||
* @default false | ||
*/ |
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.
/** | |
* If true, the charts will not listen to the mouse move event. | |
* It might breaks interactive features, but save some computation power. | |
* @default false | |
*/ | |
/** | |
* If `true`, the charts will not listen to the mouse move event. | |
* It might break interactive features, but is improving performance. | |
* @default false | |
*/ |
/** | ||
* The margin between the SVG and the drawing area. | ||
* It's used for leving space for extra information wuch as axes, or legend. | ||
* Accept and object with some of the next properties: `top`, `bottom`, `left`, and `right`. | ||
* @default object depends on the charts type. | ||
*/ |
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.
/** | |
* The margin between the SVG and the drawing area. | |
* It's used for leving space for extra information wuch as axes, or legend. | |
* Accept and object with some of the next properties: `top`, `bottom`, `left`, and `right`. | |
* @default object depends on the charts type. | |
*/ | |
/** | |
* The margin between the SVG and the drawing area. | |
* It's used for leaving some space for extra information such as the x- and y-axis or legend. | |
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`. | |
* @default object Depends on the charts type. | |
*/ |
Thanks for all your comments. I think I nearly integrated each of them 👍 |
The chart's API pages were somewhat empty. It's just because most of the props don't have JSDocs 🫣
I'm adding some of them. I've splited the PR by commit with JSdocs, and commits with scripts