@patternfly/react-docs 7.6.0-prerelease.8 → 7.6.0-prerelease.9
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 +6 -0
- package/LICENSE +21 -0
- package/package.json +12 -11
- package/patternfly-docs/generated/components/about-modal/react.js +0 -149
- package/patternfly-docs/generated/components/accordion/react.js +0 -262
- package/patternfly-docs/generated/components/action-list/react.js +0 -144
- package/patternfly-docs/generated/components/alert/react-demos.js +0 -56
- package/patternfly-docs/generated/components/alert/react.js +0 -1433
- package/patternfly-docs/generated/components/avatar/react.js +0 -166
- package/patternfly-docs/generated/components/back-to-top/react-demos.js +0 -60
- package/patternfly-docs/generated/components/back-to-top/react.js +0 -77
- package/patternfly-docs/generated/components/backdrop/react.js +0 -64
- package/patternfly-docs/generated/components/background-image/react.js +0 -62
- package/patternfly-docs/generated/components/badge/react.js +0 -97
- package/patternfly-docs/generated/components/banner/react-demos.js +0 -57
- package/patternfly-docs/generated/components/banner/react.js +0 -148
- package/patternfly-docs/generated/components/brand/react.js +0 -142
- package/patternfly-docs/generated/components/breadcrumb/react.js +0 -206
- package/patternfly-docs/generated/components/button/react-demos.js +0 -57
- package/patternfly-docs/generated/components/button/react.js +0 -826
- package/patternfly-docs/generated/components/card/react-demos.js +0 -201
- package/patternfly-docs/generated/components/card/react.js +0 -1015
- package/patternfly-docs/generated/components/charts/area-chart/-Victory.js +0 -1350
- package/patternfly-docs/generated/components/charts/bar-chart/-Victory.js +0 -1334
- package/patternfly-docs/generated/components/charts/box-plot-chart/-Victory.js +0 -1282
- package/patternfly-docs/generated/components/charts/bullet-chart/-Victory.js +0 -848
- package/patternfly-docs/generated/components/charts/colors-for-charts/-Victory.js +0 -192
- package/patternfly-docs/generated/components/charts/donut-chart/-Victory.js +0 -426
- package/patternfly-docs/generated/components/charts/donut-utilization-chart/-Victory.js +0 -804
- package/patternfly-docs/generated/components/charts/legends/-Victory.js +0 -3230
- package/patternfly-docs/generated/components/charts/line-chart/-Victory.js +0 -1178
- package/patternfly-docs/generated/components/charts/line-chart/ECharts.js +0 -525
- package/patternfly-docs/generated/components/charts/patterns/-Victory.js +0 -3382
- package/patternfly-docs/generated/components/charts/pie-chart/-Victory.js +0 -377
- package/patternfly-docs/generated/components/charts/resize-observer/-Victory.js +0 -2475
- package/patternfly-docs/generated/components/charts/sankey-chart/ECharts.js +0 -538
- package/patternfly-docs/generated/components/charts/scatter-chart/-Victory.js +0 -1551
- package/patternfly-docs/generated/components/charts/skeletons/-Victory.js +0 -4115
- package/patternfly-docs/generated/components/charts/sparkline-chart/-Victory.js +0 -955
- package/patternfly-docs/generated/components/charts/stack-chart/-Victory.js +0 -1173
- package/patternfly-docs/generated/components/charts/threshold-chart/-Victory.js +0 -1166
- package/patternfly-docs/generated/components/charts/tooltips/-Victory.js +0 -413
- package/patternfly-docs/generated/components/chip/react-deprecated.js +0 -323
- package/patternfly-docs/generated/components/clipboard-copy/react.js +0 -373
- package/patternfly-docs/generated/components/code-block/react.js +0 -148
- package/patternfly-docs/generated/components/code-editor/react.js +0 -659
- package/patternfly-docs/generated/components/compass/react-demos.js +0 -147
- package/patternfly-docs/generated/components/compass/react.js +0 -440
- package/patternfly-docs/generated/components/content/react.js +0 -248
- package/patternfly-docs/generated/components/data-list/react-demos.js +0 -90
- package/patternfly-docs/generated/components/data-list/react.js +0 -709
- package/patternfly-docs/generated/components/date-and-time/calendar-month/react.js +0 -283
- package/patternfly-docs/generated/components/date-and-time/date-and-time-picker/react-demos.js +0 -64
- package/patternfly-docs/generated/components/date-and-time/date-picker/react-demos.js +0 -83
- package/patternfly-docs/generated/components/date-and-time/date-picker/react.js +0 -395
- package/patternfly-docs/generated/components/date-and-time/time-picker/react.js +0 -241
- package/patternfly-docs/generated/components/description-list/react-demos.js +0 -58
- package/patternfly-docs/generated/components/description-list/react.js +0 -743
- package/patternfly-docs/generated/components/divider/react.js +0 -126
- package/patternfly-docs/generated/components/drag-and-drop/react-demos.js +0 -351
- package/patternfly-docs/generated/components/drag-and-drop/react-deprecated.js +0 -184
- package/patternfly-docs/generated/components/drag-and-drop/react.js +0 -137
- package/patternfly-docs/generated/components/drawer/react.js +0 -598
- package/patternfly-docs/generated/components/dual-list-selector/react-deprecated.js +0 -772
- package/patternfly-docs/generated/components/dual-list-selector/react.js +0 -594
- package/patternfly-docs/generated/components/empty-state/react.js +0 -199
- package/patternfly-docs/generated/components/expandable-section/react-demos.js +0 -65
- package/patternfly-docs/generated/components/expandable-section/react.js +0 -408
- package/patternfly-docs/generated/components/file-upload/multiple-file-upload/react-demos.js +0 -52
- package/patternfly-docs/generated/components/file-upload/multiple-file-upload/react.js +0 -398
- package/patternfly-docs/generated/components/file-upload/simple-file-upload/react.js +0 -749
- package/patternfly-docs/generated/components/forms/checkbox/react.js +0 -222
- package/patternfly-docs/generated/components/forms/form/react.js +0 -1106
- package/patternfly-docs/generated/components/forms/form-select/react.js +0 -208
- package/patternfly-docs/generated/components/forms/radio/react.js +0 -212
- package/patternfly-docs/generated/components/forms/text-area/react.js +0 -160
- package/patternfly-docs/generated/components/forms/text-input/react.js +0 -216
- package/patternfly-docs/generated/components/helper-text/react-demos.js +0 -180
- package/patternfly-docs/generated/components/helper-text/react.js +0 -164
- package/patternfly-docs/generated/components/hero/react.js +0 -88
- package/patternfly-docs/generated/components/hint/react.js +0 -169
- package/patternfly-docs/generated/components/icon/react.js +0 -215
- package/patternfly-docs/generated/components/input-group/react.js +0 -182
- package/patternfly-docs/generated/components/jump-links/react-demos.js +0 -154
- package/patternfly-docs/generated/components/jump-links/react.js +0 -212
- package/patternfly-docs/generated/components/label/react-demos.js +0 -57
- package/patternfly-docs/generated/components/label/react.js +0 -417
- package/patternfly-docs/generated/components/list/react.js +0 -175
- package/patternfly-docs/generated/components/login-page/react.js +0 -587
- package/patternfly-docs/generated/components/masthead/react-demos.js +0 -79
- package/patternfly-docs/generated/components/masthead/react.js +0 -291
- package/patternfly-docs/generated/components/menus/application-launcher/react-demos.js +0 -769
- package/patternfly-docs/generated/components/menus/context-selector/react-demos.js +0 -665
- package/patternfly-docs/generated/components/menus/custom-menus/react-demos.js +0 -187
- package/patternfly-docs/generated/components/menus/dropdown/react-templates.js +0 -163
- package/patternfly-docs/generated/components/menus/dropdown/react.js +0 -998
- package/patternfly-docs/generated/components/menus/menu/react.js +0 -1540
- package/patternfly-docs/generated/components/menus/menu-toggle/react.js +0 -747
- package/patternfly-docs/generated/components/menus/options-menu/react-demos.js +0 -508
- package/patternfly-docs/generated/components/menus/select/react-templates.js +0 -257
- package/patternfly-docs/generated/components/menus/select/react.js +0 -998
- package/patternfly-docs/generated/components/modal/react-deprecated.js +0 -554
- package/patternfly-docs/generated/components/modal/react.js +0 -597
- package/patternfly-docs/generated/components/navigation/react-demos.js +0 -356
- package/patternfly-docs/generated/components/navigation/react.js +0 -409
- package/patternfly-docs/generated/components/notification-badge/react.js +0 -196
- package/patternfly-docs/generated/components/notification-drawer/react-demos.js +0 -107
- package/patternfly-docs/generated/components/notification-drawer/react.js +0 -394
- package/patternfly-docs/generated/components/number-input/react.js +0 -210
- package/patternfly-docs/generated/components/overflow-menu/react.js +0 -274
- package/patternfly-docs/generated/components/page/react-demos.js +0 -149
- package/patternfly-docs/generated/components/page/react.js +0 -1352
- package/patternfly-docs/generated/components/pagination/react.js +0 -492
- package/patternfly-docs/generated/components/panel/react.js +0 -236
- package/patternfly-docs/generated/components/popover/react.js +0 -390
- package/patternfly-docs/generated/components/progress/react-demos.js +0 -59
- package/patternfly-docs/generated/components/progress/react.js +0 -283
- package/patternfly-docs/generated/components/progress-stepper/react-demos.js +0 -45
- package/patternfly-docs/generated/components/progress-stepper/react.js +0 -219
- package/patternfly-docs/generated/components/search-input/react-demos.js +0 -113
- package/patternfly-docs/generated/components/search-input/react.js +0 -263
- package/patternfly-docs/generated/components/sidebar/react.js +0 -236
- package/patternfly-docs/generated/components/simple-list/react.js +0 -200
- package/patternfly-docs/generated/components/skeleton/react-demos.js +0 -44
- package/patternfly-docs/generated/components/skeleton/react.js +0 -122
- package/patternfly-docs/generated/components/skip-to-content/react.js +0 -73
- package/patternfly-docs/generated/components/slider/react.js +0 -309
- package/patternfly-docs/generated/components/spinner/react.js +0 -111
- package/patternfly-docs/generated/components/switch/react.js +0 -163
- package/patternfly-docs/generated/components/table/react-demos.js +0 -355
- package/patternfly-docs/generated/components/table/react-deprecated.js +0 -1350
- package/patternfly-docs/generated/components/table/react.js +0 -3241
- package/patternfly-docs/generated/components/tabs/react-demos.js +0 -108
- package/patternfly-docs/generated/components/tabs/react.js +0 -1359
- package/patternfly-docs/generated/components/text-input-group/react-demos.js +0 -152
- package/patternfly-docs/generated/components/text-input-group/react.js +0 -278
- package/patternfly-docs/generated/components/tile/react-deprecated.js +0 -242
- package/patternfly-docs/generated/components/timestamp/react.js +0 -283
- package/patternfly-docs/generated/components/title/react.js +0 -94
- package/patternfly-docs/generated/components/toggle-group/react.js +0 -299
- package/patternfly-docs/generated/components/toolbar/react-demos.js +0 -66
- package/patternfly-docs/generated/components/toolbar/react.js +0 -932
- package/patternfly-docs/generated/components/tooltip/react.js +0 -241
- package/patternfly-docs/generated/components/tree-view/react.js +0 -429
- package/patternfly-docs/generated/components/truncate/react.js +0 -211
- package/patternfly-docs/generated/components/wizard/react-demos.js +0 -87
- package/patternfly-docs/generated/components/wizard/react-deprecated.js +0 -788
- package/patternfly-docs/generated/components/wizard/react.js +0 -986
- package/patternfly-docs/generated/developer-guides/open-ui-automation/react.js +0 -285
- package/patternfly-docs/generated/foundations-and-styles/layouts/bullseye/react.js +0 -70
- package/patternfly-docs/generated/foundations-and-styles/layouts/flex/react.js +0 -506
- package/patternfly-docs/generated/foundations-and-styles/layouts/gallery/react.js +0 -94
- package/patternfly-docs/generated/foundations-and-styles/layouts/grid/react.js +0 -272
- package/patternfly-docs/generated/foundations-and-styles/layouts/level/react.js +0 -87
- package/patternfly-docs/generated/foundations-and-styles/layouts/split/react.js +0 -124
- package/patternfly-docs/generated/foundations-and-styles/layouts/stack/react.js +0 -112
- package/patternfly-docs/generated/index.js +0 -1769
- package/patternfly-docs/generated/patterns/card-view/react-demos.js +0 -78
- package/patternfly-docs/generated/patterns/filters/react-demos.js +0 -141
- package/patternfly-docs/generated/patterns/password-generator/react-demos.js +0 -51
- package/patternfly-docs/generated/patterns/password-strength/react-demos.js +0 -61
- package/patternfly-docs/generated/patterns/primary-detail/react-demos.js +0 -124
- package/patternfly-docs/generated/patterns/right-to-left/react-demos.js +0 -81
|
@@ -1,413 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { AutoLinkHeader, Example, Link as PatternflyThemeLink } from '@patternfly/documentation-framework/components';
|
|
3
|
-
import { useRef, useState, useEffect } from 'react';
|
|
4
|
-
import {
|
|
5
|
-
Chart,
|
|
6
|
-
ChartArea,
|
|
7
|
-
ChartAxis,
|
|
8
|
-
ChartBar,
|
|
9
|
-
ChartContainer,
|
|
10
|
-
ChartCursorFlyout,
|
|
11
|
-
ChartCursorTooltip,
|
|
12
|
-
ChartDonut,
|
|
13
|
-
ChartDonutThreshold,
|
|
14
|
-
ChartDonutUtilization,
|
|
15
|
-
ChartGroup,
|
|
16
|
-
ChartLabel,
|
|
17
|
-
ChartLegend,
|
|
18
|
-
ChartLegendTooltip,
|
|
19
|
-
ChartLegendTooltipContent,
|
|
20
|
-
ChartLegendTooltipLabel,
|
|
21
|
-
ChartLine,
|
|
22
|
-
ChartPie,
|
|
23
|
-
ChartPoint,
|
|
24
|
-
ChartStack,
|
|
25
|
-
ChartThemeColor,
|
|
26
|
-
ChartTooltip,
|
|
27
|
-
ChartVoronoiContainer,
|
|
28
|
-
createContainer,
|
|
29
|
-
getCustomTheme
|
|
30
|
-
} from '@patternfly/react-charts/victory';
|
|
31
|
-
const pageData = {
|
|
32
|
-
"id": "Tooltips",
|
|
33
|
-
"section": "components",
|
|
34
|
-
"subsection": "charts",
|
|
35
|
-
"deprecated": false,
|
|
36
|
-
"template": false,
|
|
37
|
-
"beta": false,
|
|
38
|
-
"demo": false,
|
|
39
|
-
"newImplementationLink": false,
|
|
40
|
-
"source": "-Victory",
|
|
41
|
-
"tabName": null,
|
|
42
|
-
"slug": "/components/charts/tooltips/-Victory",
|
|
43
|
-
"sourceLink": "https://github.com/patternfly/patternfly-org/blob/main/packages/react-charts/src/victory/components/ChartTooltip/examples/ChartTooltip.md",
|
|
44
|
-
"relPath": "packages/react-charts/src/victory/components/ChartTooltip/examples/ChartTooltip.md",
|
|
45
|
-
"propComponents": [
|
|
46
|
-
{
|
|
47
|
-
"name": "ChartTooltip",
|
|
48
|
-
"description": "ChartTooltip renders a tooltip component with a set of default events. When ChartTooltip is used as a label component\nfor any Victory based component that renders data, it will attach events to rendered data components that will\nactivate the tooltip when hovered or focused. ChartTooltipTooltip renders text as well as a configurable Flyout\ncontainer.\n\nNote: When providing tooltips for ChartLine or ChartArea, it is necessary to use ChartVoronoiContainer, as these\ncomponents only render a single element for the entire dataset.\n\nSee https://github.com/FormidableLabs/victory/blob/main/packages/victory-tooltip/src/index.d.ts",
|
|
49
|
-
"props": [
|
|
50
|
-
{
|
|
51
|
-
"name": "activateData",
|
|
52
|
-
"type": "boolean",
|
|
53
|
-
"description": "When true, tooltip events will set the active prop on both data and label elements."
|
|
54
|
-
},
|
|
55
|
-
{
|
|
56
|
-
"name": "active",
|
|
57
|
-
"type": "boolean",
|
|
58
|
-
"description": "The active prop specifies whether the tooltip component should be displayed."
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
"name": "angle",
|
|
62
|
-
"type": "number",
|
|
63
|
-
"description": "The angle prop specifies the angle to rotate the tooltip around its origin point."
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
"name": "center",
|
|
67
|
-
"type": "{ x: number; y: number }",
|
|
68
|
-
"description": "The center prop determines the position of the center of the tooltip flyout. This prop should be given as an object\nthat describes the desired x and y svg coordinates of the center of the tooltip. This prop is useful for\npositioning the flyout of a tooltip independent from the pointer. When ChartTooltip is used with\nChartVoronoiContainer, the center prop is what enables the mouseFollowTooltips option. When this prop is set,\nnon-zero pointerLength values will no longer be respected."
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
"name": "centerOffset",
|
|
72
|
-
"type": "{ x: number | Function, y: number | Function }",
|
|
73
|
-
"description": "The centerOffset prop determines the position of the center of the tooltip flyout in relation to the flyout\npointer. This prop should be given as an object of x and y, where each is either a numeric offset value or a\nfunction that returns a numeric value. When this prop is set, non-zero pointerLength values will no longer be\nrespected."
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
"name": "constrainToVisibleArea",
|
|
77
|
-
"type": "boolean",
|
|
78
|
-
"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.",
|
|
79
|
-
"defaultValue": "false"
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
"name": "cornerRadius",
|
|
83
|
-
"type": "number | Function",
|
|
84
|
-
"description": "The cornerRadius prop determines corner radius of the flyout container. This prop may be given as a positive number\nor a function of datum."
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
"name": "data",
|
|
88
|
-
"type": "any[]",
|
|
89
|
-
"description": "Victory components can pass a data prop to their label component. This can be useful in custom components that need\nto make use of the entire dataset."
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
"name": "datum",
|
|
93
|
-
"type": "{}",
|
|
94
|
-
"description": "Victory components can pass a datum prop to their label component. This can be used to calculate functional styles,\nand determine text."
|
|
95
|
-
},
|
|
96
|
-
{
|
|
97
|
-
"name": "dx",
|
|
98
|
-
"type": "number | Function",
|
|
99
|
-
"description": "The dx prop defines a horizontal shift from the x coordinate."
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
"name": "dy",
|
|
103
|
-
"type": "number | Function",
|
|
104
|
-
"description": "The dy prop defines a vertical shift from the y coordinate."
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
"name": "events",
|
|
108
|
-
"type": "object",
|
|
109
|
-
"description": "The events prop attaches arbitrary event handlers to the label component. This prop should be given as an object of\nevent names and corresponding event handlers. When events are provided via Victory’s event system, event handlers\nwill be called with the event, the props of the component is attached to, and an eventKey.\n\n\n@example events={{onClick: (evt) => alert(\"x: \" + evt.clientX)}}"
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
"name": "flyoutComponent",
|
|
113
|
-
"type": "React.ReactElement<any>",
|
|
114
|
-
"description": "The flyoutComponent prop takes a component instance which will be used to create the flyout path for each tooltip.\nThe new element created from the passed flyoutComponent will be supplied with the following properties: x, y, dx, dy,\nindex, datum, cornerRadius, pointerLength, pointerWidth, width, height, orientation, style, and events.\nAny of these props may be overridden by passing in props to the supplied component, or modified or ignored within\nthe custom component itself. If flyoutComponent is omitted, a default Flyout component will be created with props\ndescribed above.\n\n@example flyoutComponent={<Flyout x={50} y={50}/>}, flyoutComponent={<MyCustomFlyout/>}"
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
"name": "flyoutHeight",
|
|
118
|
-
"type": "number | Function",
|
|
119
|
-
"description": "The flyoutHeight prop defines the height of the tooltip flyout. This prop may be given as a positive number or a function\nof datum. If this prop is not set, height will be determined based on an approximate text size calculated from the\ntext and style props provided to ChartTooltip."
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
"name": "flyoutStyle",
|
|
123
|
-
"type": "number | Function",
|
|
124
|
-
"description": "The style prop applies SVG style properties to the rendered flyout container. These props will be passed to the\nflyoutComponent."
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
"name": "flyoutWidth",
|
|
128
|
-
"type": "number | Function",
|
|
129
|
-
"description": "The flyoutWidth prop defines the width of the tooltip flyout. This prop may be given as a positive number or a\nfunction of datum. If this prop is not set, flyoutWidth will be determined based on an approximate text size\ncalculated from the text and style props provided to VictoryTooltip."
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
"name": "groupComponent",
|
|
133
|
-
"type": "React.ReactElement<any>",
|
|
134
|
-
"description": "The groupComponent prop takes a component instance which will be used to create group elements for use within\ncontainer elements. This prop defaults to a <g> tag.}"
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
"name": "horizontal",
|
|
138
|
-
"type": "boolean",
|
|
139
|
-
"description": "The horizontal prop determines whether to plot the flyouts to the left / right of the (x, y) coordinate rather than top / bottom.\nThis is useful when an orientation prop is not provided, and data will determine the default orientation. i.e.\nnegative values result in a left orientation and positive values will result in a right orientation by default."
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
"name": "index",
|
|
143
|
-
"type": "number | string",
|
|
144
|
-
"description": "The index prop represents the index of the datum in the data array."
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
"name": "labelComponent",
|
|
148
|
-
"type": "React.ReactElement<any>",
|
|
149
|
-
"description": "The labelComponent prop takes a component instance which will be used to render each tooltip label. The new element\ncreated from the passed labelComponent will be supplied with the following properties: x, y, index, datum,\nverticalAnchor, textAnchor, style, text, and events. Any of these props may be overridden by passing in props to\nthe supplied component, or modified or ignored within the custom component itself. If labelComponent is omitted, a\nnew ChartLabel will be created with the props described above.\n\n@example labelComponent={<ChartLabel dy={20}/>}, labelComponent={<MyCustomLabel/>}",
|
|
150
|
-
"defaultValue": "<ChartLabel />"
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
"name": "labelTextAnchor",
|
|
154
|
-
"type": "string | Function",
|
|
155
|
-
"description": "Defines how the labelComponent text is horizontally positioned relative to its `x` and `y` coordinates. Valid\nvalues are 'start', 'middle', 'end', and 'inherit'."
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
"name": "orientation",
|
|
159
|
-
"type": "string | Function",
|
|
160
|
-
"description": "The orientation prop determines which side of the (x, y) coordinate the tooltip should be rendered on.\nThis prop can be given as “top”, “bottom”, “left”, “right”, or as a function of datum that returns one of these\nvalues. If this prop is not provided it will be determined from the sign of the datum, and the value of the\nhorizontal prop."
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
"name": "pointerLength",
|
|
164
|
-
"type": "number | Function",
|
|
165
|
-
"description": "The pointerLength prop determines the length of the triangular pointer extending from the flyout. This prop may be\ngiven as a positive number or a function of datum."
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
"name": "pointerOrientation",
|
|
169
|
-
"type": "string | Function",
|
|
170
|
-
"description": "This prop determines which side of the tooltip flyout the pointer should originate on. When this prop is not set,\nit will be determined based on the overall orientation of the flyout in relation to its data point, and any center\nor centerOffset values. Valid values are 'top', 'bottom', 'left' and 'right."
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
"name": "pointerWidth",
|
|
174
|
-
"type": "number | Function",
|
|
175
|
-
"description": "The pointerWidth prop determines the width of the base of the triangular pointer extending from\nthe flyout. This prop may be given as a positive number or a function of datum."
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
"name": "renderInPortal",
|
|
179
|
-
"type": "boolean",
|
|
180
|
-
"description": "When renderInPortal is true, rendered tooltips will be wrapped in VictoryPortal and rendered within the Portal element\nwithin ChartContainer. Note: This prop should not be set to true when using a custom container element."
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
"name": "style",
|
|
184
|
-
"type": "React.CSSProperties | React.CSSProperties[]",
|
|
185
|
-
"description": "The style prop applies CSS properties to the rendered `<text>` element."
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
"name": "text",
|
|
189
|
-
"type": "number | string | Function | string[] | number[]",
|
|
190
|
-
"description": "The text prop defines the text ChartTooltip will render. The text prop may be given as a string, number, or\nfunction of datum. When ChartLabel is used as the labelComponent, strings may include newline characters, which\nChartLabel will split in to separate <tspan/> elements."
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
"name": "theme",
|
|
194
|
-
"type": "object",
|
|
195
|
-
"description": "The theme prop specifies a theme to use for determining styles and layout properties for a component. Any styles or\nprops defined in theme may be overwritten by props specified on the component instance.",
|
|
196
|
-
"defaultValue": "getTheme(themeColor)"
|
|
197
|
-
},
|
|
198
|
-
{
|
|
199
|
-
"name": "themeColor",
|
|
200
|
-
"type": "string",
|
|
201
|
-
"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}"
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
"name": "x",
|
|
205
|
-
"type": "number",
|
|
206
|
-
"description": "The x prop defines the x coordinate to use as a basis for horizontal positioning."
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
"name": "y",
|
|
210
|
-
"type": "number",
|
|
211
|
-
"description": "The y prop defines the y coordinate to use as a basis for vertical positioning."
|
|
212
|
-
}
|
|
213
|
-
]
|
|
214
|
-
}
|
|
215
|
-
],
|
|
216
|
-
"examples": [
|
|
217
|
-
"Voronoi container",
|
|
218
|
-
"Combined cursor and voronoi containers",
|
|
219
|
-
"Embedded legend",
|
|
220
|
-
"Embedded HTML",
|
|
221
|
-
"Embedded legend with custom font size",
|
|
222
|
-
"Data label",
|
|
223
|
-
"Fixed tooltip",
|
|
224
|
-
"Legend",
|
|
225
|
-
"Left aligned",
|
|
226
|
-
"CSS overflow",
|
|
227
|
-
"Wrapped chart"
|
|
228
|
-
]
|
|
229
|
-
};
|
|
230
|
-
pageData.liveContext = {
|
|
231
|
-
useRef,
|
|
232
|
-
useState,
|
|
233
|
-
useEffect,
|
|
234
|
-
Chart,
|
|
235
|
-
ChartArea,
|
|
236
|
-
ChartAxis,
|
|
237
|
-
ChartBar,
|
|
238
|
-
ChartContainer,
|
|
239
|
-
ChartCursorFlyout,
|
|
240
|
-
ChartCursorTooltip,
|
|
241
|
-
ChartDonut,
|
|
242
|
-
ChartDonutThreshold,
|
|
243
|
-
ChartDonutUtilization,
|
|
244
|
-
ChartGroup,
|
|
245
|
-
ChartLabel,
|
|
246
|
-
ChartLegend,
|
|
247
|
-
ChartLegendTooltip,
|
|
248
|
-
ChartLegendTooltipContent,
|
|
249
|
-
ChartLegendTooltipLabel,
|
|
250
|
-
ChartLine,
|
|
251
|
-
ChartPie,
|
|
252
|
-
ChartPoint,
|
|
253
|
-
ChartStack,
|
|
254
|
-
ChartThemeColor,
|
|
255
|
-
ChartTooltip,
|
|
256
|
-
ChartVoronoiContainer,
|
|
257
|
-
createContainer,
|
|
258
|
-
getCustomTheme
|
|
259
|
-
};
|
|
260
|
-
pageData.examples = {
|
|
261
|
-
'Voronoi container': props =>
|
|
262
|
-
<Example {...pageData} {...props} {...{"code":"import { Chart, ChartArea, ChartAxis, ChartGroup, ChartVoronoiContainer } from '@patternfly/react-charts/victory';\n\ninterface PetData {\n name?: string;\n x?: string;\n y?: number;\n}\n\nexport const ChartTooltipVoronoi: React.FunctionComponent = () => {\n const legendData: PetData[] = [{ name: 'Cats' }, { name: 'Dogs' }, { name: 'Birds' }];\n\n const data1: PetData[] = [\n { name: 'Cats', x: '2015', y: 3 },\n { name: 'Cats', x: '2016', y: 4 },\n { name: 'Cats', x: '2017', y: 8 },\n { name: 'Cats', x: '2018', y: 6 }\n ];\n\n const data2: PetData[] = [\n { name: 'Dogs', x: '2015', y: 2 },\n { name: 'Dogs', x: '2016', y: 3 },\n { name: 'Dogs', x: '2017', y: 4 },\n { name: 'Dogs', x: '2018', y: 5 },\n { name: 'Dogs', x: '2019', y: 6 }\n ];\n\n const data3: PetData[] = [\n { name: 'Birds', x: '2015', y: 1 },\n { name: 'Birds', x: '2016', y: 2 },\n { name: 'Birds', x: '2017', y: 3 },\n { name: 'Birds', x: '2018', y: 2 },\n { name: 'Birds', x: '2019', y: 4 }\n ];\n\n return (\n <div style={{ height: '200px', width: '800px' }}>\n <Chart\n ariaDesc=\"Average number of pets - possibly more information to summarize the data in the chart.\"\n ariaTitle=\"Area chart example chart title\"\n containerComponent={\n <ChartVoronoiContainer labels={({ datum }) => `${datum.name}: ${datum.y}`} constrainToVisibleArea />\n }\n legendData={legendData}\n legendOrientation=\"vertical\"\n legendPosition=\"right\"\n height={200}\n maxDomain={{ y: 9 }}\n name=\"chart1\"\n padding={{\n bottom: 50,\n left: 50,\n right: 200, // Adjusted to accommodate legend\n top: 50\n }}\n width={800}\n >\n <ChartAxis />\n <ChartAxis dependentAxis showGrid />\n <ChartGroup>\n <ChartArea data={data1} interpolation=\"monotoneX\" />\n <ChartArea data={data2} interpolation=\"monotoneX\" />\n <ChartArea data={data3} interpolation=\"monotoneX\" />\n </ChartGroup>\n </Chart>\n </div>\n );\n};\n","title":"Voronoi container","lang":"ts","className":""}}>
|
|
263
|
-
|
|
264
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
265
|
-
{`This demonstrates how to use a voronoi container to display tooltips.`}
|
|
266
|
-
</p>
|
|
267
|
-
</Example>,
|
|
268
|
-
'Combined cursor and voronoi containers': props =>
|
|
269
|
-
<Example {...pageData} {...props} {...{"code":"import {\n Chart,\n ChartAxis,\n ChartGroup,\n ChartLine,\n ChartThemeColor,\n createContainer\n} from '@patternfly/react-charts/victory';\n\ninterface PetData {\n name?: string;\n symbol?: { type: string };\n x?: string;\n y?: number;\n}\n\nexport const ChartTooltipCombinedCursorVoronoi: React.FunctionComponent = () => {\n // Note: Container order is important\n const CursorVoronoiContainer = createContainer('voronoi', 'cursor');\n const legendData: PetData[] = [\n { name: 'Cats' },\n { name: 'Dogs', symbol: { type: 'dash' } },\n { name: 'Birds' },\n { name: 'Mice' }\n ];\n\n const data1: PetData[] = [\n { name: 'Cats', x: '2015', y: 1 },\n { name: 'Cats', x: '2016', y: 2 },\n { name: 'Cats', x: '2017', y: 5 },\n { name: 'Cats', x: '2018', y: 3 }\n ];\n\n const data2: PetData[] = [\n { name: 'Dogs', x: '2015', y: 2 },\n { name: 'Dogs', x: '2016', y: 1 },\n { name: 'Dogs', x: '2017', y: 7 },\n { name: 'Dogs', x: '2018', y: 4 }\n ];\n\n const data3: PetData[] = [\n { name: 'Birds', x: '2015', y: 3 },\n { name: 'Birds', x: '2016', y: 4 },\n { name: 'Birds', x: '2017', y: 9 },\n { name: 'Birds', x: '2018', y: 5 }\n ];\n\n const data4: PetData[] = [\n { name: 'Mice', x: '2015', y: 3 },\n { name: 'Mice', x: '2016', y: 3 },\n { name: 'Mice', x: '2017', y: 8 },\n { name: 'Mice', x: '2018', y: 7 }\n ];\n\n return (\n <div style={{ height: '275px', width: '450px' }}>\n <Chart\n ariaDesc=\"Average number of pets - possibly more information to summarize the data in the chart.\"\n ariaTitle=\"Line chart example chart title\"\n containerComponent={\n <CursorVoronoiContainer\n cursorDimension=\"x\"\n labels={({ datum }) => `${datum.name}: ${datum.y}`}\n mouseFollowTooltips\n voronoiDimension=\"x\"\n voronoiPadding={50}\n />\n }\n legendData={legendData}\n legendPosition=\"bottom\"\n height={275}\n maxDomain={{ y: 10 }}\n minDomain={{ y: 0 }}\n name=\"chart2\"\n padding={{\n bottom: 75, // Adjusted to accommodate legend\n left: 50,\n right: 50,\n top: 50\n }}\n themeColor={ChartThemeColor.orange}\n width={450}\n >\n <ChartAxis tickValues={[2, 3, 4]} />\n <ChartAxis dependentAxis showGrid tickValues={[2, 5, 8]} />\n <ChartGroup>\n <ChartLine data={data1} />\n <ChartLine\n data={data2}\n style={{\n data: {\n strokeDasharray: '3,3'\n }\n }}\n />\n <ChartLine data={data3} />\n <ChartLine data={data4} />\n </ChartGroup>\n </Chart>\n </div>\n );\n};\n","title":"Combined cursor and voronoi containers","lang":"ts","className":""}}>
|
|
270
|
-
|
|
271
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
272
|
-
{`This demonstrates how to combine cursor and voronoi containers to display tooltips along with a vertical cursor.`}
|
|
273
|
-
</p>
|
|
274
|
-
</Example>,
|
|
275
|
-
'Embedded legend': props =>
|
|
276
|
-
<Example {...pageData} {...props} {...{"code":"import {\n Chart,\n ChartAxis,\n ChartGroup,\n ChartLegendTooltip,\n ChartLine,\n ChartThemeColor,\n createContainer\n} from '@patternfly/react-charts/victory';\n\ninterface PetData {\n childName?: string;\n name?: string;\n symbol?: { type: string };\n x?: string;\n y?: number;\n}\n\nexport const ChartTooltipEmbeddedLegend: React.FunctionComponent = () => {\n // Note: Container order is important\n const CursorVoronoiContainer = createContainer('voronoi', 'cursor');\n const legendData: PetData[] = [\n { childName: 'cats', name: 'Cats' },\n { childName: 'dogs', name: 'Dogs', symbol: { type: 'dash' } },\n { childName: 'birds', name: 'Birds' },\n { childName: 'mice', name: 'Mice' }\n ];\n\n const data1: PetData[] = [\n { name: 'Cats', x: '2015', y: 1 },\n { name: 'Cats', x: '2016', y: 2 },\n { name: 'Cats', x: '2017', y: 5 },\n { name: 'Cats', x: '2018', y: 3 }\n ];\n\n const data2: PetData[] = [\n { name: 'Dogs', x: '2015', y: 2 },\n { name: 'Dogs', x: '2016', y: 1 },\n { name: 'Dogs', x: '2017', y: 7 },\n { name: 'Dogs', x: '2018', y: 4 }\n ];\n\n const data3: PetData[] = [\n { name: 'Birds', x: '2015', y: 3 },\n { name: 'Birds', x: '2016', y: 4 },\n { name: 'Birds', x: '2017', y: 9 },\n { name: 'Birds', x: '2018', y: 5 }\n ];\n\n const data4: PetData[] = [\n { name: 'Mice', x: '2015', y: 3 },\n { name: 'Mice', x: '2016', y: null },\n { name: 'Mice', x: '2017', y: 8 },\n { name: 'Mice', x: '2018', y: 7 }\n ];\n\n return (\n <div style={{ height: '275px', width: '450px' }}>\n <Chart\n ariaDesc=\"Average number of pets - possibly more information to summarize the data in the chart.\"\n ariaTitle=\"Embedded legend example chart title\"\n containerComponent={\n <CursorVoronoiContainer\n cursorDimension=\"x\"\n labels={({ datum }) => `${datum.y !== null ? datum.y : 'no data'}`}\n labelComponent={<ChartLegendTooltip legendData={legendData} title={(datum) => datum.x} />}\n mouseFollowTooltips\n voronoiDimension=\"x\"\n voronoiPadding={50}\n />\n }\n legendData={legendData}\n legendPosition=\"bottom\"\n height={275}\n maxDomain={{ y: 10 }}\n minDomain={{ y: 0 }}\n name=\"chart3\"\n padding={{\n bottom: 75, // Adjusted to accommodate legend\n left: 50,\n right: 50,\n top: 50\n }}\n themeColor={ChartThemeColor.green}\n width={450}\n >\n <ChartAxis tickValues={[2, 3, 4]} />\n <ChartAxis dependentAxis showGrid tickValues={[2, 5, 8]} />\n <ChartGroup>\n <ChartLine data={data1} name=\"cats\" />\n <ChartLine\n data={data2}\n name=\"dogs\"\n style={{\n data: {\n strokeDasharray: '3,3'\n }\n }}\n />\n <ChartLine data={data3} name=\"birds\" />\n <ChartLine data={data4} name=\"mice\" />\n </ChartGroup>\n </Chart>\n </div>\n );\n};\n","title":"Embedded legend","lang":"ts","className":""}}>
|
|
277
|
-
|
|
278
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
279
|
-
{`This demonstrates how to embed a legend within a tooltip. Combining cursor and voronoi containers is required to display tooltips with a vertical cursor.`}
|
|
280
|
-
</p>
|
|
281
|
-
</Example>,
|
|
282
|
-
'Embedded HTML': props =>
|
|
283
|
-
<Example {...pageData} {...props} {...{"code":"import {\n Chart,\n ChartArea,\n ChartAxis,\n ChartCursorTooltip,\n ChartGroup,\n ChartPoint,\n ChartThemeColor,\n createContainer\n} from '@patternfly/react-charts/victory';\n\ninterface PetData {\n name?: string;\n x?: string;\n y?: number | null;\n}\n\nexport const ChartTooltipEmbeddedHtml: React.FunctionComponent = () => {\n const baseStyles = {\n color: '#f0f0f0',\n fontFamily:\n '\"Red Hat Text\", \"RedHatText\", \"Noto Sans Arabic\", \"Noto Sans Hebrew\", \"Noto Sans JP\", \"Noto Sans KR\", \"Noto Sans Malayalam\", \"Noto Sans SC\", \"Noto Sans TC\", \"Noto Sans Thai\", Helvetica, Arial, sans-serif',\n fontSize: '14px'\n };\n\n // Note: Container order is important\n const CursorVoronoiContainer = createContainer('voronoi', 'cursor');\n const legendData: PetData[] = [{ name: 'Cats' }, { name: 'Dogs' }, { name: 'Birds' }];\n\n const data1: PetData[] = [\n { name: 'Cats', x: '2015', y: 3 },\n { name: 'Cats', x: '2016', y: 4 },\n { name: 'Cats', x: '2017', y: 8 },\n { name: 'Cats', x: '2018', y: 6 },\n { name: 'Cats', x: '2019', y: null }\n ];\n\n const data2: PetData[] = [\n { name: 'Dogs', x: '2015', y: 2 },\n { name: 'Dogs', x: '2016', y: 3 },\n { name: 'Dogs', x: '2017', y: 4 },\n { name: 'Dogs', x: '2018', y: 5 },\n { name: 'Dogs', x: '2019', y: 6 }\n ];\n\n const data3: PetData[] = [\n { name: 'Birds', x: '2015', y: 1 },\n { name: 'Birds', x: '2016', y: 2 },\n { name: 'Birds', x: '2017', y: 3 },\n { name: 'Birds', x: '2018', y: 2 },\n { name: 'Birds', x: '2019', y: 4 }\n ];\n\n // Custom HTML component to create a legend layout\n const HtmlLegendContent = ({ datum, legendData, text, theme, title, x, y, ..._rest }) => (\n <g>\n <foreignObject height=\"100%\" width=\"100%\" x={x - 40} y={y - 45}>\n <table>\n <thead>\n <tr>\n <th colSpan={2} style={{ ...baseStyles, fontWeight: 700 }}>\n {title(datum)}\n </th>\n </tr>\n </thead>\n <tbody>\n {text.map((val, index) => (\n <tr key={`tbody-tr-${index}`} style={baseStyles}>\n <th width=\"20px\">\n <svg height=\"9.74\" width=\"9.74\">\n <g>\n <rect\n role=\"presentation\"\n shapeRendering=\"auto\"\n width=\"9.74\"\n height=\"9.74\"\n style={{ fill: theme.legend.colorScale[index] }}\n >\n {\n <ChartPoint\n x={0}\n y={0}\n symbol={legendData[index].symbol ? legendData[index].symbol.type : 'square'}\n size={5.6}\n />\n }\n </rect>\n </g>\n </svg>\n </th>\n <td width=\"55px\">{legendData[index].name}</td>\n <td style={{ textAlign: 'right' }}>{val}</td>\n </tr>\n ))}\n </tbody>\n </table>\n </foreignObject>\n </g>\n );\n\n return (\n <div style={{ height: '225px', width: '650px' }}>\n <Chart\n ariaDesc=\"Average number of pets - possibly more information to summarize the data in the chart.\"\n ariaTitle=\"Embedded html example chart title\"\n containerComponent={\n <CursorVoronoiContainer\n cursorDimension=\"x\"\n labels={({ datum }) => `${datum.y !== null ? datum.y : 'no data'}`}\n labelComponent={\n <ChartCursorTooltip\n // The offset and flyout component are not necessary here, but included for completeness\n // centerOffset={{x: ({ center, flyoutWidth, width, offset = flyoutWidth / 2 + 10 }) => width > center.x + flyoutWidth + 10 ? offset : -offset}}\n // flyoutComponent={<ChartCursorFlyout />}\n flyoutHeight={110}\n flyoutWidth={({ datum }) => (datum.y === null ? 160 : 125)}\n labelComponent={<HtmlLegendContent legendData={legendData} title={(datum) => datum.x} />}\n />\n }\n mouseFollowTooltips\n voronoiDimension=\"x\"\n voronoiPadding={50}\n />\n }\n legendData={legendData}\n legendPosition=\"bottom-left\"\n height={225}\n name=\"chart4\"\n padding={{\n bottom: 75, // Adjusted to accommodate legend\n left: 50,\n right: 50,\n top: 50\n }}\n maxDomain={{ y: 9 }}\n themeColor={ChartThemeColor.multiUnordered}\n width={650}\n >\n <ChartAxis />\n <ChartAxis dependentAxis showGrid />\n <ChartGroup>\n <ChartArea data={data1} interpolation=\"monotoneX\" />\n <ChartArea data={data2} interpolation=\"monotoneX\" />\n <ChartArea data={data3} interpolation=\"monotoneX\" />\n </ChartGroup>\n </Chart>\n </div>\n );\n};\n","title":"Embedded HTML","lang":"ts","className":""}}>
|
|
284
|
-
|
|
285
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
286
|
-
{`This demonstrates how to embed HTML within a tooltip. Combining cursor and voronoi containers is required to display tooltips with a vertical cursor.`}
|
|
287
|
-
</p>
|
|
288
|
-
</Example>,
|
|
289
|
-
'Embedded legend with custom font size': props =>
|
|
290
|
-
<Example {...pageData} {...props} {...{"code":"import {\n Chart,\n ChartAxis,\n ChartGroup,\n ChartLegendTooltip,\n ChartLegend,\n ChartLine,\n ChartLegendTooltipContent,\n ChartLegendTooltipLabel,\n ChartThemeColor,\n createContainer\n} from '@patternfly/react-charts/victory';\n\ninterface PetData {\n childName?: string;\n name?: string;\n symbol?: { type: string };\n x?: string;\n y?: number | null;\n}\n\nexport const ChartTooltipEmbeddedLegendFont: React.FunctionComponent = () => {\n // Note: Container order is important\n const CursorVoronoiContainer = createContainer('voronoi', 'cursor');\n const legendData: PetData[] = [\n { childName: 'cats', name: 'Cats' },\n { childName: 'dogs', name: 'Dogs', symbol: { type: 'dash' } },\n { childName: 'birds', name: 'Birds' },\n { childName: 'mice', name: 'Mice' }\n ];\n\n const legend = <ChartLegend style={{ labels: { fontSize: 20 } }} />;\n const legendTooltipLabel = <ChartLegendTooltipLabel style={{ fontSize: 20 }} />;\n const legendTooltipContent = (\n <ChartLegendTooltipContent legendComponent={legend} titleComponent={legendTooltipLabel} />\n );\n\n const data1: PetData[] = [\n { name: 'Cats', x: '2015', y: 1 },\n { name: 'Cats', x: '2016', y: 2 },\n { name: 'Cats', x: '2017', y: 5 },\n { name: 'Cats', x: '2018', y: 3 }\n ];\n\n const data2: PetData[] = [\n { name: 'Dogs', x: '2015', y: 2 },\n { name: 'Dogs', x: '2016', y: 1 },\n { name: 'Dogs', x: '2017', y: 7 },\n { name: 'Dogs', x: '2018', y: 4 }\n ];\n\n const data3: PetData[] = [\n { name: 'Birds', x: '2015', y: 3 },\n { name: 'Birds', x: '2016', y: 4 },\n { name: 'Birds', x: '2017', y: 9 },\n { name: 'Birds', x: '2018', y: 5 }\n ];\n\n const data4: PetData[] = [\n { name: 'Mice', x: '2015', y: 3 },\n { name: 'Mice', x: '2016', y: null },\n { name: 'Mice', x: '2017', y: 8 },\n { name: 'Mice', x: '2018', y: 7 }\n ];\n\n return (\n <div style={{ height: '275px', width: '450px' }}>\n <Chart\n ariaDesc=\"Average number of pets - possibly more information to summarize the data in the chart.\"\n ariaTitle=\"Embeded legend with custom font size example chart title\"\n containerComponent={\n <CursorVoronoiContainer\n cursorDimension=\"x\"\n labels={({ datum }) => `${datum.y !== null ? datum.y : 'no data'}`}\n labelComponent={\n <ChartLegendTooltip\n labelComponent={legendTooltipContent}\n legendData={legendData}\n title={(datum) => datum.x}\n />\n }\n mouseFollowTooltips\n voronoiDimension=\"x\"\n voronoiPadding={50}\n />\n }\n legendData={legendData}\n legendPosition=\"bottom\"\n height={275}\n maxDomain={{ y: 10 }}\n minDomain={{ y: 0 }}\n name=\"chart5\"\n padding={{\n bottom: 75, // Adjusted to accommodate legend\n left: 50,\n right: 50,\n top: 50\n }}\n themeColor={ChartThemeColor.yellow}\n width={450}\n >\n <ChartAxis tickValues={[2, 3, 4]} />\n <ChartAxis dependentAxis showGrid tickValues={[2, 5, 8]} />\n <ChartGroup>\n <ChartLine data={data1} name=\"cats\" />\n <ChartLine\n data={data2}\n name=\"dogs\"\n style={{\n data: {\n strokeDasharray: '3,3'\n }\n }}\n />\n <ChartLine data={data3} name=\"birds\" />\n <ChartLine data={data4} name=\"mice\" />\n </ChartGroup>\n </Chart>\n </div>\n );\n};\n","title":"Embedded legend with custom font size","lang":"ts","className":""}}>
|
|
291
|
-
|
|
292
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
293
|
-
{`This demonstrates how to embed a legend within a tooltip, but with a custom font size. Combining cursor and voronoi containers is required to display tooltips with a vertical cursor.`}
|
|
294
|
-
</p>
|
|
295
|
-
</Example>,
|
|
296
|
-
'Data label': props =>
|
|
297
|
-
<Example {...pageData} {...props} {...{"code":"import {\n Chart,\n ChartAxis,\n ChartBar,\n ChartStack,\n ChartThemeColor,\n ChartTooltip\n} from '@patternfly/react-charts/victory';\n\ninterface PetData {\n name?: string;\n x?: string;\n y?: number;\n label?: string;\n}\n\nexport const ChartTooltipDataLabel: React.FunctionComponent = () => {\n const legendData: PetData[] = [{ name: 'Cats' }, { name: 'Dogs' }, { name: 'Birds' }, { name: 'Mice' }];\n const data1: PetData[] = [\n { name: 'Cats', x: '2015', y: 1, label: 'Cats: 1' },\n { name: 'Cats', x: '2016', y: 2, label: 'Cats: 2' },\n { name: 'Cats', x: '2017', y: 5, label: 'Cats: 5' },\n { name: 'Cats', x: '2018', y: 3, label: 'Cats: 3' }\n ];\n\n const data2: PetData[] = [\n { name: 'Dogs', x: '2015', y: 2, label: 'Dogs: 2' },\n { name: 'Dogs', x: '2016', y: 1, label: 'Dogs: 1' },\n { name: 'Dogs', x: '2017', y: 7, label: 'Dogs: 7' },\n { name: 'Dogs', x: '2018', y: 4, label: 'Dogs: 4' }\n ];\n\n const data3: PetData[] = [\n { name: 'Birds', x: '2015', y: 4, label: 'Birds: 4' },\n { name: 'Birds', x: '2016', y: 4, label: 'Birds: 4' },\n { name: 'Birds', x: '2017', y: 9, label: 'Birds: 9' },\n { name: 'Birds', x: '2018', y: 7, label: 'Birds: 7' }\n ];\n\n const data4: PetData[] = [\n { name: 'Mice', x: '2015', y: 3, label: 'Mice: 3' },\n { name: 'Mice', x: '2016', y: 3, label: 'Mice: 3' },\n { name: 'Mice', x: '2017', y: 8, label: 'Mice: 8' },\n { name: 'Mice', x: '2018', y: 5, label: 'Mice: 5' }\n ];\n\n return (\n <div style={{ height: '275px', width: '450px' }}>\n <Chart\n ariaDesc=\"Average number of pets - possibly more information to summarize the data in the chart.\"\n ariaTitle=\"Data label example chart title\"\n domainPadding={{ x: [30, 25] }}\n legendData={legendData}\n legendPosition=\"bottom-left\"\n height={275}\n name=\"chart6\"\n padding={{\n bottom: 75, // Adjusted to accommodate legend\n left: 50,\n right: 50,\n top: 50\n }}\n themeColor={ChartThemeColor.multiOrdered}\n width={450}\n >\n <ChartAxis />\n <ChartAxis dependentAxis showGrid />\n <ChartStack horizontal>\n <ChartBar data={data1} labelComponent={<ChartTooltip constrainToVisibleArea />} />\n <ChartBar data={data2} labelComponent={<ChartTooltip constrainToVisibleArea />} />\n <ChartBar data={data3} labelComponent={<ChartTooltip constrainToVisibleArea />} />\n <ChartBar data={data4} labelComponent={<ChartTooltip constrainToVisibleArea />} />\n </ChartStack>\n </Chart>\n </div>\n );\n};\n","title":"Data label","lang":"ts","className":""}}>
|
|
298
|
-
|
|
299
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
300
|
-
{`This demonstrates an alternate way of applying tooltips using data labels.`}
|
|
301
|
-
</p>
|
|
302
|
-
</Example>,
|
|
303
|
-
'Fixed tooltip': props =>
|
|
304
|
-
<Example {...pageData} {...props} {...{"code":"import { ChartDonut, ChartThemeColor, ChartTooltip } from '@patternfly/react-charts/victory';\n\ninterface PetData {\n x: string;\n y: number;\n}\n\nexport const ChartTooltipFixed: React.FunctionComponent = () => {\n const data: PetData[] = [\n { x: 'Cats', y: 35 },\n { x: 'Dogs', y: 55 },\n { x: 'Birds', y: 10 }\n ];\n\n return (\n <div style={{ height: '150px', width: '150px' }}>\n <ChartDonut\n ariaDesc=\"Average number of pets\"\n ariaTitle=\"Donut chart example\"\n constrainToVisibleArea\n data={data}\n height={150}\n labelComponent={<ChartTooltip center={{ x: 75, y: 0 }} />}\n labelRadius={46}\n labels={({ datum }) => `${datum.x}: ${datum.y}%`}\n name=\"chart5\"\n subTitle=\"Pets\"\n title=\"100\"\n themeColor={ChartThemeColor.teal}\n width={150}\n />\n </div>\n );\n};\n","title":"Fixed tooltip","lang":"ts","className":""}}>
|
|
305
|
-
|
|
306
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
307
|
-
{`This demonstrates how to adjust the tooltip position and label radius`}
|
|
308
|
-
</p>
|
|
309
|
-
</Example>,
|
|
310
|
-
'Legend': props =>
|
|
311
|
-
<Example {...pageData} {...props} {...{"code":"import { ChartLabel, ChartLegend, ChartPie, ChartThemeColor } from '@patternfly/react-charts/victory';\nimport { Tooltip } from '@patternfly/react-core';\nimport { useRef } from 'react';\n\ninterface PetData {\n x: string;\n y: number;\n}\n\nexport const ChartTooltipLegend: React.FunctionComponent = () => {\n // Custom legend label component\n // Note: Tooltip wraps children with a div tag, so we add a reference to ChartLabel instead\n const LegendLabel = ({ datum, ...rest }) => {\n const ref = useRef(null);\n return (\n <g ref={ref}>\n <ChartLabel {...rest} />\n <Tooltip content={datum.name} enableFlip reference={ref} />\n </g>\n );\n };\n\n // Custom legend component\n const getLegend = (legendData) => <ChartLegend data={legendData} labelComponent={<LegendLabel />} />;\n\n const data: PetData[] = [\n { x: 'Cats', y: 35 },\n { x: 'Dogs', y: 55 },\n { x: 'Birds', y: 10 }\n ];\n\n return (\n <div style={{ height: '275px', width: '300px' }}>\n <ChartPie\n ariaDesc=\"Average number of pets - possibly more information to summarize the data in the chart.\"\n ariaTitle=\"Legend example chart title\"\n constrainToVisibleArea\n data={data}\n height={275}\n labels={({ datum }) => `${datum.x}: ${datum.y}`}\n legendComponent={getLegend([{ name: 'Cats: 35' }, { name: 'Dogs: 55' }, { name: 'Birds: 10' }])}\n legendPosition=\"bottom\"\n name=\"chart7\"\n padding={{\n bottom: 65,\n left: 20,\n right: 20,\n top: 20\n }}\n themeColor={ChartThemeColor.multiOrdered}\n width={300}\n />\n </div>\n );\n};\n","title":"Legend","lang":"ts","className":""}}>
|
|
312
|
-
|
|
313
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
314
|
-
{`This demonstrates an approach for applying tooltips to a legend using a custom legend label component.`}
|
|
315
|
-
</p>
|
|
316
|
-
</Example>,
|
|
317
|
-
'Left aligned': props =>
|
|
318
|
-
<Example {...pageData} {...props} {...{"code":"import {\n Chart,\n ChartAxis,\n ChartGroup,\n ChartLine,\n ChartThemeColor,\n ChartVoronoiContainer,\n getCustomTheme\n} from '@patternfly/react-charts/victory';\n\ninterface PetData {\n name?: string;\n symbol?: { type: string };\n x?: string;\n y?: number;\n}\n\nexport const ChartTooltipLeftAligned: React.FunctionComponent = () => {\n // Victory theme properties only\n const themeProps = {\n voronoi: {\n style: {\n labels: {\n textAnchor: 'start' // Align tooltip labels left\n }\n }\n }\n };\n\n // Applies theme color and variant to base theme\n const myCustomTheme = getCustomTheme(ChartThemeColor.default, themeProps);\n\n const legendData: PetData[] = [\n { name: 'Cats' },\n { name: 'Dogs', symbol: { type: 'dash' } },\n { name: 'Birds' },\n { name: 'Mice' }\n ];\n\n const data1: PetData[] = [\n { name: 'Cats', x: '2015', y: 1 },\n { name: 'Cats', x: '2016', y: 2 },\n { name: 'Cats', x: '2017', y: 5 },\n { name: 'Cats', x: '2018', y: 3 }\n ];\n\n const data2: PetData[] = [\n { name: 'Dogs', x: '2015', y: 2 },\n { name: 'Dogs', x: '2016', y: 1 },\n { name: 'Dogs', x: '2017', y: 7 },\n { name: 'Dogs', x: '2018', y: 4 }\n ];\n\n const data3: PetData[] = [\n { name: 'Birds', x: '2015', y: 3 },\n { name: 'Birds', x: '2016', y: 4 },\n { name: 'Birds', x: '2017', y: 9 },\n { name: 'Birds', x: '2018', y: 5 }\n ];\n\n const data4: PetData[] = [\n { name: 'Mice', x: '2015', y: 3 },\n { name: 'Mice', x: '2016', y: 3 },\n { name: 'Mice', x: '2017', y: 8 },\n { name: 'Mice', x: '2018', y: 7 }\n ];\n\n return (\n <div style={{ height: '250px', width: '600px' }}>\n <Chart\n ariaDesc=\"Average number of pets - possibly more information to summarize the data in the chart.\"\n ariaTitle=\"Left aligned example chart title\"\n containerComponent={\n <ChartVoronoiContainer\n labels={({ datum }) => `${datum.name}: ${datum.y}`}\n constrainToVisibleArea\n voronoiDimension=\"x\"\n />\n }\n legendData={legendData}\n legendOrientation=\"vertical\"\n legendPosition=\"right\"\n height={250}\n maxDomain={{ y: 10 }}\n minDomain={{ y: 0 }}\n name=\"chart8\"\n padding={{\n bottom: 50,\n left: 50,\n right: 200, // Adjusted to accommodate legend\n top: 50\n }}\n theme={myCustomTheme}\n width={600}\n >\n <ChartAxis tickValues={[2, 3, 4]} />\n <ChartAxis dependentAxis showGrid tickValues={[2, 5, 8]} />\n <ChartGroup>\n <ChartLine data={data1} />\n <ChartLine\n data={data2}\n style={{\n data: {\n strokeDasharray: '3,3'\n }\n }}\n />\n <ChartLine data={data3} />\n <ChartLine data={data4} />\n </ChartGroup>\n </Chart>\n </div>\n );\n};\n","title":"Left aligned","lang":"ts","className":""}}>
|
|
319
|
-
|
|
320
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
321
|
-
{`This demonstrates how to customize tooltip label alignment using theme properties.`}
|
|
322
|
-
</p>
|
|
323
|
-
</Example>,
|
|
324
|
-
'CSS overflow': props =>
|
|
325
|
-
<Example {...pageData} {...props} {...{"code":"import {\n ChartArea,\n ChartGroup,\n ChartLabel,\n ChartThemeColor,\n ChartVoronoiContainer\n} from '@patternfly/react-charts/victory';\nimport { useEffect } from 'react';\n\ninterface PetData {\n name: string;\n x: string;\n y: number;\n}\n\nexport const ChartTooltipCssOverflow: React.FunctionComponent = () => {\n // Workaround for documentation-framework issue https://github.com/patternfly/patternfly-react/issues/11455\n useEffect(() => {\n const sheet = (() => {\n const style = document.createElement('style');\n document.head.appendChild(style);\n return style.sheet;\n })();\n\n sheet.insertRule(\n '.ws-react-charts-tooltip-overflow { margin-left: 50px; margin-top: 50px; height: 135px; }',\n sheet.cssRules.length\n );\n sheet.insertRule('.ws-react-charts-tooltip-overflow svg { overflow: visible; }', sheet.cssRules.length);\n }, []);\n\n const data: PetData[] = [\n { name: 'Cats', x: '2015', y: 3 },\n { name: 'Cats', x: '2016', y: 4 },\n { name: 'Cats', x: '2017', y: 8 },\n { name: 'Cats', x: '2018', y: 6 }\n ];\n return (\n <div className=\"ws-react-charts-tooltip-overflow\">\n <div style={{ height: '100px', width: '400px' }}>\n <ChartGroup\n ariaDesc=\"Average number of pets - possibly more information to summarize the data in the chart.\"\n ariaTitle=\"CSS overflow example chart title\"\n containerComponent={<ChartVoronoiContainer labels={({ datum }) => `${datum.name}: ${datum.y}`} />}\n height={100}\n maxDomain={{ y: 9 }}\n name=\"chart9\"\n padding={0}\n themeColor={ChartThemeColor.green}\n width={400}\n >\n <ChartArea data={data} />\n <ChartLabel text=\"CPU utilization\" dy={120} />\n </ChartGroup>\n </div>\n </div>\n );\n};\n","title":"CSS overflow","lang":"ts","className":""}}>
|
|
326
|
-
|
|
327
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
328
|
-
{`This demonstrates an alternate way of applying tooltips using CSS overflow instead of `}
|
|
329
|
-
<code>{`constrainToVisibleArea`}</code>
|
|
330
|
-
{`.`}
|
|
331
|
-
</p>
|
|
332
|
-
</Example>,
|
|
333
|
-
'Wrapped chart': props =>
|
|
334
|
-
<Example {...pageData} {...props} {...{"code":"import { ChartDonutThreshold, ChartDonutUtilization } from '@patternfly/react-charts/victory';\nimport { Button, Tooltip, TooltipPosition } from '@patternfly/react-core';\nimport { useState } from 'react';\n\ninterface Data {\n x: string;\n y: number;\n}\n\nexport const ChartTooltipWrappedChart: React.FunctionComponent = () => {\n const [isVisible, setIsVisible] = useState(false);\n\n const showTooltip = () => {\n setIsVisible(!isVisible);\n };\n\n const data: Data[] = [\n { x: 'Warning at 60%', y: 60 },\n { x: 'Danger at 90%', y: 90 }\n ];\n\n return (\n <div>\n <div style={{ height: '230px', width: '230px' }}>\n <Tooltip\n content={<div>My custom tooltip</div>}\n isVisible={isVisible}\n position={TooltipPosition.right}\n trigger=\"manual\"\n >\n <ChartDonutThreshold\n allowTooltip={false}\n ariaDesc=\"Storage capacity - possibly more information to summarize the data in the chart.\"\n ariaTitle=\"Wrapped example chart title\"\n data={data}\n labels={() => null}\n name=\"chart10\"\n >\n <ChartDonutUtilization\n allowTooltip={false}\n data={{ x: 'Storage capacity', y: 45 }}\n labels={() => null}\n subTitle=\"of 100 GBps\"\n title=\"45%\"\n />\n </ChartDonutThreshold>\n </Tooltip>\n </div>\n <div style={{ width: '230px', textAlign: 'center' }}>\n <Button onClick={showTooltip}>Show Tooltip</Button>\n </div>\n </div>\n );\n};\n","title":"Wrapped chart","lang":"ts","className":""}}>
|
|
335
|
-
|
|
336
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
337
|
-
{`This demonstrates an alternate way of applying tooltips by wrapping charts with the Tooltip component.`}
|
|
338
|
-
</p>
|
|
339
|
-
</Example>
|
|
340
|
-
};
|
|
341
|
-
|
|
342
|
-
const Component = () => (
|
|
343
|
-
<React.Fragment>
|
|
344
|
-
<AutoLinkHeader {...{"id":"introduction","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
345
|
-
{`Introduction`}
|
|
346
|
-
</AutoLinkHeader>
|
|
347
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
348
|
-
{`Note: PatternFly React charts live in its own package at `}
|
|
349
|
-
<PatternflyThemeLink {...{"to":"https://www.npmjs.com/package/@patternfly/react-charts","className":""}}>
|
|
350
|
-
{`@patternfly/react-charts`}
|
|
351
|
-
</PatternflyThemeLink>
|
|
352
|
-
{`!`}
|
|
353
|
-
</p>
|
|
354
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
355
|
-
{`The examples below are based on the `}
|
|
356
|
-
<PatternflyThemeLink {...{"to":"https://formidable.com/open-source/victory/docs/victory-chart/","className":""}}>
|
|
357
|
-
{`Victory`}
|
|
358
|
-
</PatternflyThemeLink>
|
|
359
|
-
{` 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.`}
|
|
360
|
-
</p>
|
|
361
|
-
<AutoLinkHeader {...{"id":"examples","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
362
|
-
{`Examples`}
|
|
363
|
-
</AutoLinkHeader>
|
|
364
|
-
{React.createElement(pageData.examples["Voronoi container"])}
|
|
365
|
-
{React.createElement(pageData.examples["Combined cursor and voronoi containers"])}
|
|
366
|
-
{React.createElement(pageData.examples["Embedded legend"])}
|
|
367
|
-
{React.createElement(pageData.examples["Embedded HTML"])}
|
|
368
|
-
{React.createElement(pageData.examples["Embedded legend with custom font size"])}
|
|
369
|
-
{React.createElement(pageData.examples["Data label"])}
|
|
370
|
-
{React.createElement(pageData.examples["Fixed tooltip"])}
|
|
371
|
-
{React.createElement(pageData.examples["Legend"])}
|
|
372
|
-
{React.createElement(pageData.examples["Left aligned"])}
|
|
373
|
-
{React.createElement(pageData.examples["CSS overflow"])}
|
|
374
|
-
{React.createElement(pageData.examples["Wrapped chart"])}
|
|
375
|
-
<AutoLinkHeader {...{"id":"documentation","headingLevel":"h2","className":"ws-title ws-h2"}}>
|
|
376
|
-
{`Documentation`}
|
|
377
|
-
</AutoLinkHeader>
|
|
378
|
-
<AutoLinkHeader {...{"id":"tips","headingLevel":"h3","className":"ws-title ws-h3"}}>
|
|
379
|
-
{`Tips`}
|
|
380
|
-
</AutoLinkHeader>
|
|
381
|
-
<ul {...{"className":"pf-v6-c-content--ul pf-m-editorial ws-ul "}}>
|
|
382
|
-
<li {...{"className":"pf-v6-c-content--li pf-m-editorial ws-li "}}>
|
|
383
|
-
{`See Victory's `}
|
|
384
|
-
<PatternflyThemeLink {...{"to":"https://formidable.com/open-source/victory/docs/faq","className":""}}>
|
|
385
|
-
{`FAQ`}
|
|
386
|
-
</PatternflyThemeLink>
|
|
387
|
-
</li>
|
|
388
|
-
</ul>
|
|
389
|
-
<AutoLinkHeader {...{"id":"note","headingLevel":"h3","className":"ws-title ws-h3"}}>
|
|
390
|
-
{`Note`}
|
|
391
|
-
</AutoLinkHeader>
|
|
392
|
-
<p {...{"className":"pf-v6-c-content--p pf-m-editorial ws-p "}}>
|
|
393
|
-
{`Currently, the generated documentation below is not able to resolve type definitions from Victory imports. For the
|
|
394
|
-
components used in the examples above, Victory pass-thru props are also documented here:`}
|
|
395
|
-
</p>
|
|
396
|
-
<ul {...{"className":"pf-v6-c-content--ul pf-m-editorial ws-ul "}}>
|
|
397
|
-
<li {...{"className":"pf-v6-c-content--li pf-m-editorial ws-li "}}>
|
|
398
|
-
{`For `}
|
|
399
|
-
<code {...{"className":"ws-code "}}>
|
|
400
|
-
{`ChartTooltip`}
|
|
401
|
-
</code>
|
|
402
|
-
{` props, see `}
|
|
403
|
-
<PatternflyThemeLink {...{"to":"https://formidable.com/open-source/victory/docs/victory-tooltip","className":""}}>
|
|
404
|
-
{`VictoryTooltip`}
|
|
405
|
-
</PatternflyThemeLink>
|
|
406
|
-
</li>
|
|
407
|
-
</ul>
|
|
408
|
-
</React.Fragment>
|
|
409
|
-
);
|
|
410
|
-
Component.displayName = 'ComponentsChartsTooltips-VictoryDocs';
|
|
411
|
-
Component.pageData = pageData;
|
|
412
|
-
|
|
413
|
-
export default Component;
|