@patternfly/react-docs 7.6.0-prerelease.6 → 7.6.0-prerelease.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/package.json +12 -13
- package/patternfly-docs/generated/components/about-modal/react.js +149 -0
- package/patternfly-docs/generated/components/accordion/react.js +262 -0
- package/patternfly-docs/generated/components/action-list/react.js +144 -0
- package/patternfly-docs/generated/components/alert/react-demos.js +56 -0
- package/patternfly-docs/generated/components/alert/react.js +1433 -0
- package/patternfly-docs/generated/components/avatar/react.js +166 -0
- package/patternfly-docs/generated/components/back-to-top/react-demos.js +60 -0
- package/patternfly-docs/generated/components/back-to-top/react.js +77 -0
- package/patternfly-docs/generated/components/backdrop/react.js +64 -0
- package/patternfly-docs/generated/components/background-image/react.js +62 -0
- package/patternfly-docs/generated/components/badge/react.js +97 -0
- package/patternfly-docs/generated/components/banner/react-demos.js +57 -0
- package/patternfly-docs/generated/components/banner/react.js +148 -0
- package/patternfly-docs/generated/components/brand/react.js +142 -0
- package/patternfly-docs/generated/components/breadcrumb/react.js +206 -0
- package/patternfly-docs/generated/components/button/react-demos.js +57 -0
- package/patternfly-docs/generated/components/button/react.js +826 -0
- package/patternfly-docs/generated/components/card/react-demos.js +201 -0
- package/patternfly-docs/generated/components/card/react.js +1015 -0
- package/patternfly-docs/generated/components/charts/area-chart/-Victory.js +1350 -0
- package/patternfly-docs/generated/components/charts/bar-chart/-Victory.js +1334 -0
- package/patternfly-docs/generated/components/charts/box-plot-chart/-Victory.js +1282 -0
- package/patternfly-docs/generated/components/charts/bullet-chart/-Victory.js +848 -0
- package/patternfly-docs/generated/components/charts/colors-for-charts/-Victory.js +192 -0
- package/patternfly-docs/generated/components/charts/donut-chart/-Victory.js +426 -0
- package/patternfly-docs/generated/components/charts/donut-utilization-chart/-Victory.js +804 -0
- package/patternfly-docs/generated/components/charts/legends/-Victory.js +3230 -0
- package/patternfly-docs/generated/components/charts/line-chart/-Victory.js +1178 -0
- package/patternfly-docs/generated/components/charts/line-chart/ECharts.js +525 -0
- package/patternfly-docs/generated/components/charts/patterns/-Victory.js +3382 -0
- package/patternfly-docs/generated/components/charts/pie-chart/-Victory.js +377 -0
- package/patternfly-docs/generated/components/charts/resize-observer/-Victory.js +2475 -0
- package/patternfly-docs/generated/components/charts/sankey-chart/ECharts.js +538 -0
- package/patternfly-docs/generated/components/charts/scatter-chart/-Victory.js +1551 -0
- package/patternfly-docs/generated/components/charts/skeletons/-Victory.js +4115 -0
- package/patternfly-docs/generated/components/charts/sparkline-chart/-Victory.js +955 -0
- package/patternfly-docs/generated/components/charts/stack-chart/-Victory.js +1173 -0
- package/patternfly-docs/generated/components/charts/threshold-chart/-Victory.js +1166 -0
- package/patternfly-docs/generated/components/charts/tooltips/-Victory.js +413 -0
- package/patternfly-docs/generated/components/chip/react-deprecated.js +323 -0
- package/patternfly-docs/generated/components/clipboard-copy/react.js +373 -0
- package/patternfly-docs/generated/components/code-block/react.js +148 -0
- package/patternfly-docs/generated/components/code-editor/react.js +659 -0
- package/patternfly-docs/generated/components/compass/react-demos.js +147 -0
- package/patternfly-docs/generated/components/compass/react.js +440 -0
- package/patternfly-docs/generated/components/content/react.js +248 -0
- package/patternfly-docs/generated/components/data-list/react-demos.js +90 -0
- package/patternfly-docs/generated/components/data-list/react.js +709 -0
- package/patternfly-docs/generated/components/date-and-time/calendar-month/react.js +283 -0
- package/patternfly-docs/generated/components/date-and-time/date-and-time-picker/react-demos.js +64 -0
- package/patternfly-docs/generated/components/date-and-time/date-picker/react-demos.js +83 -0
- package/patternfly-docs/generated/components/date-and-time/date-picker/react.js +395 -0
- package/patternfly-docs/generated/components/date-and-time/time-picker/react.js +241 -0
- package/patternfly-docs/generated/components/description-list/react-demos.js +58 -0
- package/patternfly-docs/generated/components/description-list/react.js +743 -0
- package/patternfly-docs/generated/components/divider/react.js +126 -0
- package/patternfly-docs/generated/components/drag-and-drop/react-demos.js +351 -0
- package/patternfly-docs/generated/components/drag-and-drop/react-deprecated.js +184 -0
- package/patternfly-docs/generated/components/drag-and-drop/react.js +137 -0
- package/patternfly-docs/generated/components/drawer/react.js +598 -0
- package/patternfly-docs/generated/components/dual-list-selector/react-deprecated.js +772 -0
- package/patternfly-docs/generated/components/dual-list-selector/react.js +594 -0
- package/patternfly-docs/generated/components/empty-state/react.js +199 -0
- package/patternfly-docs/generated/components/expandable-section/react-demos.js +65 -0
- package/patternfly-docs/generated/components/expandable-section/react.js +408 -0
- package/patternfly-docs/generated/components/file-upload/multiple-file-upload/react-demos.js +52 -0
- package/patternfly-docs/generated/components/file-upload/multiple-file-upload/react.js +398 -0
- package/patternfly-docs/generated/components/file-upload/simple-file-upload/react.js +749 -0
- package/patternfly-docs/generated/components/forms/checkbox/react.js +222 -0
- package/patternfly-docs/generated/components/forms/form/react.js +1106 -0
- package/patternfly-docs/generated/components/forms/form-select/react.js +208 -0
- package/patternfly-docs/generated/components/forms/radio/react.js +212 -0
- package/patternfly-docs/generated/components/forms/text-area/react.js +160 -0
- package/patternfly-docs/generated/components/forms/text-input/react.js +216 -0
- package/patternfly-docs/generated/components/helper-text/react-demos.js +180 -0
- package/patternfly-docs/generated/components/helper-text/react.js +164 -0
- package/patternfly-docs/generated/components/hero/react.js +88 -0
- package/patternfly-docs/generated/components/hint/react.js +169 -0
- package/patternfly-docs/generated/components/icon/react.js +215 -0
- package/patternfly-docs/generated/components/input-group/react.js +182 -0
- package/patternfly-docs/generated/components/jump-links/react-demos.js +154 -0
- package/patternfly-docs/generated/components/jump-links/react.js +212 -0
- package/patternfly-docs/generated/components/label/react-demos.js +57 -0
- package/patternfly-docs/generated/components/label/react.js +417 -0
- package/patternfly-docs/generated/components/list/react.js +175 -0
- package/patternfly-docs/generated/components/login-page/react.js +587 -0
- package/patternfly-docs/generated/components/masthead/react-demos.js +79 -0
- package/patternfly-docs/generated/components/masthead/react.js +291 -0
- package/patternfly-docs/generated/components/menus/application-launcher/react-demos.js +769 -0
- package/patternfly-docs/generated/components/menus/context-selector/react-demos.js +665 -0
- package/patternfly-docs/generated/components/menus/custom-menus/react-demos.js +187 -0
- package/patternfly-docs/generated/components/menus/dropdown/react-templates.js +163 -0
- package/patternfly-docs/generated/components/menus/dropdown/react.js +998 -0
- package/patternfly-docs/generated/components/menus/menu/react.js +1540 -0
- package/patternfly-docs/generated/components/menus/menu-toggle/react.js +747 -0
- package/patternfly-docs/generated/components/menus/options-menu/react-demos.js +508 -0
- package/patternfly-docs/generated/components/menus/select/react-templates.js +257 -0
- package/patternfly-docs/generated/components/menus/select/react.js +998 -0
- package/patternfly-docs/generated/components/modal/react-deprecated.js +554 -0
- package/patternfly-docs/generated/components/modal/react.js +597 -0
- package/patternfly-docs/generated/components/navigation/react-demos.js +356 -0
- package/patternfly-docs/generated/components/navigation/react.js +409 -0
- package/patternfly-docs/generated/components/notification-badge/react.js +196 -0
- package/patternfly-docs/generated/components/notification-drawer/react-demos.js +107 -0
- package/patternfly-docs/generated/components/notification-drawer/react.js +394 -0
- package/patternfly-docs/generated/components/number-input/react.js +210 -0
- package/patternfly-docs/generated/components/overflow-menu/react.js +274 -0
- package/patternfly-docs/generated/components/page/react-demos.js +149 -0
- package/patternfly-docs/generated/components/page/react.js +1352 -0
- package/patternfly-docs/generated/components/pagination/react.js +492 -0
- package/patternfly-docs/generated/components/panel/react.js +236 -0
- package/patternfly-docs/generated/components/popover/react.js +390 -0
- package/patternfly-docs/generated/components/progress/react-demos.js +59 -0
- package/patternfly-docs/generated/components/progress/react.js +283 -0
- package/patternfly-docs/generated/components/progress-stepper/react-demos.js +45 -0
- package/patternfly-docs/generated/components/progress-stepper/react.js +219 -0
- package/patternfly-docs/generated/components/search-input/react-demos.js +113 -0
- package/patternfly-docs/generated/components/search-input/react.js +263 -0
- package/patternfly-docs/generated/components/sidebar/react.js +236 -0
- package/patternfly-docs/generated/components/simple-list/react.js +200 -0
- package/patternfly-docs/generated/components/skeleton/react-demos.js +44 -0
- package/patternfly-docs/generated/components/skeleton/react.js +122 -0
- package/patternfly-docs/generated/components/skip-to-content/react.js +73 -0
- package/patternfly-docs/generated/components/slider/react.js +309 -0
- package/patternfly-docs/generated/components/spinner/react.js +111 -0
- package/patternfly-docs/generated/components/switch/react.js +163 -0
- package/patternfly-docs/generated/components/table/react-demos.js +355 -0
- package/patternfly-docs/generated/components/table/react-deprecated.js +1350 -0
- package/patternfly-docs/generated/components/table/react.js +3241 -0
- package/patternfly-docs/generated/components/tabs/react-demos.js +108 -0
- package/patternfly-docs/generated/components/tabs/react.js +1359 -0
- package/patternfly-docs/generated/components/text-input-group/react-demos.js +152 -0
- package/patternfly-docs/generated/components/text-input-group/react.js +278 -0
- package/patternfly-docs/generated/components/tile/react-deprecated.js +242 -0
- package/patternfly-docs/generated/components/timestamp/react.js +283 -0
- package/patternfly-docs/generated/components/title/react.js +94 -0
- package/patternfly-docs/generated/components/toggle-group/react.js +299 -0
- package/patternfly-docs/generated/components/toolbar/react-demos.js +66 -0
- package/patternfly-docs/generated/components/toolbar/react.js +932 -0
- package/patternfly-docs/generated/components/tooltip/react.js +241 -0
- package/patternfly-docs/generated/components/tree-view/react.js +429 -0
- package/patternfly-docs/generated/components/truncate/react.js +211 -0
- package/patternfly-docs/generated/components/wizard/react-demos.js +87 -0
- package/patternfly-docs/generated/components/wizard/react-deprecated.js +788 -0
- package/patternfly-docs/generated/components/wizard/react.js +986 -0
- package/patternfly-docs/generated/developer-guides/open-ui-automation/react.js +285 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/bullseye/react.js +70 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/flex/react.js +506 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/gallery/react.js +94 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/grid/react.js +272 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/level/react.js +87 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/split/react.js +124 -0
- package/patternfly-docs/generated/foundations-and-styles/layouts/stack/react.js +112 -0
- package/patternfly-docs/generated/index.js +1769 -0
- package/patternfly-docs/generated/patterns/card-view/react-demos.js +78 -0
- package/patternfly-docs/generated/patterns/filters/react-demos.js +141 -0
- package/patternfly-docs/generated/patterns/password-generator/react-demos.js +51 -0
- package/patternfly-docs/generated/patterns/password-strength/react-demos.js +61 -0
- package/patternfly-docs/generated/patterns/primary-detail/react-demos.js +124 -0
- package/patternfly-docs/generated/patterns/right-to-left/react-demos.js +81 -0
- package/LICENSE +0 -21
|
@@ -0,0 +1,804 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
|
|
3
|
+
import { ChartDonutThreshold, ChartDonutUtilization, ChartThemeColor } from '@patternfly/react-charts/victory';
|
|
4
|
+
import { useEffect, useState } from 'react';
|
|
5
|
+
const pageData = {
|
|
6
|
+
"id": "Donut utilization chart",
|
|
7
|
+
"section": "components",
|
|
8
|
+
"subsection": "charts",
|
|
9
|
+
"deprecated": false,
|
|
10
|
+
"template": false,
|
|
11
|
+
"beta": false,
|
|
12
|
+
"demo": false,
|
|
13
|
+
"newImplementationLink": false,
|
|
14
|
+
"source": "-Victory",
|
|
15
|
+
"tabName": null,
|
|
16
|
+
"slug": "/components/charts/donut-utilization-chart/-Victory",
|
|
17
|
+
"sourceLink": "https://github.com/patternfly/patternfly-org/blob/main/packages/react-charts/src/victory/components/ChartDonutUtilization/examples/ChartDonutUtilization.md",
|
|
18
|
+
"relPath": "packages/react-charts/src/victory/components/ChartDonutUtilization/examples/ChartDonutUtilization.md",
|
|
19
|
+
"propComponents": [
|
|
20
|
+
{
|
|
21
|
+
"name": "ChartDonutThreshold",
|
|
22
|
+
"description": "ChartDonutThreshold renders a dataset as a donut threshold chart.\n\nSee https://github.com/FormidableLabs/victory/blob/main/packages/victory-pie/src/index.d.ts",
|
|
23
|
+
"props": [
|
|
24
|
+
{
|
|
25
|
+
"name": "allowTooltip",
|
|
26
|
+
"type": "boolean",
|
|
27
|
+
"description": "Specifies the tooltip capability of the container component. A value of true allows the chart to add a\nChartTooltip component to the labelComponent property. This is a shortcut to display tooltips when the labels\nproperty is also provided.",
|
|
28
|
+
"defaultValue": "true"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"name": "animate",
|
|
32
|
+
"type": "boolean | object",
|
|
33
|
+
"description": "The animate prop specifies props for VictoryAnimation to use.\nThe animate prop should also be used to specify enter and exit\ntransition configurations with the `onExit` and `onEnter` namespaces respectively.\n\n\n@example\n{duration: 500, onExit: () => {}, onEnter: {duration: 500, before: () => ({y: 0})})}"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"name": "ariaDesc",
|
|
37
|
+
"type": "string",
|
|
38
|
+
"description": "The ariaDesc prop specifies the description of the chart/SVG to assist with\naccessibility for screen readers.\n\nNote: Overridden by the desc prop of containerComponent"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "ariaTitle",
|
|
42
|
+
"type": "string",
|
|
43
|
+
"description": "The ariaTitle prop specifies the title to be applied to the SVG to assist\naccessibility for screen readers.\n\nNote: Overridden by the title prop of containerComponent"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "capHeight",
|
|
47
|
+
"type": "number | string | Function",
|
|
48
|
+
"description": "The capHeight prop defines a text metric for the font being used: the expected height of capital letters.\nThis is necessary because of SVG, which (a) positions the *bottom* of the text at `y`, and (b) has no notion of\nline height. The value should ideally use the same units as `lineHeight` and `dy`, preferably ems. If given a\nunitless number, it is assumed to be ems."
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "categories",
|
|
52
|
+
"type": "string[] | { x: string[], y: string[] }",
|
|
53
|
+
"description": "The categories prop specifies how categorical data for a chart should be ordered.\nThis prop should be given as an array of string values, or an object with\nthese arrays of values specified for x and y. If this prop is not set,\ncategorical data will be plotted in the order it was given in the data array\n\n\n@example [\"dogs\", \"cats\", \"mice\"]"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
"name": "colorScale",
|
|
57
|
+
"type": "string[]",
|
|
58
|
+
"description": "The colorScale prop is an optional prop that defines the color scale the pie\nwill be created on. This prop should be given as an array of CSS colors, or as a string\ncorresponding to one of the built in color scales. ChartPie will automatically assign\nvalues from this color scale to the pie slices unless colors are explicitly provided in the\ndata object"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"name": "constrainToVisibleArea",
|
|
62
|
+
"type": "boolean",
|
|
63
|
+
"description": "The constrainToVisibleArea prop determines whether to coerce tooltips so that they fit within the visible area of\nthe chart. When this prop is set to true, tooltip pointers will still point to the correct data point, but the\ncenter of the tooltip will be shifted to fit within the overall width and height of the svg Victory renders.",
|
|
64
|
+
"defaultValue": "false"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"name": "containerComponent",
|
|
68
|
+
"type": "React.ReactElement<any>",
|
|
69
|
+
"description": "The containerComponent prop takes an entire component which will be used to\ncreate a container element for standalone charts.\nThe new element created from the passed containerComponent wil be provided with\nthese props from ChartPie: height, width, children\n(the chart itself) and style. Props that are not provided by the\nchild chart component include title and desc, both of which\nare intended to add accessibility to Victory components. The more descriptive these props\nare, the more accessible your data will be for people using screen readers.\nAny of these props may be overridden by passing in props to the supplied component,\nor modified or ignored within the custom component itself. If a dataComponent is\nnot provided, ChartPie will use the default ChartContainer component.\n\n@example <ChartContainer title=\"Chart of Dog Breeds\" desc=\"This chart shows ...\" />",
|
|
70
|
+
"defaultValue": "<ChartContainer />"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "cornerRadius",
|
|
74
|
+
"type": "number | Function",
|
|
75
|
+
"description": "Set the cornerRadius for every dataComponent (Slice by default) within ChartPie"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"name": "data",
|
|
79
|
+
"type": "any[]",
|
|
80
|
+
"description": "The data prop specifies the data to be plotted,\nwhere data X-value is the slice label (string or number),\nand Y-value is the corresponding number value represented by the slice\nData should be in the form of an array of data points.\nEach data point may be any format you wish (depending on the `x` and `y` accessor props),\nbut by default, an object with x and y properties is expected.\n\n@example [{x: 1, y: 2}, {x: 2, y: 3}], [[1, 2], [2, 3]],\n[[{x: \"a\", y: 1}, {x: \"b\", y: 2}], [{x: \"a\", y: 2}, {x: \"b\", y: 3}]]",
|
|
81
|
+
"defaultValue": "[]"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"name": "dataComponent",
|
|
85
|
+
"type": "React.ReactElement<any>",
|
|
86
|
+
"description": "The dataComponent prop takes an entire, HTML-complete data component which will be used to\ncreate slices for each datum in the pie chart. The new element created from the passed\ndataComponent will have the property datum set by the pie chart for the point it renders;\nproperties style and pathFunction calculated by ChartPie; an index property set\ncorresponding to the location of the datum in the data provided to the pie; events bound to\nthe ChartPie; and the d3 compatible slice object.\nIf a dataComponent is not provided, ChartPie's Slice component will be used."
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"name": "desc",
|
|
90
|
+
"type": "string",
|
|
91
|
+
"description": "The desc prop specifies the description of the chart/SVG to assist with\naccessibility for screen readers. The more info about the chart provided in\nthe description, the more usable it will be for people using screen readers.\nThis prop defaults to an empty string.\n\nNote: Overridden by containerComponent\n\n@example \"Golden retrievers make up 30%, Labs make up 25%, and other dog breeds are\nnot represented above 5% each.\""
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"name": "endAngle",
|
|
95
|
+
"type": "number",
|
|
96
|
+
"description": "The overall end angle of the pie in degrees. This prop is used in conjunction with\nstartAngle to create a pie that spans only a segment of a circle."
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"name": "eventKey",
|
|
100
|
+
"type": "number | string | Function",
|
|
101
|
+
"description": "Similar to data accessor props `x` and `y`, this prop may be used to functionally\nassign eventKeys to data"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"name": "events",
|
|
105
|
+
"type": "object[]",
|
|
106
|
+
"description": "The event prop takes an array of event objects. Event objects are composed of\na target, an eventKey, and eventHandlers. Targets may be any valid style namespace\nfor a given component, so \"data\" and \"labels\" are all valid targets for ChartPie\nevents. The eventKey may optionally be used to select a single element by index rather than\nan entire set. The eventHandlers object should be given as an object whose keys are standard\nevent names (i.e. onClick) and whose values are event callbacks. The return value\nof an event handler is used to modify elements. The return value should be given\nas an object or an array of objects with optional target and eventKey keys,\nand a mutation key whose value is a function. The target and eventKey keys\nwill default to those corresponding to the element the event handler was attached to.\nThe mutation function will be called with the calculated props for the individual selected\nelement (i.e. a single bar), and the object returned from the mutation function\nwill override the props of the selected element via object assignment.\n\n\n@example\nevents={[\n {\n target: \"data\",\n eventKey: 1,\n eventHandlers: {\n onClick: () => {\n return [\n {\n eventKey: 2,\n mutation: (props) => {\n return {style: merge({}, props.style, {fill: \"orange\"})};\n }\n }, {\n eventKey: 2,\n target: \"labels\",\n mutation: () => {\n return {text: \"hey\"};\n }\n }\n ];\n }\n }\n }\n]}"
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "externalEventMutations",
|
|
110
|
+
"type": "object[]",
|
|
111
|
+
"description": "ChartPie uses the standard externalEventMutations prop."
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"name": "groupComponent",
|
|
115
|
+
"type": "React.ReactElement<any>",
|
|
116
|
+
"description": "The groupComponent prop takes an entire component which will be used to\ncreate group elements for use within container elements. This prop defaults\nto a <g> tag on web, and a react-native-svg <G> tag on mobile"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"name": "hasPatterns",
|
|
120
|
+
"type": "boolean | boolean[]",
|
|
121
|
+
"description": "The hasPatterns prop is an optional prop that indicates whether a pattern is shown for a chart.\nSVG patterns are dynamically generated (unique to each chart) in order to apply colors from the selected\ncolor theme or custom color scale. Those generated patterns are applied in a specific order (via a URL), similar\nto the color theme ordering defined by PatternFly. If the multi-color theme was in use; for example, colorized\npatterns would be displayed in that same order. Create custom patterns via the patternScale prop.\n\nNote: Not all components are supported; for example, ChartLine, ChartBullet, ChartThreshold, etc.\n\n@example hasPatterns={ true }\n@example hasPatterns={[ true, true, false ]}"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"name": "height",
|
|
125
|
+
"type": "number",
|
|
126
|
+
"description": "Specifies the height the svg viewBox of the chart container. This value should be given as a\nnumber of pixels.\n\nBecause Victory renders responsive containers, the width and height props do not determine the width and\nheight of the chart in number of pixels, but instead define an aspect ratio for the chart. The exact number of\npixels will depend on the size of the container the chart is rendered into.\n\nNote: When adding a legend, height (the overall SVG height) may need to be larger than pieHeight (the pie size)\nin order to accommodate the extra legend.\n\nBy default, pieHeight is the min. of either height or width. This covers most use cases in order to accommodate\nlegends within the same SVG. However, pieHeight (not height) may need to be set in order to adjust the pie height.\n\nTypically, the parent container is set to the same width in order to maintain the aspect ratio.",
|
|
127
|
+
"defaultValue": "theme.pie.height"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"name": "innerRadius",
|
|
131
|
+
"type": "number | Function",
|
|
132
|
+
"description": "When creating a donut chart, this prop determines the number of pixels between\nthe center of the chart and the inner edge. When this prop is set to zero\na regular pie chart is rendered."
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"name": "invert",
|
|
136
|
+
"type": "boolean",
|
|
137
|
+
"description": "Invert the threshold color scale used to represent warnings, errors, etc.",
|
|
138
|
+
"defaultValue": "false"
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"name": "labelComponent",
|
|
142
|
+
"type": "React.ReactElement<any>",
|
|
143
|
+
"description": "The labelComponent prop takes in an entire label component which will be used\nto create a label for the area. The new element created from the passed labelComponent\nwill be supplied with the following properties: x, y, index, data, verticalAnchor,\ntextAnchor, angle, style, text, and events. any of these props may be overridden\nby passing in props to the supplied component, or modified or ignored within\nthe custom component itself. If labelComponent is omitted, a new ChartLabel\nwill be created with props described above. This labelComponent prop should be used to\nprovide a series label for ChartPie. If individual labels are required for each\ndata point, they should be created by composing ChartPie with VictoryScatter"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"name": "labelPosition",
|
|
147
|
+
"type": "string | Function",
|
|
148
|
+
"description": "The labelPosition prop specifies the angular position of each label relative to its corresponding slice.\nThis prop should be given as \"startAngle\", \"endAngle\", \"centroid\", or as a function that returns one of these\nvalues. When this prop is not given, the label will be positioned at the centroid of each slice."
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"name": "labelRadius",
|
|
152
|
+
"type": "number | Function",
|
|
153
|
+
"description": "The labelRadius prop defines the radius of the arc that will be used for positioning each slice label.\nIf this prop is not set, the label radius will default to the radius of the pie + label padding."
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"name": "labels",
|
|
157
|
+
"type": "string[] | number[] | ((data: any) => string | number | null)",
|
|
158
|
+
"description": "The labels prop defines labels that will appear above each bar in your chart.\nThis prop should be given as an array of values or as a function of data.\nIf given as an array, the number of elements in the array should be equal to\nthe length of the data array. Labels may also be added directly to the data object\nlike data={[{x: 1, y: 1, label: \"first\"}]}.\n\n@example [\"spring\", \"summer\", \"fall\", \"winter\"], (datum) => datum.title",
|
|
159
|
+
"defaultValue": "[]"
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"name": "legendAllowWrap",
|
|
163
|
+
"type": "boolean | ((extraHeight: number) => void)",
|
|
164
|
+
"description": "Allows legend items to wrap onto the next line if the chart is not wide enough.\n\nNote that the chart's SVG height and width are 100% by default, so it can be responsive itself. However, if you\ndefine the height and width of the chart's parent container, you must accommodate for extra legend height due to\nlegend items wrapping onto the next line. When the height of the chart's parent container is too small, some legend\nitems may not be visible.\n\nAlternatively, a callback function may be provided, which will be called after the legend's itemsPerRow property\nhas been calculated. The value provided can be used to increase the chart's parent container height as legend\nitems wrap onto the next line. If no adjustment is necessary, the value will be zero.\n\nNote: This is overridden by the legendItemsPerRow property"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"name": "legendComponent",
|
|
168
|
+
"type": "React.ReactElement<any>",
|
|
169
|
+
"description": "The legend component to render with chart.\n\nNote: Use legendData so the legend width can be calculated and positioned properly.\nDefault legend properties may be applied"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"name": "legendData",
|
|
173
|
+
"type": "{\n name?: string;\n symbol?: {\n fill?: string;\n type?: string;\n };\n}[]",
|
|
174
|
+
"description": "Specify data via the data prop. ChartLegend expects data as an\narray of objects with name (required), symbol, and labels properties.\nThe data prop must be given as an array.\n\n@example legendData={[{ name: `GBps capacity - 45%` }, { name: 'Unused' }]}"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
"name": "legendDirection",
|
|
178
|
+
"type": "'ltr' | 'rtl'",
|
|
179
|
+
"description": "Text direction of the legend labels."
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
"name": "legendOrientation",
|
|
183
|
+
"type": "'horizontal' | 'vertical'",
|
|
184
|
+
"description": "The orientation prop takes a string that defines whether legend data\nare displayed in a row or column. When orientation is \"horizontal\",\nlegend items will be displayed in a single row. When orientation is\n\"vertical\", legend items will be displayed in a single column. Line\nand text-wrapping is not currently supported, so \"vertical\"\norientation is both the default setting and recommended for\ndisplaying many series of data."
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"name": "legendPosition",
|
|
188
|
+
"type": "'bottom' | 'right'",
|
|
189
|
+
"description": "The legend position relation to the pie chart. Valid values are 'bottom' and 'right'\n\nNote: When adding a legend, padding may need to be adjusted in order to accommodate the extra legend. In some\ncases, the legend may not be visible until enough padding is applied."
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"name": "name",
|
|
193
|
+
"type": "string",
|
|
194
|
+
"description": "The name prop is typically used to reference a component instance when defining shared events. However, this\noptional prop may also be applied to child elements as an ID prefix. This is a workaround to ensure Victory\nbased components output unique IDs when multiple charts appear in a page."
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"name": "origin",
|
|
198
|
+
"type": "{ x: number, y: number }",
|
|
199
|
+
"description": "Victory components will pass an origin prop is to define the center point in svg coordinates for polar charts.\n\nNote: It will not typically be necessary to set an origin prop manually"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"name": "padAngle",
|
|
203
|
+
"type": "number | Function",
|
|
204
|
+
"description": "The padAngle prop determines the amount of separation between adjacent data slices\nin number of degrees"
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"name": "padding",
|
|
208
|
+
"type": "number | { top: number, bottom: number, left: number, right: number }",
|
|
209
|
+
"description": "The padding props specifies the amount of padding in number of pixels between\nthe edge of the chart and any rendered child components. This prop can be given\nas a number or as an object with padding specified for top, bottom, left\nand right."
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"name": "patternScale",
|
|
213
|
+
"type": "string[]",
|
|
214
|
+
"description": "The patternScale prop is an optional prop that defines patterns to apply, where applicable. This prop should be\ngiven as a string array of pattern URLs. Patterns will be assigned to children by index and will repeat when there\nare more children than patterns in the provided patternScale. Use null to omit the pattern for a given index.\n\nNote: Not all components are supported; for example, ChartLine, ChartBullet, ChartThreshold, etc.\n\n@example patternScale={[ 'url(\"#pattern1\")', 'url(\"#pattern2\")', null ]}"
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
"name": "radius",
|
|
218
|
+
"type": "number | Function",
|
|
219
|
+
"description": "Specifies the radius of the chart. If this property is not provided it is computed\nfrom width, height, and padding props"
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"name": "sortKey",
|
|
223
|
+
"type": "number | string | Function | string[]",
|
|
224
|
+
"description": "Use the sortKey prop to indicate how data should be sorted. This prop\nis given directly to the lodash sortBy function to be executed on the final dataset."
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"name": "sortOrder",
|
|
228
|
+
"type": "string",
|
|
229
|
+
"description": "The sortOrder prop specifies whether sorted data should be returned in 'ascending' or 'descending' order."
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"name": "standalone",
|
|
233
|
+
"type": "boolean",
|
|
234
|
+
"description": "The standalone prop determines whether the component will render a standalone svg\nor a <g> tag that will be included in an external svg. Set standalone to false to\ncompose ChartPie with other components within an enclosing <svg> tag.",
|
|
235
|
+
"defaultValue": "true"
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
"name": "startAngle",
|
|
239
|
+
"type": "number",
|
|
240
|
+
"description": "The overall start angle of the pie in degrees. This prop is used in conjunction with\nendAngle to create a pie that spans only a segment of a circle."
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"name": "style",
|
|
244
|
+
"type": "{ parent: object, data: object, labels: object }",
|
|
245
|
+
"description": "The style prop specifies styles for your pie. ChartPie relies on Radium,\nso valid Radium style objects should work for this prop. Height, width, and\npadding should be specified via the height, width, and padding props.\n\n\n@example {data: {stroke: \"black\"}, label: {fontSize: 10}}"
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
"name": "subTitle",
|
|
249
|
+
"type": "string",
|
|
250
|
+
"description": "The subtitle for the donut chart"
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
"name": "subTitleComponent",
|
|
254
|
+
"type": "React.ReactElement<any>",
|
|
255
|
+
"description": "The label component to render the chart subTitle.\n\nWhen overriding the subTitleComponent prop, title and subTitle will be centered independently. You may choose to\nuse the x and y props of ChartLabel to adjust the center position. For example:\n\n<pre>\nsubTitle=\"Pets\"\nsubTitleComponent={<ChartLabel y={130} />}\ntitle={100}\ntitleComponent={<ChartLabel y={107} />}\n</pre>\n\nNote: Default label properties may be applied"
|
|
256
|
+
},
|
|
257
|
+
{
|
|
258
|
+
"name": "subTitlePosition",
|
|
259
|
+
"type": "'bottom' | 'center' | 'right'",
|
|
260
|
+
"description": "The orientation of the subtitle position. Valid values are 'bottom', 'center', and 'right'",
|
|
261
|
+
"defaultValue": "\"center\""
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"name": "theme",
|
|
265
|
+
"type": "object",
|
|
266
|
+
"description": "The theme prop takes a style object with nested data, labels, and parent objects.\nYou can create this object yourself, or you can use a theme provided by\nWhen using ChartPie as a solo component, implement the theme directly on\nChartPie. If you are wrapping ChartPie in ChartChart or ChartGroup,\nplease call the theme on the outermost wrapper component instead.",
|
|
267
|
+
"defaultValue": "getDonutThresholdStaticTheme(themeColor, invert)"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"name": "themeColor",
|
|
271
|
+
"type": "string",
|
|
272
|
+
"description": "Specifies the theme color. Valid values are 'blue', 'green', 'multi', etc.\n\nNote: Not compatible with theme prop\n\n@example themeColor={ChartThemeColor.blue}"
|
|
273
|
+
},
|
|
274
|
+
{
|
|
275
|
+
"name": "title",
|
|
276
|
+
"type": "string",
|
|
277
|
+
"description": "The title for the donut chart"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"name": "titleComponent",
|
|
281
|
+
"type": "React.ReactElement<any>",
|
|
282
|
+
"description": "The label component to render the chart title.\n\nWhen centering both title and subTitle props, it's possible to override both styles via an array provided to\nChartLabel. The first item in the array is associated with title styles, while the second item in the array is\nassociated with subtitle styles.\n\n<pre>\nsubTitle=\"Pets\"\ntitle={100}\ntitleComponent={\n <ChartLabel style={[{\n fill: 'red', // title color\n fontSize: 24\n }, {\n fill: 'blue', // subtitle color\n fontSize: 14\n }]}\n />\n}\n</pre>\n\nIn this case, both title and subTitle will be centered together. However, should you also override the\nsubTitleComponent prop, title and subTitle will be centered independently. You may choose to\nuse the x and y props of ChartLabel to adjust the center position. For example:\n\n<pre>\nsubTitle=\"Pets\"\nsubTitleComponent={<ChartLabel y={130} />}\ntitle={100}\ntitleComponent={<ChartLabel y={107} />}\n</pre>\n\nNote: Default label properties may be applied"
|
|
283
|
+
},
|
|
284
|
+
{
|
|
285
|
+
"name": "width",
|
|
286
|
+
"type": "number",
|
|
287
|
+
"description": "Specifies the width of the svg viewBox of the chart container. This value should be given as a number of pixels.\n\nBecause Victory renders responsive containers, the width and height props do not determine the width and\nheight of the chart in number of pixels, but instead define an aspect ratio for the chart. The exact number of\npixels will depend on the size of the container the chart is rendered into. Typically, the parent container is set\nto the same width in order to maintain the aspect ratio.",
|
|
288
|
+
"defaultValue": "theme.pie.width"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
"name": "x",
|
|
292
|
+
"type": "number | string | Function | string[]",
|
|
293
|
+
"description": "The x prop specifies how to access the X value of each data point.\nIf given as a function, it will be run on each data point, and returned value will be used.\nIf given as an integer, it will be used as an array index for array-type data points.\nIf given as a string, it will be used as a property key for object-type data points.\nIf given as an array of strings, or a string containing dots or brackets,\nit will be used as a nested object property path (for details see Lodash docs for _.get).\nIf `null` or `undefined`, the data value will be used as is (identity function/pass-through).\n\n\n@example 0, 'x', 'x.value.nested.1.thing', 'x[2].also.nested', null, d => Math.sin(d)"
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"name": "y",
|
|
297
|
+
"type": "number | string | Function | string[]",
|
|
298
|
+
"description": "The y prop specifies how to access the Y value of each data point.\nIf given as a function, it will be run on each data point, and returned value will be used.\nIf given as an integer, it will be used as an array index for array-type data points.\nIf given as a string, it will be used as a property key for object-type data points.\nIf given as an array of strings, or a string containing dots or brackets,\nit will be used as a nested object property path (for details see Lodash docs for _.get).\nIf `null` or `undefined`, the data value will be used as is (identity function/pass-through).\n\n\n@example 0, 'y', 'y.value.nested.1.thing', 'y[2].also.nested', null, d => Math.sin(d)"
|
|
299
|
+
}
|
|
300
|
+
]
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
"name": "ChartDonutUtilization",
|
|
304
|
+
"description": "ChartDonutUtilization renders a dataset as a donut utilization chart.\n\nSee https://github.com/FormidableLabs/victory/blob/main/packages/victory-pie/src/index.d.ts",
|
|
305
|
+
"props": [
|
|
306
|
+
{
|
|
307
|
+
"name": "allowTooltip",
|
|
308
|
+
"type": "boolean",
|
|
309
|
+
"description": "Specifies the tooltip capability of the container component. A value of true allows the chart to add a\nChartTooltip component to the labelComponent property. This is a shortcut to display tooltips when the labels\nproperty is also provided.",
|
|
310
|
+
"defaultValue": "true"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"name": "animate",
|
|
314
|
+
"type": "boolean | object",
|
|
315
|
+
"description": "The animate prop specifies props for VictoryAnimation to use.\nThe animate prop should also be used to specify enter and exit\ntransition configurations with the `onExit` and `onEnter` namespaces respectively.\n\n\n@example\n{duration: 500, onExit: () => {}, onEnter: {duration: 500, before: () => ({y: 0})})}"
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
"name": "ariaDesc",
|
|
319
|
+
"type": "string",
|
|
320
|
+
"description": "The ariaDesc prop specifies the description of the chart/SVG to assist with\naccessibility for screen readers.\n\nNote: Overridden by the desc prop of containerComponent"
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
"name": "ariaTitle",
|
|
324
|
+
"type": "string",
|
|
325
|
+
"description": "The ariaTitle prop specifies the title to be applied to the SVG to assist\naccessibility for screen readers.\n\nNote: Overridden by the title prop of containerComponent"
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"name": "capHeight",
|
|
329
|
+
"type": "number | string | Function",
|
|
330
|
+
"description": "The capHeight prop defines a text metric for the font being used: the expected height of capital letters.\nThis is necessary because of SVG, which (a) positions the *bottom* of the text at `y`, and (b) has no notion of\nline height. The value should ideally use the same units as `lineHeight` and `dy`, preferably ems. If given a\nunitless number, it is assumed to be ems."
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
"name": "categories",
|
|
334
|
+
"type": "string[] | { x: string[], y: string[] }",
|
|
335
|
+
"description": "The categories prop specifies how categorical data for a chart should be ordered.\nThis prop should be given as an array of string values, or an object with\nthese arrays of values specified for x and y. If this prop is not set,\ncategorical data will be plotted in the order it was given in the data array\n\n\n@example [\"dogs\", \"cats\", \"mice\"]"
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
"name": "colorScale",
|
|
339
|
+
"type": "string[]",
|
|
340
|
+
"description": "The colorScale prop is an optional prop that defines the color scale the pie\nwill be created on. This prop should be given as an array of CSS colors, or as a string\ncorresponding to one of the built in color scales. ChartPie will automatically assign\nvalues from this color scale to the pie slices unless colors are explicitly provided in the\ndata object"
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
"name": "constrainToVisibleArea",
|
|
344
|
+
"type": "boolean",
|
|
345
|
+
"description": "The constrainToVisibleArea prop determines whether to coerce tooltips so that they fit within the visible area of\nthe chart. When this prop is set to true, tooltip pointers will still point to the correct data point, but the\ncenter of the tooltip will be shifted to fit within the overall width and height of the svg Victory renders."
|
|
346
|
+
},
|
|
347
|
+
{
|
|
348
|
+
"name": "containerComponent",
|
|
349
|
+
"type": "React.ReactElement<any>",
|
|
350
|
+
"description": "The containerComponent prop takes an entire component which will be used to\ncreate a container element for standalone charts.\nThe new element created from the passed containerComponent wil be provided with\nthese props from ChartPie: height, width, children\n(the chart itself) and style. Props that are not provided by the\nchild chart component include title and desc, both of which\nare intended to add accessibility to Victory components. The more descriptive these props\nare, the more accessible your data will be for people using screen readers.\nAny of these props may be overridden by passing in props to the supplied component,\nor modified or ignored within the custom component itself. If a dataComponent is\nnot provided, ChartPie will use the default ChartContainer component.\n\n@example <ChartContainer title=\"Chart of Dog Breeds\" desc=\"This chart shows ...\" />",
|
|
351
|
+
"defaultValue": "<ChartContainer />"
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
"name": "cornerRadius",
|
|
355
|
+
"type": "number | Function",
|
|
356
|
+
"description": "Set the cornerRadius for every dataComponent (Slice by default) within ChartPie"
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
"name": "data",
|
|
360
|
+
"type": "any",
|
|
361
|
+
"description": "The data prop specifies the data to be plotted,\nwhere data X-value is the slice label (string or number),\nand Y-value is the corresponding number value represented by the slice\nData should be in the form of an array of data points.\nEach data point may be any format you wish (depending on the `x` and `y` accessor props),\nbut by default, an object with x and y properties is expected.\n\n@example [{x: 1, y: 2}, {x: 2, y: 3}], [[1, 2], [2, 3]],\n[[{x: \"a\", y: 1}, {x: \"b\", y: 2}], [{x: \"a\", y: 2}, {x: \"b\", y: 3}]]"
|
|
362
|
+
},
|
|
363
|
+
{
|
|
364
|
+
"name": "dataComponent",
|
|
365
|
+
"type": "React.ReactElement<any>",
|
|
366
|
+
"description": "The dataComponent prop takes an entire, HTML-complete data component which will be used to\ncreate slices for each datum in the pie chart. The new element created from the passed\ndataComponent will have the property datum set by the pie chart for the point it renders;\nproperties style and pathFunction calculated by ChartPie; an index property set\ncorresponding to the location of the datum in the data provided to the pie; events bound to\nthe ChartPie; and the d3 compatible slice object.\nIf a dataComponent is not provided, ChartPie's Slice component will be used."
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
"name": "desc",
|
|
370
|
+
"type": "string",
|
|
371
|
+
"description": "The desc prop specifies the description of the chart/SVG to assist with\naccessibility for screen readers. The more info about the chart provided in\nthe description, the more usable it will be for people using screen readers.\nThis prop defaults to an empty string.\n\nNote: Overridden by containerComponent\n\n@example \"Golden retrievers make up 30%, Labs make up 25%, and other dog breeds are\nnot represented above 5% each.\""
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
"name": "endAngle",
|
|
375
|
+
"type": "number",
|
|
376
|
+
"description": "The overall end angle of the pie in degrees. This prop is used in conjunction with\nstartAngle to create a pie that spans only a segment of a circle."
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
"name": "eventKey",
|
|
380
|
+
"type": "number | string | Function",
|
|
381
|
+
"description": "Similar to data accessor props `x` and `y`, this prop may be used to functionally\nassign eventKeys to data"
|
|
382
|
+
},
|
|
383
|
+
{
|
|
384
|
+
"name": "events",
|
|
385
|
+
"type": "object[]",
|
|
386
|
+
"description": "The event prop takes an array of event objects. Event objects are composed of\na target, an eventKey, and eventHandlers. Targets may be any valid style namespace\nfor a given component, so \"data\" and \"labels\" are all valid targets for ChartPie\nevents. The eventKey may optionally be used to select a single element by index rather than\nan entire set. The eventHandlers object should be given as an object whose keys are standard\nevent names (i.e. onClick) and whose values are event callbacks. The return value\nof an event handler is used to modify elements. The return value should be given\nas an object or an array of objects with optional target and eventKey keys,\nand a mutation key whose value is a function. The target and eventKey keys\nwill default to those corresponding to the element the event handler was attached to.\nThe mutation function will be called with the calculated props for the individual selected\nelement (i.e. a single bar), and the object returned from the mutation function\nwill override the props of the selected element via object assignment.\n\n\n@example\nevents={[\n {\n target: \"data\",\n eventKey: 1,\n eventHandlers: {\n onClick: () => {\n return [\n {\n eventKey: 2,\n mutation: (props) => {\n return {style: merge({}, props.style, {fill: \"orange\"})};\n }\n }, {\n eventKey: 2,\n target: \"labels\",\n mutation: () => {\n return {text: \"hey\"};\n }\n }\n ];\n }\n }\n }\n]}"
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
"name": "externalEventMutations",
|
|
390
|
+
"type": "object[]",
|
|
391
|
+
"description": "ChartPie uses the standard externalEventMutations prop."
|
|
392
|
+
},
|
|
393
|
+
{
|
|
394
|
+
"name": "groupComponent",
|
|
395
|
+
"type": "React.ReactElement<any>",
|
|
396
|
+
"description": "The groupComponent prop takes an entire component which will be used to\ncreate group elements for use within container elements. This prop defaults\nto a <g> tag on web, and a react-native-svg <G> tag on mobile"
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
"name": "hasPatterns",
|
|
400
|
+
"type": "boolean | boolean[]",
|
|
401
|
+
"description": "The hasPatterns prop is an optional prop that indicates whether a pattern is shown for a chart.\nSVG patterns are dynamically generated (unique to each chart) in order to apply colors from the selected\ncolor theme or custom color scale. Those generated patterns are applied in a specific order (via a URL), similar\nto the color theme ordering defined by PatternFly. If the multi-color theme was in use; for example, colorized\npatterns would be displayed in that same order. Create custom patterns via the patternScale prop.\n\nNote: Not all components are supported; for example, ChartLine, ChartBullet, ChartThreshold, etc.\n\n@example hasPatterns={ true }\n@example hasPatterns={[ true, true, false ]}"
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
"name": "height",
|
|
405
|
+
"type": "number",
|
|
406
|
+
"description": "Specifies the height the svg viewBox of the chart container. This value should be given as a\nnumber of pixels.\n\nBecause Victory renders responsive containers, the width and height props do not determine the width and\nheight of the chart in number of pixels, but instead define an aspect ratio for the chart. The exact number of\npixels will depend on the size of the container the chart is rendered into.\n\nNote: When adding a legend, height (the overall SVG height) may need to be larger than pieHeight (the pie size)\nin order to accommodate the extra legend.\n\nBy default, pieHeight is the min. of either height or width. This covers most use cases in order to accommodate\nlegends within the same SVG. However, pieHeight (not height) may need to be set in order to adjust the pie height.\n\nTypically, the parent container is set to the same width in order to maintain the aspect ratio.",
|
|
407
|
+
"defaultValue": "theme.pie.height"
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
"name": "innerRadius",
|
|
411
|
+
"type": "number | Function",
|
|
412
|
+
"description": "When creating a donut chart, this prop determines the number of pixels between\nthe center of the chart and the inner edge. When this prop is set to zero\na regular pie chart is rendered."
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
"name": "invert",
|
|
416
|
+
"type": "boolean",
|
|
417
|
+
"description": "Invert the threshold color scale used to represent warnings, errors, etc.\n\nInstead of showing a warning at 60% and an error at 90%; for example, this would allow users to show a warning\nbelow 60% and an error below 20%",
|
|
418
|
+
"defaultValue": "false"
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
"name": "labelComponent",
|
|
422
|
+
"type": "React.ReactElement<any>",
|
|
423
|
+
"description": "The labelComponent prop takes in an entire label component which will be used\nto create a label for the area. The new element created from the passed labelComponent\nwill be supplied with the following properties: x, y, index, data, verticalAnchor,\ntextAnchor, angle, style, text, and events. any of these props may be overridden\nby passing in props to the supplied component, or modified or ignored within\nthe custom component itself. If labelComponent is omitted, a new ChartLabel\nwill be created with props described above. This labelComponent prop should be used to\nprovide a series label for ChartPie. If individual labels are required for each\ndata point, they should be created by composing ChartPie with VictoryScatter"
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
"name": "labelPosition",
|
|
427
|
+
"type": "string | Function",
|
|
428
|
+
"description": "The labelPosition prop specifies the angular position of each label relative to its corresponding slice.\nThis prop should be given as \"startAngle\", \"endAngle\", \"centroid\", or as a function that returns one of these\nvalues. When this prop is not given, the label will be positioned at the centroid of each slice."
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
"name": "labelRadius",
|
|
432
|
+
"type": "number | Function",
|
|
433
|
+
"description": "The labelRadius prop defines the radius of the arc that will be used for positioning each slice label.\nIf this prop is not set, the label radius will default to the radius of the pie + label padding."
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
"name": "labels",
|
|
437
|
+
"type": "string[] | number[] | ((data: any) => string | number | null)",
|
|
438
|
+
"description": "The labels prop defines labels that will appear above each bar in your chart.\nThis prop should be given as an array of values or as a function of data.\nIf given as an array, the number of elements in the array should be equal to\nthe length of the data array. Labels may also be added directly to the data object\nlike data={[{x: 1, y: 1, label: \"first\"}]}.\n\n@example [\"spring\", \"summer\", \"fall\", \"winter\"], (datum) => datum.title"
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
"name": "legendAllowWrap",
|
|
442
|
+
"type": "boolean | ((extraHeight: number) => void)",
|
|
443
|
+
"description": "Allows legend items to wrap onto the next line if the chart is not wide enough.\n\nNote that the chart's SVG height and width are 100% by default, so it can be responsive itself. However, if you\ndefine the height and width of the chart's parent container, you must accommodate for extra legend height due to\nlegend items wrapping onto the next line. When the height of the chart's parent container is too small, some legend\nitems may not be visible.\n\nAlternatively, a callback function may be provided, which will be called after the legend's itemsPerRow property\nhas been calculated. The value provided can be used to increase the chart's parent container height as legend\nitems wrap onto the next line. If no adjustment is necessary, the value will be zero.\n\nNote: This is overridden by the legendItemsPerRow property"
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
"name": "legendComponent",
|
|
447
|
+
"type": "React.ReactElement<any>",
|
|
448
|
+
"description": "The legend component to render with chart.\n\nNote: Use legendData so the legend width can be calculated and positioned properly.\nDefault legend properties may be applied"
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
"name": "legendData",
|
|
452
|
+
"type": "{\n name?: string;\n symbol?: {\n fill?: string;\n type?: string;\n };\n}[]",
|
|
453
|
+
"description": "Specify data via the data prop. ChartLegend expects data as an\narray of objects with name (required), symbol, and labels properties.\nThe data prop must be given as an array.\n\n@example legendData={[{ name: `GBps capacity - 45%` }, { name: 'Unused' }]}"
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
"name": "legendDirection",
|
|
457
|
+
"type": "'ltr' | 'rtl'",
|
|
458
|
+
"description": "Text direction of the legend labels.",
|
|
459
|
+
"defaultValue": "'ltr'"
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
"name": "legendOrientation",
|
|
463
|
+
"type": "'horizontal' | 'vertical'",
|
|
464
|
+
"description": "The orientation prop takes a string that defines whether legend data\nare displayed in a row or column. When orientation is \"horizontal\",\nlegend items will be displayed in a single row. When orientation is\n\"vertical\", legend items will be displayed in a single column. Line\nand text-wrapping is not currently supported, so \"vertical\"\norientation is both the default setting and recommended for\ndisplaying many series of data."
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
"name": "legendPosition",
|
|
468
|
+
"type": "'bottom' | 'right'",
|
|
469
|
+
"description": "The legend position relation to the pie chart. Valid values are 'bottom' and 'right'\n\nNote: When adding a legend, padding may need to be adjusted in order to accommodate the extra legend. In some\ncases, the legend may not be visible until enough padding is applied.",
|
|
470
|
+
"defaultValue": "\"right\""
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
"name": "name",
|
|
474
|
+
"type": "string",
|
|
475
|
+
"description": "The name prop is typically used to reference a component instance when defining shared events. However, this\noptional prop may also be applied to child elements as an ID prefix. This is a workaround to ensure Victory\nbased components output unique IDs when multiple charts appear in a page."
|
|
476
|
+
},
|
|
477
|
+
{
|
|
478
|
+
"name": "origin",
|
|
479
|
+
"type": "{ x: number, y: number }",
|
|
480
|
+
"description": "Victory components will pass an origin prop is to define the center point in svg coordinates for polar charts.\n\nNote: It will not typically be necessary to set an origin prop manually"
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
"name": "padAngle",
|
|
484
|
+
"type": "number | Function",
|
|
485
|
+
"description": "The padAngle prop determines the amount of separation between adjacent data slices\nin number of degrees"
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
"name": "padding",
|
|
489
|
+
"type": "number | { top: number, bottom: number, left: number, right: number }",
|
|
490
|
+
"description": "The padding props specifies the amount of padding in number of pixels between\nthe edge of the chart and any rendered child components. This prop can be given\nas a number or as an object with padding specified for top, bottom, left\nand right."
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
"name": "patternScale",
|
|
494
|
+
"type": "string[]",
|
|
495
|
+
"description": "The patternScale prop is an optional prop that defines patterns to apply, where applicable. This prop should be\ngiven as a string array of pattern URLs. Patterns will be assigned to children by index and will repeat when there\nare more children than patterns in the provided patternScale. Use null to omit the pattern for a given index.\n\nNote: Not all components are supported; for example, ChartLine, ChartBullet, ChartThreshold, etc.\n\n@example patternScale={[ 'url(\"#pattern1\")', 'url(\"#pattern2\")', null ]}"
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
"name": "radius",
|
|
499
|
+
"type": "number | Function",
|
|
500
|
+
"description": "Specifies the radius of the chart. If this property is not provided it is computed\nfrom width, height, and padding props"
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
"name": "sortKey",
|
|
504
|
+
"type": "number | string | Function | string[]",
|
|
505
|
+
"description": "Use the sortKey prop to indicate how data should be sorted. This prop\nis given directly to the lodash sortBy function to be executed on the final dataset."
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
"name": "sortOrder",
|
|
509
|
+
"type": "string",
|
|
510
|
+
"description": "The sortOrder prop specifies whether sorted data should be returned in 'ascending' or 'descending' order."
|
|
511
|
+
},
|
|
512
|
+
{
|
|
513
|
+
"name": "standalone",
|
|
514
|
+
"type": "boolean",
|
|
515
|
+
"description": "The standalone prop determines whether the component will render a standalone svg\nor a <g> tag that will be included in an external svg. Set standalone to false to\ncompose ChartPie with other components within an enclosing <svg> tag.",
|
|
516
|
+
"defaultValue": "true"
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
"name": "startAngle",
|
|
520
|
+
"type": "number",
|
|
521
|
+
"description": "The overall start angle of the pie in degrees. This prop is used in conjunction with\nendAngle to create a pie that spans only a segment of a circle."
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
"name": "style",
|
|
525
|
+
"type": "{ parent: object, data: object, labels: object }",
|
|
526
|
+
"description": "The style prop specifies styles for your pie. ChartPie relies on Radium,\nso valid Radium style objects should work for this prop. Height, width, and\npadding should be specified via the height, width, and padding props.\n\n\n@example {data: {stroke: \"black\"}, label: {fontSize: 10}}"
|
|
527
|
+
},
|
|
528
|
+
{
|
|
529
|
+
"name": "subTitle",
|
|
530
|
+
"type": "string",
|
|
531
|
+
"description": "The subtitle for the donut chart"
|
|
532
|
+
},
|
|
533
|
+
{
|
|
534
|
+
"name": "subTitleComponent",
|
|
535
|
+
"type": "React.ReactElement<any>",
|
|
536
|
+
"description": "The label component to render the chart subTitle.\n\nWhen overriding the subTitleComponent prop, title and subTitle will be centered independently. You may choose to\nuse the x and y props of ChartLabel to adjust the center position. For example:\n\n<pre>\nsubTitle=\"Pets\"\nsubTitleComponent={<ChartLabel y={130} />}\ntitle={100}\ntitleComponent={<ChartLabel y={107} />}\n</pre>\n\nNote: Default label properties may be applied"
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
"name": "subTitlePosition",
|
|
540
|
+
"type": "'bottom' | 'center' | 'right'",
|
|
541
|
+
"description": "The orientation of the subtitle position. Valid values are 'bottom', 'center', and 'right'"
|
|
542
|
+
},
|
|
543
|
+
{
|
|
544
|
+
"name": "theme",
|
|
545
|
+
"type": "object",
|
|
546
|
+
"description": "The theme prop takes a style object with nested data, labels, and parent objects.\nYou can create this object yourself, or you can use a theme provided by\nWhen using ChartPie as a solo component, implement the theme directly on\nChartPie. If you are wrapping ChartPie in ChartChart or ChartGroup,\nplease call the theme on the outermost wrapper component instead.",
|
|
547
|
+
"defaultValue": "getDonutUtilizationTheme(themeColor)"
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
"name": "themeColor",
|
|
551
|
+
"type": "string",
|
|
552
|
+
"description": "Specifies the theme color. Valid values are 'blue', 'green', 'multi', etc.\n\nNote: Not compatible with theme prop\n\n@example themeColor={ChartThemeColor.blue}"
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
"name": "thresholds",
|
|
556
|
+
"type": "any[]",
|
|
557
|
+
"description": "The dynamic portion of the chart will change colors when data reaches the given threshold. Colors may be\noverridden, but defaults shall be provided.\n\n@example thresholds={[{ value: 60, color: '#F0AB00' }, { value: 90, color: '#C9190B' }]}"
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
"name": "title",
|
|
561
|
+
"type": "string",
|
|
562
|
+
"description": "The title for the donut chart"
|
|
563
|
+
},
|
|
564
|
+
{
|
|
565
|
+
"name": "titleComponent",
|
|
566
|
+
"type": "React.ReactElement<any>",
|
|
567
|
+
"description": "The label component to render the chart title.\n\nWhen centering both title and subTitle props, it's possible to override both styles via an array provided to\nChartLabel. The first item in the array is associated with title styles, while the second item in the array is\nassociated with subtitle styles.\n\n<pre>\nsubTitle=\"Pets\"\ntitle={100}\ntitleComponent={\n <ChartLabel style={[{\n fill: 'red', // title color\n fontSize: 24\n }, {\n fill: 'blue', // subtitle color\n fontSize: 14\n }]}\n />\n}\n</pre>\n\nIn this case, both title and subTitle will be centered together. However, should you also override the\nsubTitleComponent prop, title and subTitle will be centered independently. You may choose to\nuse the x and y props of ChartLabel to adjust the center position. For example:\n\n<pre>\nsubTitle=\"Pets\"\nsubTitleComponent={<ChartLabel y={130} />}\ntitle={100}\ntitleComponent={<ChartLabel y={107} />}\n</pre>\n\nNote: Default label properties may be applied"
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
"name": "width",
|
|
571
|
+
"type": "number",
|
|
572
|
+
"description": "Specifies the width of the svg viewBox of the chart container. This value should be given as a number of pixels.\n\nBecause Victory renders responsive containers, the width and height props do not determine the width and\nheight of the chart in number of pixels, but instead define an aspect ratio for the chart. The exact number of\npixels will depend on the size of the container the chart is rendered into. Typically, the parent container is set\nto the same width in order to maintain the aspect ratio.",
|
|
573
|
+
"defaultValue": "theme.pie.width"
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
"name": "x",
|
|
577
|
+
"type": "number | string | Function | string[]",
|
|
578
|
+
"description": "The x prop specifies how to access the X value of each data point.\nIf given as a function, it will be run on each data point, and returned value will be used.\nIf given as an integer, it will be used as an array index for array-type data points.\nIf given as a string, it will be used as a property key for object-type data points.\nIf given as an array of strings, or a string containing dots or brackets,\nit will be used as a nested object property path (for details see Lodash docs for _.get).\nIf `null` or `undefined`, the data value will be used as is (identity function/pass-through).\n\n\n@example 0, 'x', 'x.value.nested.1.thing', 'x[2].also.nested', null, d => Math.sin(d)"
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
"name": "y",
|
|
582
|
+
"type": "number | string | Function | string[]",
|
|
583
|
+
"description": "The y prop specifies how to access the Y value of each data point.\nIf given as a function, it will be run on each data point, and returned value will be used.\nIf given as an integer, it will be used as an array index for array-type data points.\nIf given as a string, it will be used as a property key for object-type data points.\nIf given as an array of strings, or a string containing dots or brackets,\nit will be used as a nested object property path (for details see Lodash docs for _.get).\nIf `null` or `undefined`, the data value will be used as is (identity function/pass-through).\n\n\n@example 0, 'y', 'y.value.nested.1.thing', 'y[2].also.nested', null, d => Math.sin(d)"
|
|
584
|
+
}
|
|
585
|
+
]
|
|
586
|
+
}
|
|
587
|
+
],
|
|
588
|
+
"examples": [
|
|
589
|
+
"Basic",
|
|
590
|
+
"Right aligned legend",
|
|
591
|
+
"Inverted with right aligned legend",
|
|
592
|
+
"Right aligned vertical legend",
|
|
593
|
+
"Bottom aligned legend",
|
|
594
|
+
"Small",
|
|
595
|
+
"Small with right aligned legend",
|
|
596
|
+
"Small with bottom aligned subtitle",
|
|
597
|
+
"Small with right aligned subtitle",
|
|
598
|
+
"Static thresholds",
|
|
599
|
+
"Static thresholds with right aligned legend",
|
|
600
|
+
"Inverted static thresholds with right aligned legend",
|
|
601
|
+
"Static thresholds with custom legend",
|
|
602
|
+
"Static thresholds with bottom aligned legend",
|
|
603
|
+
"Small with static thresholds",
|
|
604
|
+
"Small with static thresholds and right aligned legend",
|
|
605
|
+
"Small with subtitle",
|
|
606
|
+
"Small with thresholds and right aligned subtitle"
|
|
607
|
+
]
|
|
608
|
+
};
|
|
609
|
+
pageData.liveContext = {
|
|
610
|
+
ChartDonutThreshold,
|
|
611
|
+
ChartDonutUtilization,
|
|
612
|
+
ChartThemeColor,
|
|
613
|
+
useEffect,
|
|
614
|
+
useState
|
|
615
|
+
};
|
|
616
|
+
pageData.examples = {
|
|
617
|
+
'Basic': props =>
|
|
618
|
+
<Example {...pageData} {...props} {...{"code":"import { ChartDonutUtilization } from '@patternfly/react-charts/victory';\n\ninterface UsageData {\n x: string;\n y: number;\n}\n\nexport const ChartUtilBasic: React.FunctionComponent = () => {\n const data: UsageData = { x: 'GBps capacity', y: 75 };\n\n return (\n <div style={{ height: '230px', width: '230px' }}>\n <ChartDonutUtilization\n ariaDesc=\"Storage capacity\"\n ariaTitle=\"Donut utilization chart example\"\n constrainToVisibleArea\n data={data}\n labels={({ datum }) => (datum.x ? `${datum.x}: ${datum.y}%` : null)}\n name=\"chart1\"\n subTitle=\"of 100 GBps\"\n title=\"75%\"\n />\n </div>\n );\n};\n","title":"Basic","lang":"ts","className":""}}>
|
|
619
|
+
|
|
620
|
+
</Example>,
|
|
621
|
+
'Right aligned legend': props =>
|
|
622
|
+
<Example {...pageData} {...props} {...{"code":"import { ChartDonutUtilization } from '@patternfly/react-charts/victory';\nimport { useEffect, useState } from 'react';\n\ninterface UsageData {\n x?: string;\n y?: number;\n name?: string;\n}\n\nexport const ChartUtilRightAlignedLegend: React.FunctionComponent = () => {\n const [spacer, setSpacer] = useState('');\n const [used, setUsed] = useState(0);\n\n useEffect(() => {\n const interval = setInterval(() => {\n setUsed((prevUsed) => {\n const val = (prevUsed + 10) % 100;\n setSpacer(val < 10 ? ' ' : '');\n return val;\n });\n }, 1000);\n\n return () => clearInterval(interval);\n }, []);\n\n const data: UsageData = { x: 'GBps capacity', y: used };\n const legendData: UsageData[] = [{ name: `Storage capacity: ${spacer}${used}%` }, { name: 'Unused' }];\n\n return (\n <div style={{ height: '230px', width: '435px' }}>\n <ChartDonutUtilization\n ariaDesc=\"Storage capacity\"\n ariaTitle=\"Donut utilization chart example\"\n constrainToVisibleArea\n data={data}\n labels={({ datum }) => (datum.x ? `${datum.x}: ${datum.y}%` : null)}\n legendData={legendData}\n legendOrientation=\"vertical\"\n name=\"chart2\"\n padding={{\n bottom: 20,\n left: 20,\n right: 225, // Adjusted to accommodate legend\n top: 20\n }}\n subTitle=\"of 100 GBps\"\n title={`${used}%`}\n thresholds={[{ value: 60 }, { value: 90 }]}\n width={435}\n />\n </div>\n );\n};\n","title":"Right aligned legend","lang":"ts","className":""}}>
|
|
623
|
+
|
|
624
|
+
</Example>,
|
|
625
|
+
'Inverted with right aligned legend': props =>
|
|
626
|
+
<Example {...pageData} {...props} {...{"code":"import { ChartDonutUtilization } from '@patternfly/react-charts/victory';\nimport { useEffect, useState } from 'react';\n\ninterface UsageData {\n x?: string;\n y?: number;\n name?: string;\n}\n\nexport const ChartUtilInvertedRightLegend: React.FunctionComponent = () => {\n const [spacer, setSpacer] = useState('');\n const [used, setUsed] = useState(0);\n\n useEffect(() => {\n const interval = setInterval(() => {\n setUsed((prevUsed) => {\n const val = (((prevUsed - 10) % 100) + 100) % 100;\n setSpacer(val < 10 ? ' ' : '');\n return val;\n });\n }, 1000);\n\n return () => clearInterval(interval);\n }, []);\n\n const data: UsageData = { x: 'GBps capacity', y: used };\n const legendData: UsageData[] = [{ name: `Storage capacity: ${spacer}${used}%` }, { name: 'Unused' }];\n\n return (\n <div style={{ height: '230px', width: '435px' }}>\n <ChartDonutUtilization\n ariaDesc=\"Storage capacity\"\n ariaTitle=\"Donut utilization chart example\"\n constrainToVisibleArea\n data={data}\n invert\n labels={({ datum }) => (datum.x ? `${datum.x}: ${datum.y}%` : null)}\n legendData={legendData}\n legendOrientation=\"vertical\"\n name=\"chart3\"\n padding={{\n bottom: 20,\n left: 20,\n right: 225, // Adjusted to accommodate legend\n top: 20\n }}\n subTitle=\"of 100 GBps\"\n title={`${used}%`}\n thresholds={[{ value: 60 }, { value: 20 }]}\n width={435}\n />\n </div>\n );\n};\n","title":"Inverted with right aligned legend","lang":"ts","className":""}}>
|
|
627
|
+
|
|
628
|
+
</Example>,
|
|
629
|
+
'Right aligned vertical legend': props =>
|
|
630
|
+
<Example {...pageData} {...props} {...{"code":"import { ChartDonutUtilization, ChartThemeColor } from '@patternfly/react-charts/victory';\nimport { useEffect, useState } from 'react';\n\ninterface UsageData {\n x?: string;\n y?: number;\n name?: string;\n}\n\nexport const ChartUtilRightVerticalLegend: React.FunctionComponent = () => {\n const [spacer, setSpacer] = useState('');\n const [used, setUsed] = useState(0);\n\n useEffect(() => {\n const interval = setInterval(() => {\n setUsed((prevUsed) => {\n const val = (prevUsed + 10) % 100;\n setSpacer(val < 10 ? ' ' : '');\n return val;\n });\n }, 1000);\n\n return () => clearInterval(interval);\n }, []);\n\n const data: UsageData = { x: 'Storage capacity', y: used };\n const legendData: UsageData[] = [{ name: `Storage capacity: ${spacer}${used}%` }, { name: 'Unused' }];\n\n return (\n <div style={{ height: '300px', width: '230px' }}>\n <ChartDonutUtilization\n ariaDesc=\"Storage capacity\"\n ariaTitle=\"Donut utilization chart example\"\n constrainToVisibleArea\n data={data}\n height={300}\n labels={({ datum }) => (datum.x ? `${datum.x}: ${datum.y}%` : null)}\n legendData={legendData}\n legendOrientation=\"vertical\"\n legendPosition=\"bottom\"\n name=\"chart4\"\n padding={{\n bottom: 75, // Adjusted to accommodate legend\n left: 20,\n right: 20,\n top: 20\n }}\n subTitle=\"of 100 GBps\"\n title={`${used}%`}\n themeColor={ChartThemeColor.green}\n thresholds={[{ value: 60 }, { value: 90 }]}\n width={230}\n />\n </div>\n );\n};\n","title":"Right aligned vertical legend","lang":"ts","className":""}}>
|
|
631
|
+
|
|
632
|
+
</Example>,
|
|
633
|
+
'Bottom aligned legend': props =>
|
|
634
|
+
<Example {...pageData} {...props} {...{"code":"import { ChartDonutUtilization } from '@patternfly/react-charts/victory';\n\ninterface UsageData {\n x?: string;\n y?: number;\n name?: string;\n}\n\nexport const ChartUtilBottomAlignedLegend: React.FunctionComponent = () => {\n const data: UsageData = { x: 'Storage capacity', y: 45 };\n const legendData: UsageData[] = [{ name: `Storage capacity: 45%` }, { name: 'Unused' }];\n\n return (\n <div style={{ height: '275px', width: '300px' }}>\n <ChartDonutUtilization\n ariaDesc=\"Storage capacity\"\n ariaTitle=\"Donut utilization chart example\"\n constrainToVisibleArea\n data={data}\n height={275}\n labels={({ datum }) => (datum.x ? `${datum.x}: ${datum.y}%` : null)}\n legendData={legendData}\n legendPosition=\"bottom\"\n name=\"chart5\"\n padding={{\n bottom: 65, // Adjusted to accommodate legend\n left: 20,\n right: 20,\n top: 20\n }}\n subTitle=\"of 100 GBps\"\n title=\"45%\"\n thresholds={[{ value: 60 }, { value: 90 }]}\n width={300}\n />\n </div>\n );\n};\n","title":"Bottom aligned legend","lang":"ts","className":""}}>
|
|
635
|
+
|
|
636
|
+
</Example>,
|
|
637
|
+
'Small': props =>
|
|
638
|
+
<Example {...pageData} {...props} {...{"code":"import { ChartDonutUtilization } from '@patternfly/react-charts/victory';\n\ninterface UsageData {\n x: string;\n y: number;\n}\n\nexport const ChartUtilSmall: React.FunctionComponent = () => {\n const data: UsageData = { x: 'Storage capacity', y: 75 };\n return (\n <div style={{ height: '175px', width: '175px' }}>\n <ChartDonutUtilization\n ariaDesc=\"Storage capacity\"\n ariaTitle=\"Donut utilization chart example\"\n constrainToVisibleArea\n data={data}\n height={175}\n labels={({ datum }) => (datum.x ? `${datum.x}: ${datum.y}%` : null)}\n name=\"chart6\"\n subTitle=\"of 100 GBps\"\n title=\"75%\"\n width={175}\n />\n </div>\n );\n};\n","title":"Small","lang":"ts","className":""}}>
|
|
639
|
+
|
|
640
|
+
</Example>,
|
|
641
|
+
'Small with right aligned legend': props =>
|
|
642
|
+
<Example {...pageData} {...props} {...{"code":"import { ChartDonutUtilization } from '@patternfly/react-charts/victory';\nimport { useEffect, useState } from 'react';\n\ninterface UsageData {\n x?: string;\n y?: number;\n name?: string;\n}\n\nexport const ChartUtilSmallRightLegend: React.FunctionComponent = () => {\n const [spacer, setSpacer] = useState('');\n const [used, setUsed] = useState(0);\n\n useEffect(() => {\n const interval = setInterval(() => {\n setUsed((prevUsed) => {\n const val = (prevUsed + 10) % 100;\n setSpacer(val < 10 ? ' ' : '');\n return val;\n });\n }, 1000);\n\n return () => clearInterval(interval);\n }, []);\n\n const data: UsageData = { x: 'Storage capacity', y: used };\n const legendData: UsageData[] = [{ name: `Storage capacity: ${spacer}${used}%` }, { name: 'Unused' }];\n\n return (\n <div style={{ width: '350px', height: '175px' }}>\n <ChartDonutUtilization\n ariaDesc=\"Storage capacity\"\n ariaTitle=\"Donut utilization chart example\"\n constrainToVisibleArea\n data={data}\n height={175}\n labels={({ datum }) => (datum.x ? `${datum.x}: ${datum.y}%` : null)}\n legendData={legendData}\n legendOrientation=\"vertical\"\n name=\"chart7\"\n padding={{\n bottom: 20,\n left: 20,\n right: 195, // Adjusted to accommodate legend\n top: 20\n }}\n subTitle=\"of 100 GBps\"\n title={`${used}%`}\n thresholds={[{ value: 60 }, { value: 90 }]}\n width={350}\n />\n </div>\n );\n};\n","title":"Small with right aligned legend","lang":"ts","className":""}}>
|
|
643
|
+
|
|
644
|
+
</Example>,
|
|
645
|
+
'Small with bottom aligned subtitle': props =>
|
|
646
|
+
<Example {...pageData} {...props} {...{"code":"import { ChartDonutUtilization } from '@patternfly/react-charts/victory';\n\ninterface UsageData {\n x?: string;\n y?: number;\n name?: string;\n}\n\nexport const ChartUtilSmallBottomSubtitle: React.FunctionComponent = () => {\n const data: UsageData = { x: 'Storage capacity', y: 45 };\n const legendData: UsageData[] = [{ name: `Storage capacity: 45%` }, { name: 'Unused' }];\n\n return (\n <div style={{ height: '185px', width: '350px' }}>\n <ChartDonutUtilization\n ariaDesc=\"Storage capacity\"\n ariaTitle=\"Donut utilization chart example\"\n constrainToVisibleArea\n data={data}\n height={185}\n labels={({ datum }) => (datum.x ? `${datum.x}: ${datum.y}%` : null)}\n legendData={legendData}\n legendOrientation=\"vertical\"\n name=\"chart8\"\n padding={{\n bottom: 25, // Adjusted to accommodate subTitle\n left: 20,\n right: 195, // Adjusted to accommodate legend\n top: 20\n }}\n subTitle=\"of 100 GBps\"\n subTitlePosition=\"bottom\"\n title=\"45%\"\n thresholds={[{ value: 60 }, { value: 90 }]}\n width={350}\n />\n </div>\n );\n};\n","title":"Small with bottom aligned subtitle","lang":"ts","className":""}}>
|
|
647
|
+
|
|
648
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
649
|
+
{`This is a small donut utilization chart with bottom aligned legend and right aligned subtitle.`}
|
|
650
|
+
</p>
|
|
651
|
+
</Example>,
|
|
652
|
+
'Small with right aligned subtitle': props =>
|
|
653
|
+
<Example {...pageData} {...props} {...{"code":"import { ChartDonutUtilization } from '@patternfly/react-charts/victory';\n\ninterface UsageData {\n x?: string;\n y?: number;\n name?: string;\n}\n\nexport const ChartUtilSmallRightSubtitle: React.FunctionComponent = () => {\n const data: UsageData = { x: 'Storage capacity', y: 45 };\n const legendData: UsageData[] = [{ name: `Storage capacity: 45%` }, { name: 'Unused' }];\n\n return (\n <div style={{ height: '200px', width: '350px' }}>\n <ChartDonutUtilization\n ariaDesc=\"Storage capacity\"\n ariaTitle=\"Donut utilization chart example\"\n constrainToVisibleArea\n data={data}\n height={200}\n labels={({ datum }) => (datum.x ? `${datum.x}: ${datum.y}%` : null)}\n legendData={legendData}\n legendPosition=\"bottom\"\n name=\"chart9\"\n padding={{\n bottom: 45, // Adjusted to accommodate legend\n left: 20,\n right: 20,\n top: 20\n }}\n subTitle=\"of 100 GBps\"\n subTitlePosition=\"right\"\n title=\"45%\"\n thresholds={[{ value: 60 }, { value: 90 }]}\n width={350}\n />\n </div>\n );\n};\n","title":"Small with right aligned subtitle","lang":"ts","className":""}}>
|
|
654
|
+
|
|
655
|
+
</Example>,
|
|
656
|
+
'Static thresholds': props =>
|
|
657
|
+
<Example {...pageData} {...props} {...{"code":"import { ChartDonutThreshold, ChartDonutUtilization } from '@patternfly/react-charts/victory';\n\ninterface UsageData {\n x: string;\n y: number;\n}\n\nexport const ChartUtilStatic: React.FunctionComponent = () => {\n const dataThreshold: UsageData[] = [\n { x: 'Warning at 60%', y: 60 },\n { x: 'Danger at 90%', y: 90 }\n ];\n const dataUtil: UsageData = { x: 'Storage capacity', y: 45 };\n\n return (\n <div style={{ height: '230px', width: '230px' }}>\n <ChartDonutThreshold\n ariaDesc=\"Storage capacity\"\n ariaTitle=\"Donut utilization chart with static threshold example\"\n constrainToVisibleArea\n data={dataThreshold}\n labels={({ datum }) => (datum.x ? datum.x : null)}\n name=\"chart10\"\n >\n <ChartDonutUtilization\n data={dataUtil}\n labels={({ datum }) => (datum.x ? `${datum.x}: ${datum.y}%` : null)}\n subTitle=\"of 100 GBps\"\n title=\"45%\"\n />\n </ChartDonutThreshold>\n </div>\n );\n};\n","title":"Static thresholds","lang":"ts","className":""}}>
|
|
658
|
+
|
|
659
|
+
</Example>,
|
|
660
|
+
'Static thresholds with right aligned legend': props =>
|
|
661
|
+
<Example {...pageData} {...props} {...{"code":"import { ChartDonutThreshold, ChartDonutUtilization } from '@patternfly/react-charts/victory';\nimport { useEffect, useState } from 'react';\n\ninterface UsageData {\n x?: string;\n y?: number;\n name?: string;\n}\n\nexport const ChartUtilStaticRightLegend: React.FunctionComponent = () => {\n const [used, setUsed] = useState(0);\n\n useEffect(() => {\n const interval = setInterval(() => {\n setUsed((prevUsed) => {\n const val = (prevUsed + 10) % 100;\n return val;\n });\n }, 1000);\n\n return () => clearInterval(interval);\n }, []);\n\n const dataThreshold: UsageData[] = [\n { x: 'Warning at 60%', y: 60 },\n { x: 'Danger at 90%', y: 90 }\n ];\n const dataUtil: UsageData = { x: 'Storage capacity', y: used };\n const legendData: UsageData[] = [\n { name: `Storage capacity: ${used}%` },\n { name: 'Warning threshold at 60%' },\n { name: 'Danger threshold at 90%' }\n ];\n\n return (\n <div style={{ height: '230px', width: '500px' }}>\n <ChartDonutThreshold\n ariaDesc=\"Storage capacity\"\n ariaTitle=\"Donut utilization chart with static threshold example\"\n constrainToVisibleArea\n data={dataThreshold}\n labels={({ datum }) => (datum.x ? datum.x : null)}\n name=\"chart11\"\n padding={{\n bottom: 20,\n left: 20,\n right: 290, // Adjusted to accommodate legend\n top: 20\n }}\n width={500}\n >\n <ChartDonutUtilization\n data={dataUtil}\n labels={({ datum }) => (datum.x ? `${datum.x}: ${datum.y}%` : null)}\n legendData={legendData}\n legendOrientation=\"vertical\"\n subTitle=\"of 100 GBps\"\n title={`${used}%`}\n thresholds={[{ value: 60 }, { value: 90 }]}\n />\n </ChartDonutThreshold>\n </div>\n );\n};\n","title":"Static thresholds with right aligned legend","lang":"ts","className":""}}>
|
|
662
|
+
|
|
663
|
+
</Example>,
|
|
664
|
+
'Inverted static thresholds with right aligned legend': props =>
|
|
665
|
+
<Example {...pageData} {...props} {...{"code":"import { ChartDonutThreshold, ChartDonutUtilization } from '@patternfly/react-charts/victory';\nimport { useEffect, useState } from 'react';\n\ninterface UsageData {\n x?: string;\n y?: number;\n name?: string;\n}\n\nexport const ChartUtilInvertedStatic: React.FunctionComponent = () => {\n const [used, setUsed] = useState(100);\n\n useEffect(() => {\n const interval = setInterval(() => {\n setUsed((prevUsed) => {\n const val = (prevUsed - 10 + 100) % 100;\n return val;\n });\n }, 1000);\n\n return () => clearInterval(interval);\n }, []);\n\n const dataThreshold: UsageData[] = [\n { x: 'Warning at 60%', y: 60 },\n { x: 'Danger at 20%', y: 20 }\n ];\n const dataUtil: UsageData = { x: 'Storage capacity', y: used };\n const legendData: UsageData[] = [\n { name: `Storage capacity: ${used}%` },\n { name: 'Warning threshold at 60%' },\n { name: 'Danger threshold at 20%' }\n ];\n\n return (\n <div style={{ height: '230px', width: '500px' }}>\n <ChartDonutThreshold\n ariaDesc=\"Storage capacity\"\n ariaTitle=\"Donut utilization chart with static threshold example\"\n constrainToVisibleArea\n data={dataThreshold}\n invert\n labels={({ datum }) => (datum.x ? datum.x : null)}\n name=\"chart12\"\n padding={{\n bottom: 20,\n left: 20,\n right: 290, // Adjusted to accommodate legend\n top: 20\n }}\n width={500}\n >\n <ChartDonutUtilization\n data={dataUtil}\n labels={({ datum }) => (datum.x ? `${datum.x}: ${datum.y}%` : null)}\n legendData={legendData}\n legendOrientation=\"vertical\"\n subTitle=\"of 100 GBps\"\n title={`${used}%`}\n thresholds={[{ value: 60 }, { value: 20 }]}\n />\n </ChartDonutThreshold>\n </div>\n );\n};\n","title":"Inverted static thresholds with right aligned legend","lang":"ts","className":""}}>
|
|
666
|
+
|
|
667
|
+
</Example>,
|
|
668
|
+
'Static thresholds with custom legend': props =>
|
|
669
|
+
<Example {...pageData} {...props} {...{"code":"import { ChartDonutThreshold, ChartDonutUtilization, ChartThemeColor } from '@patternfly/react-charts/victory';\nimport { useEffect, useState } from 'react';\n\ninterface UsageData {\n x?: string;\n y?: number;\n name?: string;\n}\n\nexport const ChartUtilStaticCustomLegend: React.FunctionComponent = () => {\n const [used, setUsed] = useState(0);\n\n useEffect(() => {\n const interval = setInterval(() => {\n setUsed((prevUsed) => {\n const val = (prevUsed + 10) % 100;\n return val;\n });\n }, 1000);\n\n return () => clearInterval(interval);\n }, []);\n\n const dataThreshold: UsageData[] = [\n { x: 'Warning at 60%', y: 60 },\n { x: 'Danger at 90%', y: 90 }\n ];\n const dataUtil: UsageData = { x: 'Storage capacity', y: used };\n const legendData: UsageData[] = [\n { name: `Storage capacity: ${used}%` },\n { name: 'Warning threshold at 60%' },\n { name: 'Danger threshold at 90%' }\n ];\n\n return (\n <div style={{ height: '350px', width: '230px' }}>\n <ChartDonutThreshold\n ariaDesc=\"Storage capacity\"\n ariaTitle=\"Donut utilization chart with static threshold example\"\n constrainToVisibleArea\n data={dataThreshold}\n height={350}\n labels={({ datum }) => (datum.x ? datum.x : null)}\n name=\"chart13\"\n padding={{\n bottom: 125, // Adjusted to accommodate legend\n left: 20,\n right: 20,\n top: 20\n }}\n width={230}\n >\n <ChartDonutUtilization\n data={dataUtil}\n labels={({ datum }) => (datum.x ? `${datum.x}: ${datum.y}%` : null)}\n legendData={legendData}\n legendOrientation=\"vertical\"\n legendPosition=\"bottom\"\n subTitle=\"of 100 GBps\"\n title={`${used}%`}\n themeColor={ChartThemeColor.green}\n thresholds={[{ value: 60 }, { value: 90 }]}\n />\n </ChartDonutThreshold>\n </div>\n );\n};\n","title":"Static thresholds with custom legend","lang":"ts","className":""}}>
|
|
670
|
+
|
|
671
|
+
</Example>,
|
|
672
|
+
'Static thresholds with bottom aligned legend': props =>
|
|
673
|
+
<Example {...pageData} {...props} {...{"code":"import { ChartDonutThreshold, ChartDonutUtilization } from '@patternfly/react-charts/victory';\n\ninterface UsageData {\n x?: string;\n y?: number;\n name?: string;\n}\n\nexport const ChartUtilStaticBottomLegend: React.FunctionComponent = () => {\n const dataThreshold: UsageData[] = [\n { x: 'Warning at 60%', y: 60 },\n { x: 'Danger at 90%', y: 90 }\n ];\n const dataUtil: UsageData = { x: 'Storage capacity', y: 45 };\n const legendData: UsageData[] = [\n { name: `Storage capacity: 45%` },\n { name: 'Warning threshold at 60%' },\n { name: 'Danger threshold at 90%' }\n ];\n\n return (\n <div style={{ height: '275px', width: '675px' }}>\n <ChartDonutThreshold\n ariaDesc=\"Storage capacity\"\n ariaTitle=\"Donut utilization chart with static threshold example\"\n constrainToVisibleArea\n data={dataThreshold}\n height={275}\n labels={({ datum }) => (datum.x ? datum.x : null)}\n name=\"chart14\"\n padding={{\n bottom: 65, // Adjusted to accommodate legend\n left: 20,\n right: 20,\n top: 20\n }}\n width={675}\n >\n <ChartDonutUtilization\n data={dataUtil}\n labels={({ datum }) => (datum.x ? `${datum.x}: ${datum.y}%` : null)}\n legendData={legendData}\n legendPosition=\"bottom\"\n subTitle=\"of 100 GBps\"\n title=\"45%\"\n />\n </ChartDonutThreshold>\n </div>\n );\n};\n","title":"Static thresholds with bottom aligned legend","lang":"ts","className":""}}>
|
|
674
|
+
|
|
675
|
+
</Example>,
|
|
676
|
+
'Small with static thresholds': props =>
|
|
677
|
+
<Example {...pageData} {...props} {...{"code":"import { ChartDonutThreshold, ChartDonutUtilization } from '@patternfly/react-charts/victory';\n\ninterface UsageData {\n x: string;\n y: number;\n}\n\nexport const ChartUtilSmallStatic: React.FunctionComponent = () => {\n const dataThreshold: UsageData[] = [\n { x: 'Warning at 60%', y: 60 },\n { x: 'Danger at 90%', y: 90 }\n ];\n const dataUtil: UsageData = { x: 'Storage capacity', y: 45 };\n\n return (\n <div style={{ height: '185px', width: '185px' }}>\n <ChartDonutThreshold\n ariaDesc=\"Storage capacity\"\n ariaTitle=\"Donut utilization chart with static threshold example\"\n constrainToVisibleArea\n data={dataThreshold}\n height={185}\n labels={({ datum }) => (datum.x ? datum.x : null)}\n name=\"chart15\"\n width={185}\n >\n <ChartDonutUtilization\n data={dataUtil}\n labels={({ datum }) => (datum.x ? `${datum.x}: ${datum.y}%` : null)}\n subTitle=\"of 100 GBps\"\n title=\"45%\"\n />\n </ChartDonutThreshold>\n </div>\n );\n};\n","title":"Small with static thresholds","lang":"ts","className":""}}>
|
|
678
|
+
|
|
679
|
+
</Example>,
|
|
680
|
+
'Small with static thresholds and right aligned legend': props =>
|
|
681
|
+
<Example {...pageData} {...props} {...{"code":"import { ChartDonutThreshold, ChartDonutUtilization } from '@patternfly/react-charts/victory';\nimport { useEffect, useState } from 'react';\n\ninterface UsageData {\n x?: string;\n y?: number;\n name?: string;\n}\n\nexport const ChartUtilSmallStaticRightLegend: React.FunctionComponent = () => {\n const [used, setUsed] = useState(0);\n\n useEffect(() => {\n const interval = setInterval(() => {\n setUsed((prevUsed) => {\n const val = (prevUsed + 10) % 100;\n return val;\n });\n }, 1000);\n\n return () => clearInterval(interval);\n }, []);\n\n const dataThreshold: UsageData[] = [\n { x: 'Warning at 60%', y: 60 },\n { x: 'Danger at 90%', y: 90 }\n ];\n const dataUtil: UsageData = { x: 'Storage capacity', y: used };\n const legendData: UsageData[] = [\n { name: `Storage capacity: ${used}%` },\n { name: 'Warning threshold at 60%' },\n { name: 'Danger threshold at 90%' }\n ];\n\n return (\n <div style={{ height: '185px', width: '425px' }}>\n <ChartDonutThreshold\n ariaDesc=\"Storage capacity\"\n ariaTitle=\"Donut utilization chart with static threshold example\"\n constrainToVisibleArea\n data={dataThreshold}\n height={185}\n labels={({ datum }) => (datum.x ? datum.x : null)}\n name=\"chart16\"\n padding={{\n bottom: 20,\n left: 20,\n right: 260, // Adjusted to accommodate legend\n top: 20\n }}\n width={425}\n >\n <ChartDonutUtilization\n data={dataUtil}\n labels={({ datum }) => (datum.x ? `${datum.x}: ${datum.y}%` : null)}\n legendData={legendData}\n legendOrientation=\"vertical\"\n subTitle=\"of 100 GBps\"\n title={`${used}%`}\n thresholds={[{ value: 60 }, { value: 90 }]}\n />\n </ChartDonutThreshold>\n </div>\n );\n};\n","title":"Small with static thresholds and right aligned legend","lang":"ts","className":""}}>
|
|
682
|
+
|
|
683
|
+
</Example>,
|
|
684
|
+
'Small with subtitle': props =>
|
|
685
|
+
<Example {...pageData} {...props} {...{"code":"import { ChartDonutThreshold, ChartDonutUtilization } from '@patternfly/react-charts/victory';\n\ninterface UsageData {\n x?: string;\n y?: number;\n name?: string;\n}\n\nexport const ChartUtilSmallSubtitle: React.FunctionComponent = () => {\n const dataThreshold: UsageData[] = [\n { x: 'Warning at 60%', y: 60 },\n { x: 'Danger at 90%', y: 90 }\n ];\n const dataUtil: UsageData = { x: 'Storage capacity', y: 45 };\n const legendData: UsageData[] = [\n { name: `Storage capacity: 45%` },\n { name: 'Warning threshold at 60%' },\n { name: 'Danger threshold at 90%' }\n ];\n\n return (\n <div style={{ height: '200px', width: '425px' }}>\n <ChartDonutThreshold\n ariaDesc=\"Storage capacity\"\n ariaTitle=\"Donut utilization chart with static threshold example\"\n constrainToVisibleArea\n data={dataThreshold}\n height={200}\n labels={({ datum }) => (datum.x ? datum.x : null)}\n name=\"chart17\"\n padding={{\n bottom: 30, // Adjusted to accommodate label\n left: 20,\n right: 260, // Adjusted to accommodate legend\n top: 20\n }}\n subTitlePosition=\"bottom\"\n width={425}\n >\n <ChartDonutUtilization\n data={dataUtil}\n labels={({ datum }) => (datum.x ? `${datum.x}: ${datum.y}%` : null)}\n legendData={legendData}\n legendOrientation=\"vertical\"\n subTitle=\"of 100 GBps\"\n title=\"45%\"\n thresholds={[{ value: 60 }, { value: 90 }]}\n />\n </ChartDonutThreshold>\n </div>\n );\n};\n","title":"Small with subtitle","lang":"ts","className":""}}>
|
|
686
|
+
|
|
687
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
688
|
+
{`This is a small donut utilization chart with static thresholds with right aligned legend and bottom aligned subtitle.`}
|
|
689
|
+
</p>
|
|
690
|
+
</Example>,
|
|
691
|
+
'Small with thresholds and right aligned subtitle': props =>
|
|
692
|
+
<Example {...pageData} {...props} {...{"code":"import { ChartDonutThreshold, ChartDonutUtilization } from '@patternfly/react-charts/victory';\n\ninterface UsageData {\n x?: string;\n y?: number;\n name?: string;\n}\n\nexport const ChartUtilSmallRightAlignedSubtitle: React.FunctionComponent = () => {\n const dataThreshold: UsageData[] = [\n { x: 'Warning at 60%', y: 60 },\n { x: 'Danger at 90%', y: 90 }\n ];\n const dataUtil: UsageData = { x: 'Storage capacity', y: 45 };\n const legendData: UsageData[] = [\n { name: `Storage capacity: 45%` },\n { name: 'Warning threshold at 60%' },\n { name: 'Danger threshold at 90%' }\n ];\n\n return (\n <div style={{ height: '225px', width: '675px' }}>\n <ChartDonutThreshold\n ariaDesc=\"Storage capacity\"\n ariaTitle=\"Donut utilization chart with static threshold example\"\n constrainToVisibleArea\n data={dataThreshold}\n height={225}\n labels={({ datum }) => (datum.x ? datum.x : null)}\n name=\"chart18\"\n padding={{\n bottom: 60, // Adjusted to accommodate legend\n left: 20,\n right: 20,\n top: 20\n }}\n subTitlePosition=\"right\"\n width={675}\n >\n <ChartDonutUtilization\n data={dataUtil}\n labels={({ datum }) => (datum.x ? `${datum.x}: ${datum.y}%` : null)}\n legendData={legendData}\n legendPosition=\"bottom\"\n subTitle=\"of 100 GBps\"\n title=\"45%\"\n thresholds={[{ value: 60 }, { value: 90 }]}\n />\n </ChartDonutThreshold>\n </div>\n );\n};\n","title":"Small with thresholds and right aligned subtitle","lang":"ts","className":""}}>
|
|
693
|
+
|
|
694
|
+
</Example>
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
const Component = () => (
|
|
698
|
+
<React.Fragment>
|
|
699
|
+
<AutoLinkHeader {...{"id":"introduction","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
700
|
+
{`Introduction`}
|
|
701
|
+
</AutoLinkHeader>
|
|
702
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
703
|
+
{`Note: PatternFly React charts live in its own package at `}
|
|
704
|
+
<PatternflyThemeLink {...{"to":"https://www.npmjs.com/package/@patternfly/react-charts","className":""}}>
|
|
705
|
+
{`@patternfly/react-charts`}
|
|
706
|
+
</PatternflyThemeLink>
|
|
707
|
+
{`!`}
|
|
708
|
+
</p>
|
|
709
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
710
|
+
{`The examples below are based on the `}
|
|
711
|
+
<PatternflyThemeLink {...{"to":"https://formidable.com/open-source/victory/docs/victory-chart/","className":""}}>
|
|
712
|
+
{`Victory`}
|
|
713
|
+
</PatternflyThemeLink>
|
|
714
|
+
{` chart library, along with additional functionality, custom components, and theming for PatternFly. This provides a collection of React based components you can use to build PatternFly patterns with consistent markup, styling, and behavior.`}
|
|
715
|
+
</p>
|
|
716
|
+
<AutoLinkHeader {...{"id":"donut-utilization-examples","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
717
|
+
{`Donut utilization examples`}
|
|
718
|
+
</AutoLinkHeader>
|
|
719
|
+
{React.createElement(pageData.examples["Basic"])}
|
|
720
|
+
{React.createElement(pageData.examples["Right aligned legend"])}
|
|
721
|
+
{React.createElement(pageData.examples["Inverted with right aligned legend"])}
|
|
722
|
+
{React.createElement(pageData.examples["Right aligned vertical legend"])}
|
|
723
|
+
{React.createElement(pageData.examples["Bottom aligned legend"])}
|
|
724
|
+
{React.createElement(pageData.examples["Small"])}
|
|
725
|
+
{React.createElement(pageData.examples["Small with right aligned legend"])}
|
|
726
|
+
{React.createElement(pageData.examples["Small with bottom aligned subtitle"])}
|
|
727
|
+
{React.createElement(pageData.examples["Small with right aligned subtitle"])}
|
|
728
|
+
<AutoLinkHeader {...{"id":"donut-utilization-threshold-examples","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
729
|
+
{`Donut utilization threshold examples`}
|
|
730
|
+
</AutoLinkHeader>
|
|
731
|
+
{React.createElement(pageData.examples["Static thresholds"])}
|
|
732
|
+
{React.createElement(pageData.examples["Static thresholds with right aligned legend"])}
|
|
733
|
+
{React.createElement(pageData.examples["Inverted static thresholds with right aligned legend"])}
|
|
734
|
+
{React.createElement(pageData.examples["Static thresholds with custom legend"])}
|
|
735
|
+
{React.createElement(pageData.examples["Static thresholds with bottom aligned legend"])}
|
|
736
|
+
{React.createElement(pageData.examples["Small with static thresholds"])}
|
|
737
|
+
{React.createElement(pageData.examples["Small with static thresholds and right aligned legend"])}
|
|
738
|
+
{React.createElement(pageData.examples["Small with subtitle"])}
|
|
739
|
+
{React.createElement(pageData.examples["Small with thresholds and right aligned subtitle"])}
|
|
740
|
+
<AutoLinkHeader {...{"id":"documentation","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
741
|
+
{`Documentation`}
|
|
742
|
+
</AutoLinkHeader>
|
|
743
|
+
<AutoLinkHeader {...{"id":"tips","headingLevel":"h3","className":"ws-title ws-h3"}}>
|
|
744
|
+
{`Tips`}
|
|
745
|
+
</AutoLinkHeader>
|
|
746
|
+
<ul {...{"className":"pf-v6-c-content--ul pf-m-editorial ws-ul "}}>
|
|
747
|
+
<li {...{"className":"pf-v6-c-content--li pf-m-editorial ws-li "}}>
|
|
748
|
+
{`See Victory's `}
|
|
749
|
+
<PatternflyThemeLink {...{"to":"https://formidable.com/open-source/victory/docs/faq","className":""}}>
|
|
750
|
+
{`FAQ`}
|
|
751
|
+
</PatternflyThemeLink>
|
|
752
|
+
</li>
|
|
753
|
+
<li {...{"className":"pf-v6-c-content--li pf-m-editorial ws-li "}}>
|
|
754
|
+
{`For single data points or zero values, you may want to set the `}
|
|
755
|
+
<code {...{"className":"ws-code "}}>
|
|
756
|
+
{`domain`}
|
|
757
|
+
</code>
|
|
758
|
+
{` prop`}
|
|
759
|
+
</li>
|
|
760
|
+
<li {...{"className":"pf-v6-c-content--li pf-m-editorial ws-li "}}>
|
|
761
|
+
<code {...{"className":"ws-code "}}>
|
|
762
|
+
{`ChartLegend`}
|
|
763
|
+
</code>
|
|
764
|
+
{` may be used as a standalone component, instead of using `}
|
|
765
|
+
<code {...{"className":"ws-code "}}>
|
|
766
|
+
{`legendData`}
|
|
767
|
+
</code>
|
|
768
|
+
</li>
|
|
769
|
+
</ul>
|
|
770
|
+
<AutoLinkHeader {...{"id":"note","headingLevel":"h3","className":"ws-title ws-h3"}}>
|
|
771
|
+
{`Note`}
|
|
772
|
+
</AutoLinkHeader>
|
|
773
|
+
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
774
|
+
{`Currently, the generated documentation below is not able to resolve type definitions from Victory imports. For the
|
|
775
|
+
components used in the examples above, Victory pass-thru props are also documented here:`}
|
|
776
|
+
</p>
|
|
777
|
+
<ul {...{"className":"pf-v6-c-content--ul pf-m-editorial ws-ul "}}>
|
|
778
|
+
<li {...{"className":"pf-v6-c-content--li pf-m-editorial ws-li "}}>
|
|
779
|
+
{`For `}
|
|
780
|
+
<code {...{"className":"ws-code "}}>
|
|
781
|
+
{`ChartDonutThreshold`}
|
|
782
|
+
</code>
|
|
783
|
+
{` props, see `}
|
|
784
|
+
<PatternflyThemeLink {...{"to":"https://formidable.com/open-source/victory/docs/victory-pie","className":""}}>
|
|
785
|
+
{`VictoryPie`}
|
|
786
|
+
</PatternflyThemeLink>
|
|
787
|
+
</li>
|
|
788
|
+
<li {...{"className":"pf-v6-c-content--li pf-m-editorial ws-li "}}>
|
|
789
|
+
{`For `}
|
|
790
|
+
<code {...{"className":"ws-code "}}>
|
|
791
|
+
{`ChartDonutUtilization`}
|
|
792
|
+
</code>
|
|
793
|
+
{` props, see `}
|
|
794
|
+
<PatternflyThemeLink {...{"to":"https://formidable.com/open-source/victory/docs/victory-pie","className":""}}>
|
|
795
|
+
{`VictoryPie`}
|
|
796
|
+
</PatternflyThemeLink>
|
|
797
|
+
</li>
|
|
798
|
+
</ul>
|
|
799
|
+
</React.Fragment>
|
|
800
|
+
);
|
|
801
|
+
Component.displayName = 'ComponentsChartsDonutUtilizationChart-VictoryDocs';
|
|
802
|
+
Component.pageData = pageData;
|
|
803
|
+
|
|
804
|
+
export default Component;
|