Skip to content

Commit f562328

Browse files
committed
add readmes
1 parent 7b7f3e9 commit f562328

File tree

26 files changed

+9625
-0
lines changed

26 files changed

+9625
-0
lines changed

packages/victory-area/README.md

+519
Large diffs are not rendered by default.

packages/victory-axis/README.md

+473
Large diffs are not rendered by default.

packages/victory-bar/README.md

+575
Large diffs are not rendered by default.

packages/victory-box-plot/README.md

+943
Large diffs are not rendered by default.
+158
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
2+
# VictoryBrushContainer
3+
4+
`victory-brush-container@^30.0.0` exports `VictoryBrushContainer`, `brushContainerMixin` and `BrushHelpers`
5+
6+
View these docs at https://formidable.com/open-source/victory/docs/victory-brush-container to see live examples.
7+
8+
`VictoryBrushContainer` adds the ability to highlight a region of a chart, and interact with
9+
highlighted regions, either by moving the region, expanding the region, or selecting a new region.
10+
`VictoryBrushContainer` is useful for selecting a region of a larger dataset by domain. Create a
11+
brush control by tying the domain of the selected region to the domain of a separate chart.
12+
See the [brush and zoom guide][] for an example of using `VictoryBrushContainer` to create a brush
13+
control.
14+
15+
`VictoryBrushContainer` is similar to `VictorySelectionContainer`. `VictoryBrushContainer` may be
16+
used to identify the domain of a selected region, whereas `VictorySelectionContainer` may be used to
17+
identify a list of data points within a selected region. `VictoryBrushContainer` will also create
18+
persistent highlighted regions, whereas regions created by `VictorySelectionContainer`
19+
disappear after `onMouseUp` events.
20+
21+
`VictoryBrushContainer` may be used with any Victory component that works with an x-y coordinate
22+
system, and should be added as the `containerComponent` of the top-level component.
23+
However, the component that uses it must be standalone
24+
(`standalone={true}`), which is the default for all top-level Victory components.
25+
26+
```playground
27+
<VictoryChart
28+
containerComponent={
29+
<VictoryBrushContainer
30+
brushDimension="x"
31+
brushDomain={{x: [0.1, 0.3]}}
32+
/>
33+
}
34+
>
35+
<VictoryLine />
36+
</VictoryChart>
37+
```
38+
39+
## Props
40+
41+
`VictoryBrushContainer` uses a superset of props used by [VictoryContainer][]. All props are optional.
42+
43+
### allowDrag
44+
45+
`type: boolean`
46+
47+
The optional `allowDrag` prop accepts a boolean that enables dragging behavior for the highlighted brush area. Resizing will still be enabled when the `allowDrag` prop is set to false.
48+
49+
*default:* `allowDrag={true}`
50+
51+
### allowResize
52+
53+
`type: boolean`
54+
55+
The optional `allowResize` prop accepts a boolean that enables resizing the highlighted brush area. Dragging will still be enabled when the `allowResize` prop is set to false, but the dimensions of the brush area will be fixed.
56+
57+
*default:* `allowResize={true}`
58+
59+
### brushComponent
60+
61+
`type: element`
62+
63+
The `brushComponent` prop specifies the component to be rendered for the highlighted area.
64+
This component will be supplied with the following props: x, y, width, height, and style.
65+
When this prop is not specified, a `<rect/>` will be rendered.
66+
67+
*default:* `brushComponent={<rect/>}`
68+
69+
### brushDimension
70+
71+
`type: "x" || "y"`
72+
73+
When the `brushDimension` prop is set, brushing will only be specific to the to the given dimension
74+
(either "x" or "y"), and the entire domain of the other dimension will be highlighted. When this prop
75+
is not specified, highlighting will occur along both dimensions.
76+
77+
*example:* `brushDimension="x"`
78+
79+
### brushDomain
80+
81+
`type: { x: [low, high], y: [low, high] }`
82+
83+
The optional `brushDomain` prop describes the highlighted state. This prop is an object that
84+
specifies separate arrays for `x` and `y`. Each array is a tuple that describes the minimum and maximum
85+
values to render. If this prop is not provided initially, the chart will render with the entire
86+
domain highlighted. When this prop changes, the chart will render with a new highlighted domain.
87+
88+
*example:* `brushDomain={{x: [50, 100], y: [0, 100]}`
89+
90+
### brushStyle
91+
92+
`type: object`
93+
94+
The `brushStyle` adds custom styles to the `brushComponent`. This prop should be given as
95+
an object of SVG style attributes.
96+
97+
*default:* `brushStyle={{stroke: "transparent", fill: "black", fillOpacity: 0.1}}
98+
99+
### defaultBrushArea
100+
101+
`type: "all", "none", "disable"`
102+
103+
The `defaultBrushArea` prop specifies how the container will behave when a region outside the active brush is clicked without selecting a new area. When the prop is set to "all", the entire domain will be selected. When the prop is set to "none", no new region will be selected, and any existing active brush will be cleared. When the prop is set to "disable" the new selected region will default to the current active brush.
104+
105+
```playground
106+
<VictoryChart
107+
containerComponent={
108+
<VictoryBrushContainer
109+
defaultBrushArea="disable"
110+
brushDomain={{x: [0.1, 0.3]}}
111+
/>
112+
}
113+
>
114+
<VictoryLine />
115+
</VictoryChart>
116+
```
117+
118+
### disable
119+
120+
`type: boolean`
121+
122+
When the `disable` prop is set to `true`, `VictoryBrushContainer` events will not fire.
123+
124+
### handleComponent
125+
126+
`type: element`
127+
128+
The `handleComponent` prop specifies the component to be rendered for each handle for the highlighted
129+
area. This component will be supplied with the following props: `x`, `y`, `width`, `height`, `cursor`, and `style`.
130+
When this prop is not specified, a `<rect/>` will be rendered.
131+
132+
*default:* `handleComponent={<rect/>}`
133+
134+
### handleStyle
135+
136+
`type: object`
137+
138+
The `handleStyle` adds custom styles to the `handleComponents`. This prop should be given as
139+
an object of SVG style attributes.
140+
141+
Handles refer to the region on each highlighted area where the area may be
142+
expanded. Only handles relevant to the given `dimension` will be rendered. For example, when
143+
`brushDimension="x"` only "left" and "right" handles will be rendered. Handles are automatically styled
144+
with cursors appropriate to their orientation.
145+
146+
*default:* `handleStyle={{stroke: "transparent", fill: "transparent"}}
147+
148+
### onBrushDomainChange
149+
150+
`type: function`
151+
152+
The optional `onBrushDomainChange` prop accepts an function to be called on each update to the highlighted domain. The function accepts the parameters of `domain` (the updated domain), and `props` (the props used by `VictoryBrushContainer`).
153+
154+
*example:* `onBrushDomainChange={(domain, props) => handleDomainChange(domain, props)}`
155+
156+
157+
[brush and zoom guide]: https://formidable.com/open-source/victory/guides/brush-and-zoom
158+
[VictoryContainer]: https://formidable.com/open-source/victory/docs/victory-container

0 commit comments

Comments
 (0)