Skip to content

Commit 598f7e1

Browse files
committed
chore(charts): Annotate Victory types for example docs
Fixes patternfly#2139
1 parent d54d3be commit 598f7e1

32 files changed

+963
-162
lines changed

packages/react-charts/src/components/Chart/Chart.tsx

+43-11
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ export interface ChartProps extends VictoryChartProps {
3232
* The animate prop should also be used to specify enter and exit
3333
* transition configurations with the `onExit` and `onEnter` namespaces respectively.
3434
*
35-
* @example
36-
* {duration: 500, onExit: () => {}, onEnter: {duration: 500, before: () => ({y: 0})})}
35+
* @propType boolean | object
36+
* @example {duration: 500, onExit: () => {}, onEnter: {duration: 500, before: () => ({y: 0})})}
3737
*/
3838
animate?: boolean | AnimatePropTypeInterface;
3939
/**
@@ -78,11 +78,15 @@ export interface ChartProps extends VictoryChartProps {
7878
*/
7979
containerComponent?: React.ReactElement<any>;
8080
/**
81-
* **This prop should not be set manually.**
81+
* Note: This prop should not be set manually.
82+
*
83+
* @hide
8284
*/
8385
defaultAxes?: AxesType;
8486
/**
85-
* **This prop should not be set manually.**
87+
* Note: This prop should not be set manually.
88+
*
89+
* @hide
8690
*/
8791
defaultPolarAxes?: AxesType;
8892
/**
@@ -92,14 +96,22 @@ export interface ChartProps extends VictoryChartProps {
9296
* If this prop is not provided, a domain will be calculated from data, or other
9397
* available information.
9498
*
95-
* @example [-1, 1], {x: [0, 100], y: [0, 1]}
99+
* @propType number[] | { x: number[], y: number[] }
100+
* @example [low, high], { x: [low, high], y: [low, high] }
101+
*
102+
* [-1, 1], {x: [0, 100], y: [0, 1]}
96103
*/
97104
domain?: DomainPropType;
98105
/**
99106
* The domainPadding prop specifies a number of pixels of padding to add to the
100107
* beginning and end of a domain. This prop is useful for explicitly spacing ticks farther
101108
* from the origin to prevent crowding. This prop should be given as an object with
102109
* numbers specified for x and y.
110+
*
111+
* @propType number | number[] | { x: number[], y: number[] }
112+
* @example [left, right], { x: [left, right], y: [bottom, top] }
113+
*
114+
* {x: [10, -10], y: 5}
103115
*/
104116
domainPadding?: DomainPaddingPropType;
105117
/**
@@ -112,6 +124,8 @@ export interface ChartProps extends VictoryChartProps {
112124
/**
113125
* Similar to data accessor props `x` and `y`, this prop may be used to functionally
114126
* assign eventKeys to data
127+
*
128+
* @propType number | string | Function
115129
*/
116130
eventKey?: StringOrNumberOrCallback;
117131
/**
@@ -129,6 +143,7 @@ export interface ChartProps extends VictoryChartProps {
129143
* element (i.e. a single bar), and the object returned from the mutation function
130144
* will override the props of the selected element via object assignment.
131145
*
146+
* @propType object[]
132147
* @example
133148
* events={[
134149
* {
@@ -158,6 +173,8 @@ export interface ChartProps extends VictoryChartProps {
158173
events?: EventPropTypeInterface<string, string[] | number[] | string | number>[];
159174
/**
160175
* Chart uses the standard externalEventMutations prop.
176+
*
177+
* @propType object[]
161178
*/
162179
externalEventMutations?: EventCallbackInterface<string | string[], StringOrNumberOrList>[];
163180
/**
@@ -183,6 +200,8 @@ export interface ChartProps extends VictoryChartProps {
183200
horizontal?: boolean;
184201
/**
185202
* When the innerRadius prop is set, polar charts will be hollow rather than circular.
203+
*
204+
* @propType number | Function
186205
*/
187206
innerRadius?: number;
188207
/**
@@ -239,7 +258,7 @@ export interface ChartProps extends VictoryChartProps {
239258
* dependent variable. This may cause confusion in horizontal charts, as the independent variable will corresponds to
240259
* the y axis.
241260
*
242-
* examples:
261+
* @example
243262
*
244263
* maxDomain={0}
245264
* maxDomain={{ y: 0 }}
@@ -254,7 +273,7 @@ export interface ChartProps extends VictoryChartProps {
254273
* dependent variable. This may cause confusion in horizontal charts, as the independent variable will corresponds to
255274
* the y axis.
256275
*
257-
* examples:
276+
* @example
258277
*
259278
* minDomain={0}
260279
* minDomain={{ y: 0 }}
@@ -265,10 +284,14 @@ export interface ChartProps extends VictoryChartProps {
265284
* the edge of the chart and any rendered child components. This prop can be given
266285
* as a number or as an object with padding specified for top, bottom, left
267286
* and right.
287+
*
288+
* @propType number | { top: number, bottom: number, left: number, right: number }
268289
*/
269290
padding?: PaddingProps;
270291
/**
271-
* **This prop should not be set manually.**
292+
* Note: This prop should not be set manually.
293+
*
294+
* @hide
272295
*/
273296
prependDefaultAxes?: boolean;
274297
/**
@@ -283,7 +306,8 @@ export interface ChartProps extends VictoryChartProps {
283306
* chart must share the same range, so setting this prop on children nested within Chart, ChartStack, or
284307
* ChartGroup will have no effect. This prop is usually not set manually.
285308
*
286-
* examples:
309+
* @propType number[] | { x: number[], y: number[] }
310+
* @example [low, high] | { x: [low, high], y: [low, high] }
287311
*
288312
* Cartesian: range={{ x: [50, 250], y: [50, 250] }}
289313
* Polar: range={{ x: [0, 360], y: [0, 250] }}
@@ -294,6 +318,7 @@ export interface ChartProps extends VictoryChartProps {
294318
* given as a string specifying a supported scale ("linear", "time", "log", "sqrt"),
295319
* as a d3 scale function, or as an object with scales specified for x and y
296320
*
321+
* @propType string | { x: string, y: string }
297322
* @example d3Scale.time(), {x: "linear", y: "log"}
298323
*/
299324
scale?:
@@ -306,7 +331,9 @@ export interface ChartProps extends VictoryChartProps {
306331
/**
307332
* The sharedEvents prop is used internally to coordinate events between components.
308333
*
309-
* **This prop should not be set manually.**
334+
* Note: This prop should not be set manually.
335+
*
336+
* @hide
310337
*/
311338
sharedEvents?: { events: any[]; getEventState: Function };
312339
/**
@@ -321,7 +348,7 @@ export interface ChartProps extends VictoryChartProps {
321348
* value refers to the dependent variable. This may cause confusion in horizontal charts, as the independent variable
322349
* will corresponds to the y axis.
323350
*
324-
* examples:
351+
* @example
325352
*
326353
* singleQuadrantDomainPadding={false}
327354
* singleQuadrantDomainPadding={{ x: false }}
@@ -344,11 +371,16 @@ export interface ChartProps extends VictoryChartProps {
344371
* The style prop defines the style of the component. The style prop should be given as an object with styles defined
345372
* for data, labels and parent. Any valid svg styles are supported, but width, height, and padding should be specified
346373
* via props as they determine relative layout for components in Chart.
374+
*
375+
* @propType { parent: object, background: object }
376+
* @propType { parent: object, background: object }
347377
*/
348378
style?: Pick<VictoryStyleInterface, 'parent'> & { background?: VictoryStyleObject };
349379
/**
350380
* The theme prop specifies a theme to use for determining styles and layout properties for a component. Any styles or
351381
* props defined in theme may be overwritten by props specified on the component instance.
382+
*
383+
* @propType object
352384
*/
353385
theme?: ChartThemeDefinition;
354386
/**

0 commit comments

Comments
 (0)