victory-voronoi-container 30.6.1 → 31.2.0
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/README.md +12 -13
- package/dist/victory-voronoi-container.js +1097 -858
- package/dist/victory-voronoi-container.min.js +1 -1
- package/package.json +3 -3
- package/src/victory-voronoi-container.js +229 -216
- package/src/voronoi-helpers.js +44 -27
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ However, the component that uses it must be standalone
|
|
|
41
41
|
|
|
42
42
|
When the `activateData` prop is set to true, the `active` prop will be set to true on all data components within a voronoi area. When this prop is set to false, the `onActivated` and `onDeactivated` callbacks will still fire, but no mutations to data components will occur via Victory's event system.
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
_default:_ `activateData={true}`
|
|
45
45
|
|
|
46
46
|
### activateLabels
|
|
47
47
|
|
|
@@ -49,7 +49,7 @@ When the `activateData` prop is set to true, the `active` prop will be set to tr
|
|
|
49
49
|
|
|
50
50
|
When the `activateLabels` prop is set to true, the `active` prop will be set to true on all labels corresponding to points within a voronoi area. When this prop is set to false, the `onActivated` and `onDeactivated` callbacks will still fire, but no mutations to label components will occur via Victory's event system. Labels defined directly on `VictoryVoronoiContainer` via the `labels` prop will still appear when this prop is set to false.
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
_default:_ `activateLabels={true}`
|
|
53
53
|
|
|
54
54
|
### disable
|
|
55
55
|
|
|
@@ -63,9 +63,9 @@ When the `disable` prop is set to `true`, `VictoryVoronoiContainer` events will
|
|
|
63
63
|
|
|
64
64
|
When a `labels` prop is provided to `VictoryVoronoiContainer` it will render a label component
|
|
65
65
|
rather than activating labels on the child components it renders. This is useful for creating multi-
|
|
66
|
-
point tooltips. This prop should be given as a function which will be called once for each active point.
|
|
66
|
+
point tooltips. This prop should be given as a function which will be called once for each active point. The `labels` function will be called with the arguments `point`, `index`, and `points`, where `point` refers to a single active point, `index` refers to the position of that point in the array of active points, and `points` is an array of all active points.
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
_example:_ `labels={(point) => "y: " + point.y}`
|
|
69
69
|
|
|
70
70
|
### labelComponent
|
|
71
71
|
|
|
@@ -74,7 +74,7 @@ point tooltips. This prop should be given as a function which will be called onc
|
|
|
74
74
|
The `labelComponent` prop specified the component that will be rendered when `labels` are defined
|
|
75
75
|
on `VictoryVoronoiContainer`. If the `labels` prop is omitted, no label component will be rendered.
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
_default:_ `labelComponent={<VictoryTooltip/>}`
|
|
78
78
|
|
|
79
79
|
### onActivated
|
|
80
80
|
|
|
@@ -83,7 +83,7 @@ on `VictoryVoronoiContainer`. If the `labels` prop is omitted, no label componen
|
|
|
83
83
|
The `onActivated` prop accepts a function to be called whenever new data points are activated.
|
|
84
84
|
The function is called with the parameters `points` (an array of active data objects) and `props` (the props used by `VictoryVoronoiContainer`).
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
_example:_ `onActivated={(points, props) => filterList(points, props)}`
|
|
87
87
|
|
|
88
88
|
### onDeactivated
|
|
89
89
|
|
|
@@ -92,7 +92,7 @@ The function is called with the parameters `points` (an array of active data obj
|
|
|
92
92
|
The `onDeactivated` prop accepts a function to be called whenever points are deactivated.
|
|
93
93
|
The function is called with the parameters `points` (an array of the newly-deactivated data objects) and `props` (the props used by `VictoryVoronoiContainer`).
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
_example:_ `onDeactivated={(points, props) => removeFromList(points, props)}`
|
|
96
96
|
|
|
97
97
|
### radius
|
|
98
98
|
|
|
@@ -101,7 +101,7 @@ The function is called with the parameters `points` (an array of the newly-deact
|
|
|
101
101
|
When the `radius` prop is set, the voronoi areas associated with each data point will be no larger
|
|
102
102
|
than the given radius. This prop should be given as a number.
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
_example:_ `radius={25}`
|
|
105
105
|
|
|
106
106
|
### voronoiBlacklist
|
|
107
107
|
|
|
@@ -109,8 +109,7 @@ than the given radius. This prop should be given as a number.
|
|
|
109
109
|
|
|
110
110
|
The `voronoiBlacklist` prop is used to specify a list of components to ignore when calculating a shared voronoi diagram. Components with a `name` prop matching an element in the `voronoiBlacklist` array will be ignored by `VictoryVoronoiContainer`. Ignored components will never be flagged as active, and will not contribute date to shared tooltips or labels.
|
|
111
111
|
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
_example:_ `voronoiBlacklist={["redPoints"]}`
|
|
114
113
|
|
|
115
114
|
```playground
|
|
116
115
|
<VictoryChart domain={{ y: [0, 6] }}
|
|
@@ -144,7 +143,7 @@ For example, when `dimension` is set to "x", all data points matching a particul
|
|
|
144
143
|
will be activated regardless of y value. When this prop is not given, voronoi selection is
|
|
145
144
|
determined by both x any y values.
|
|
146
145
|
|
|
147
|
-
|
|
146
|
+
_example:_ `voronoiDimension="x"`
|
|
148
147
|
|
|
149
148
|
```playground
|
|
150
149
|
<VictoryChart domain={{ y: [0, 6] }}
|
|
@@ -177,8 +176,8 @@ When the `voronoiPadding` prop is given, the area of the chart that will trigger
|
|
|
177
176
|
reduced by the given padding on every side. By default, no padding is applied, and the entire range
|
|
178
177
|
of a given chart may trigger voronoi events. This prop should be given as a number.
|
|
179
178
|
|
|
180
|
-
|
|
179
|
+
_example:_ `voronoiPadding={5}`
|
|
181
180
|
|
|
182
|
-
[
|
|
181
|
+
[victorycontainer]: https://formidable.com/open-source/victory/docs/victory-container
|
|
183
182
|
[voronoi diagram]: https://github.com/d3/d3-voronoi
|
|
184
183
|
[this example]: https://formidable.com/open-source/victory/gallery/voronoi-tooltips-grouped
|