victory-polar-axis 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 +37 -41
- package/dist/victory-polar-axis.js +1106 -859
- package/dist/victory-polar-axis.min.js +1 -1
- package/es/helper-methods.js +9 -10
- package/es/victory-polar-axis.js +10 -3
- package/lib/helper-methods.js +11 -10
- package/lib/victory-polar-axis.js +11 -3
- package/package.json +2 -2
- package/src/helper-methods.js +124 -72
- package/src/victory-polar-axis.js +72 -35
package/README.md
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
# VictoryPolarAxis
|
|
3
2
|
|
|
4
3
|
`victory-polar-axis@^30.0.0` exports `VictoryPolarAxis`
|
|
@@ -41,13 +40,14 @@ animate={{
|
|
|
41
40
|
easing: "bounce"
|
|
42
41
|
}}
|
|
43
42
|
```
|
|
43
|
+
|
|
44
44
|
### axisAngle
|
|
45
45
|
|
|
46
46
|
`type: number`
|
|
47
47
|
|
|
48
48
|
The `axisAngle` prop is used to position the dependent axis. This prop should be given in degrees. Degrees are defined as starting at the 3 o'clock position, and proceeding counterclockwise. This prop only affects the dependent axis.
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
_default:_ `axisAngle={0}`
|
|
51
51
|
|
|
52
52
|
```playground
|
|
53
53
|
<VictoryPolarAxis dependentAxis
|
|
@@ -62,7 +62,7 @@ The `axisAngle` prop is used to position the dependent axis. This prop should be
|
|
|
62
62
|
|
|
63
63
|
The `axisComponent` prop takes a component instance which will be responsible for rendering an axis line for the dependent axis. The independent axis renders a `circularAxisComponent`. The new element created from the passed `axisComponent` will be provided with the following props calculated by `VictoryPolarAxis`: `x1`, `y1`, `x2`, `y2`, `style` and `events`. Any of these props may be overridden by passing in props to the supplied component, or modified or ignored within the custom component itself. If an `axisComponent` is not provided, `VictoryPolarAxis` will use its default [Line component][].
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
_default:_ `axisComponent={<Line type={"axis"}/>}`
|
|
66
66
|
|
|
67
67
|
```jsx
|
|
68
68
|
axisComponent={<Line events={{ onClick: handleClick }}/>}
|
|
@@ -76,7 +76,7 @@ The `axisLabelComponent` prop takes a component instance which will be used to r
|
|
|
76
76
|
|
|
77
77
|
**Note:** Axis labels are only rendered with the dependent axis in polar charts.
|
|
78
78
|
|
|
79
|
-
|
|
79
|
+
_default:_ `axisLabelComponent={<VictoryLabel/>}`
|
|
80
80
|
|
|
81
81
|
```jsx
|
|
82
82
|
axisLabelComponent={<VictoryLabel dy={20}/>}
|
|
@@ -86,8 +86,7 @@ axisLabelComponent={<VictoryLabel dy={20}/>}
|
|
|
86
86
|
|
|
87
87
|
`type: number`
|
|
88
88
|
|
|
89
|
-
The `axisValue` prop may be used instead of `axisAngle` to position the dependent axis.
|
|
90
|
-
|
|
89
|
+
The `axisValue` prop may be used instead of `axisAngle` to position the dependent axis. This prop is useful when dependent axes should line up with values on the independent axis.
|
|
91
90
|
|
|
92
91
|
```playground
|
|
93
92
|
<VictoryChart polar
|
|
@@ -126,7 +125,7 @@ The `axisValue` prop may be used instead of `axisAngle` to position the dependen
|
|
|
126
125
|
The `circularAxisComponent` prop takes a component instance which will be responsible for rendering an axis arc for the independent axis. The dependent axis renders an `axisComponent`. The new element created from the passed `circularAxisComponent` will be provided with the following props calculated by `VictoryPolarAxis`: `style`, `events`,
|
|
127
126
|
`cx`, `cy`, `r`, `startAngle`, and `endAngle`. Any of these props may be overridden by passing in props to the supplied component, or modified or ignored within the custom component itself. If a `circularAxisComponent` is not provided, `VictoryPolarAxis` will use its default [Arc component][].
|
|
128
127
|
|
|
129
|
-
|
|
128
|
+
_default:_ `circularAxisComponent={<Arc type={"axis"}/>}`
|
|
130
129
|
|
|
131
130
|
```jsx
|
|
132
131
|
circularAxisComponent={<Arc r={300}/>}
|
|
@@ -138,7 +137,7 @@ circularAxisComponent={<Arc r={300}/>}
|
|
|
138
137
|
|
|
139
138
|
The `circularGridComponent` prop takes a component instance which will be responsible for rendering a grid element. The new element created from the passed `circularGridComponent` will be provided with the following props calculated by `VictoryPolarAxis`: `x1`, `y1`, `x2`, `y2`, `tick`, `style` and `events`. Any of these props may be overridden by passing in props to the supplied component, or modified or ignored within the custom component itself. If a `circularGridComponent` is not provided, `VictoryPolarAxis` will use its default [Arc component][].
|
|
140
139
|
|
|
141
|
-
|
|
140
|
+
_default:_ `circularGridComponent={<Arc type={"grid"}/>}`
|
|
142
141
|
|
|
143
142
|
```jsx
|
|
144
143
|
circularGridComponent={<Arc r={300}/>}
|
|
@@ -163,7 +162,7 @@ containerComponent={<VictoryVoronoiContainer/>}
|
|
|
163
162
|
|
|
164
163
|
The `dependentAxis` boolean prop specifies whether the axis corresponds to the dependent variable (usually y, or the radial dimension on a polar chart). This prop is useful when composing `VictoryPolarAxis` with other components to form a chart.
|
|
165
164
|
|
|
166
|
-
|
|
165
|
+
_default:_ `dependentAxis={false}`
|
|
167
166
|
|
|
168
167
|
```playground
|
|
169
168
|
<div style={{ display: "flex" }}>
|
|
@@ -198,8 +197,7 @@ domainPadding={{x: [10, -10], y: 5}}
|
|
|
198
197
|
|
|
199
198
|
The `endAngle` props defines the overall end angle of the axis in degrees. This prop is used in conjunction with `startAngle` to create an axis that spans only a segment of a circle, or to change overall rotation of the axis. This prop should be given as a number of degrees. Degrees are defined as starting at the 3 o'clock position, and proceeding counterclockwise.
|
|
200
199
|
|
|
201
|
-
|
|
202
|
-
|
|
200
|
+
_default:_ `endAngle={360}`
|
|
203
201
|
|
|
204
202
|
```playground
|
|
205
203
|
<div style={{ display: "flex" }}>
|
|
@@ -223,7 +221,7 @@ The `endAngle` props defines the overall end angle of the axis in degrees. This
|
|
|
223
221
|
|
|
224
222
|
`VictoryPolarAxis` uses the standard `events` prop. [Read about it here](https://formidable.com/open-source/victory/docs/common-props#events)
|
|
225
223
|
|
|
226
|
-
See the [Events Guide]
|
|
224
|
+
See the [Events Guide][]for more information on defining events.
|
|
227
225
|
|
|
228
226
|
**note:** valid event targets for `VictoryPolarAxis` are "axis", "axisLabel", "grid", "ticks", and "tickLabels".
|
|
229
227
|
Targets that correspond to only one element {"axis" and "axisLabel") should use the special eventKey "all".
|
|
@@ -240,7 +238,7 @@ Targets that correspond to only one element {"axis" and "axisLabel") should use
|
|
|
240
238
|
|
|
241
239
|
The `gridComponent` prop takes a component instance which will be responsible for rendering a grid element. The new element created from the passed `gridComponent` will be provided with the following props calculated by `VictoryPolarAxis`: `x1`, `y1`, `x2`, `y2`, `tick`, `style` and `events`. Any of these props may be overridden by passing in props to the supplied component, or modified or ignored within the custom component itself. If a `gridComponent` is not provided, `VictoryPolarAxis` will use its default [Line component][].
|
|
242
240
|
|
|
243
|
-
|
|
241
|
+
_default:_ `gridComponent={<Line type={"grid"}/>}`
|
|
244
242
|
|
|
245
243
|
```jsx
|
|
246
244
|
gridComponent={<Line events={{ onClick: handleClick }}/>}
|
|
@@ -252,7 +250,7 @@ gridComponent={<Line events={{ onClick: handleClick }}/>}
|
|
|
252
250
|
|
|
253
251
|
`VictoryPolarAxis` uses the standard `groupComponent` prop. [Read about it here](https://formidable.com/open-source/victory/docs/common-props#groupcomponent)
|
|
254
252
|
|
|
255
|
-
|
|
253
|
+
_default:_ `<g/>`
|
|
256
254
|
|
|
257
255
|
```jsx
|
|
258
256
|
groupComponent={<g transform="translate(10, 10)" />}
|
|
@@ -264,7 +262,7 @@ groupComponent={<g transform="translate(10, 10)" />}
|
|
|
264
262
|
|
|
265
263
|
`VictoryPolarAxis` uses the standard `height` prop. [Read about it here](https://formidable.com/open-source/victory/docs/common-props#height)
|
|
266
264
|
|
|
267
|
-
|
|
265
|
+
_default (provided by default theme):_ `height={300}`
|
|
268
266
|
|
|
269
267
|
```jsx
|
|
270
268
|
height={400}
|
|
@@ -279,13 +277,14 @@ When the `innerRadius` prop is set, polar axes will be hollow rather than circul
|
|
|
279
277
|
```playground
|
|
280
278
|
<VictoryPolarAxis theme={VictoryTheme.material} innerRadius={50}/>
|
|
281
279
|
```
|
|
280
|
+
|
|
282
281
|
### invertAxis
|
|
283
282
|
|
|
284
283
|
`type: boolean`
|
|
285
284
|
|
|
286
285
|
The `invertAxis` boolean prop specifies whether the domain for a given axis should be inverted. By default, axes will be displayed with lower values on the bottom / left, and higher values on the top / right regardless of orientation.
|
|
287
286
|
|
|
288
|
-
|
|
287
|
+
_default:_ `invertAxis={false}`
|
|
289
288
|
|
|
290
289
|
### label
|
|
291
290
|
|
|
@@ -307,7 +306,7 @@ The `label` prop defines the label that will appear with a dependent axis. Label
|
|
|
307
306
|
|
|
308
307
|
The `labelPlacement` prop specifies how tick labels should be placed relative to the angular tick values. Options for this prop are "vertical", "parallel", and "perpendicular".
|
|
309
308
|
|
|
310
|
-
|
|
309
|
+
_default:_ `labelPlacement="parallel"`
|
|
311
310
|
|
|
312
311
|
```playground
|
|
313
312
|
<VictoryPolarAxis
|
|
@@ -322,7 +321,6 @@ The `labelPlacement` prop specifies how tick labels should be placed relative to
|
|
|
322
321
|
|
|
323
322
|
`VictoryPolarAxis` uses the standard `maxDomain` prop. [Read about it in detail](https://formidable.com/open-source/victory/docs/common-props#maxDomain)
|
|
324
323
|
|
|
325
|
-
|
|
326
324
|
```playground
|
|
327
325
|
<VictoryPolarAxis
|
|
328
326
|
dependentAxis
|
|
@@ -337,7 +335,6 @@ The `labelPlacement` prop specifies how tick labels should be placed relative to
|
|
|
337
335
|
|
|
338
336
|
`VictoryPolarAxis` uses the standard `minDomain` prop. [Read about it in detail](https://formidable.com/open-source/victory/docs/common-props#minDomain)
|
|
339
337
|
|
|
340
|
-
|
|
341
338
|
```playground
|
|
342
339
|
<VictoryPolarAxis
|
|
343
340
|
dependentAxis
|
|
@@ -353,7 +350,7 @@ The `labelPlacement` prop specifies how tick labels should be placed relative to
|
|
|
353
350
|
`VictoryPolarAxis` uses the standard `name` prop. [Read about it here](https://formidable.com/open-source/victory/docs/common-props#name)
|
|
354
351
|
|
|
355
352
|
```jsx
|
|
356
|
-
name="series-1"
|
|
353
|
+
name = "series-1";
|
|
357
354
|
```
|
|
358
355
|
|
|
359
356
|
### origin
|
|
@@ -370,7 +367,7 @@ name="series-1"
|
|
|
370
367
|
|
|
371
368
|
`VictoryPolarAxis` uses the standard `padding` prop. [Read about it here](https://formidable.com/open-source/victory/docs/common-props#padding)
|
|
372
369
|
|
|
373
|
-
|
|
370
|
+
_default (provided by default theme):_ `padding={50}`
|
|
374
371
|
|
|
375
372
|
```jsx
|
|
376
373
|
padding={{ top: 20, bottom: 60 }}
|
|
@@ -393,7 +390,7 @@ Options for scale include "linear", "time", "log", "sqrt" and the `d3-scale` fun
|
|
|
393
390
|
|
|
394
391
|
**note:** Though `VictoryPolarAxis` can take a `scale` prop with scales defined for both `x` and `y`, only the scale that corresponds the given axis will be used.
|
|
395
392
|
|
|
396
|
-
|
|
393
|
+
_default:_ `scale="linear"`
|
|
397
394
|
|
|
398
395
|
```jsx
|
|
399
396
|
scale={{x: "linear", y: "log"}}
|
|
@@ -417,7 +414,7 @@ scale={{x: "linear", y: "log"}}
|
|
|
417
414
|
|
|
418
415
|
**note:** When `VictoryPolarAxis` is nested within a component like `VictoryChart`, this prop will be set to `false`
|
|
419
416
|
|
|
420
|
-
|
|
417
|
+
_default:_ `standalone={true}`
|
|
421
418
|
|
|
422
419
|
```playground
|
|
423
420
|
<svg width={350} height={350}>
|
|
@@ -440,8 +437,7 @@ scale={{x: "linear", y: "log"}}
|
|
|
440
437
|
|
|
441
438
|
The `startAngle` props defines the overall end angle of the axis in degrees. This prop is used in conjunction with `endAngle` to create an axis that spans only a segment of a circle, or to change overall rotation of the axis. This prop should be given as a number of degrees. Degrees are defined as starting at the 3 o'clock position, and proceeding counterclockwise.
|
|
442
439
|
|
|
443
|
-
|
|
444
|
-
|
|
440
|
+
_default:_ `startAngle={0}`
|
|
445
441
|
|
|
446
442
|
```playground
|
|
447
443
|
<div style={{ display: "flex" }}>
|
|
@@ -469,7 +465,7 @@ The `style` prop defines the style of the component. The style prop should be gi
|
|
|
469
465
|
|
|
470
466
|
**note:** custom `angle` and `verticalAnchor` properties may be included in `labels` styles.
|
|
471
467
|
|
|
472
|
-
|
|
468
|
+
_default (provided by default theme):_ See [grayscale theme][] for more detail
|
|
473
469
|
|
|
474
470
|
```playground
|
|
475
471
|
<VictoryPolarAxis
|
|
@@ -489,9 +485,9 @@ The `style` prop defines the style of the component. The style prop should be gi
|
|
|
489
485
|
|
|
490
486
|
See the [Themes Guide][] for information about creating custom themes.
|
|
491
487
|
|
|
492
|
-
|
|
488
|
+
_default:_ `theme={VictoryTheme.grayscale}`
|
|
493
489
|
|
|
494
|
-
|
|
490
|
+
_Note:_ Use the `dependentAxis` and `independentAxis` namespaces to theme axes by type. These namespaces will be merged with any props and styles supplied in the `axis` namespace.
|
|
495
491
|
|
|
496
492
|
```jsx
|
|
497
493
|
theme={VictoryTheme.material}
|
|
@@ -503,7 +499,7 @@ theme={VictoryTheme.material}
|
|
|
503
499
|
|
|
504
500
|
The `tickComponent` prop takes a component instance which will be responsible for rendering a tick element. The new element created from the passed `tickComponent` will be provided with the following props calculated by `VictoryPolarAxis`: `x1`, `y1`, `x2`, `y2`, `tick`, `style` and `events`. Any of these props may be overridden by passing in props to the supplied component, or modified or ignored within the custom component itself. If a `tickComponent` is not provided, `VictoryPolarAxis` will use its default [Line component][].
|
|
505
501
|
|
|
506
|
-
|
|
502
|
+
_default:_ `tickComponent={<Line type={"tick"}/>}`
|
|
507
503
|
|
|
508
504
|
```jsx
|
|
509
505
|
tickComponent={<Line events={{ onClick: handleClick }}/>}
|
|
@@ -535,7 +531,7 @@ The `tickFormat` prop specifies how tick values should be labeled. The `tickForm
|
|
|
535
531
|
|
|
536
532
|
The `tickLabelComponent` prop takes a component instance which will be used to render the axis label. The new element created from the passed `tickLabelComponent` will be supplied with the following props: `x`, `y`, `tick`, `verticalAnchor`, `textAnchor`, `angle`, `transform`, `style` and `events`. Any of these props may be overridden by passing in props to the supplied component, or modified or ignored within the custom component itself. If `tickLabelComponent` is omitted, a new [`VictoryLabel`][] will be created with props described above.
|
|
537
533
|
|
|
538
|
-
|
|
534
|
+
_default:_ `tickLabelComponent={<VictoryLabel/>}`
|
|
539
535
|
|
|
540
536
|
```jsx
|
|
541
537
|
tickLabelComponent={<VictoryLabel dy={20}/>}
|
|
@@ -545,7 +541,7 @@ tickLabelComponent={<VictoryLabel dy={20}/>}
|
|
|
545
541
|
|
|
546
542
|
`type: array`
|
|
547
543
|
|
|
548
|
-
The `tickValues` prop explicitly specifies a set of tick values to draw on the axis. This prop should be given as an array of unique values of the same type (_i.e.,_ all numbers). The `tickValues` prop is used to specify the _values_ of each tick, so numeric values are typically appropriate. An array of strings or dates may be supplied for categorical and time series data respectively. Use the [tickFormat][] prop to specify how ticks should be labeled.
|
|
544
|
+
The `tickValues` prop explicitly specifies a set of tick values to draw on the axis. This prop should be given as an array of unique values of the same type (_i.e.,_ all numbers). The `tickValues` prop is used to specify the _values_ of each tick, so numeric values are typically appropriate. An array of strings or dates may be supplied for categorical and time series data respectively. Use the [tickFormat][] prop to specify how ticks should be labeled. _Note:_ `tickValues` should be given as a unique array.
|
|
549
545
|
|
|
550
546
|
```playground
|
|
551
547
|
<VictoryPolarAxis
|
|
@@ -560,19 +556,19 @@ The `tickValues` prop explicitly specifies a set of tick values to draw on the a
|
|
|
560
556
|
|
|
561
557
|
`VictoryPolarAxis` uses the standard `width` prop. [Read about it here](https://formidable.com/open-source/victory/docs/common-props#width)
|
|
562
558
|
|
|
563
|
-
|
|
559
|
+
_default (provided by default theme):_ `width={450}`
|
|
564
560
|
|
|
565
561
|
```jsx
|
|
566
562
|
width={400}
|
|
567
563
|
```
|
|
568
564
|
|
|
569
|
-
[
|
|
570
|
-
[
|
|
571
|
-
[
|
|
572
|
-
[`
|
|
573
|
-
[
|
|
574
|
-
[
|
|
565
|
+
[animations guide]: https://formidable.com/open-source/victory/guides/animations
|
|
566
|
+
[events guide]: https://formidable.com/open-source/victory/guides/events
|
|
567
|
+
[themes guide]: https://formidable.com/open-source/victory/guides/themes
|
|
568
|
+
[`victorychart`]: https://formidable.com/open-source/victory/docs/victory-chart
|
|
569
|
+
[tickformat]: https://formidable.com/open-source/victory/docs/victory-axis#tickformat
|
|
570
|
+
[d3scale]: https://github.com/d3/d3-scale
|
|
575
571
|
[grayscale theme]: https://github.com/FormidableLabs/victory-core/blob/master/src/victory-theme/grayscale.js
|
|
576
|
-
[
|
|
577
|
-
[
|
|
578
|
-
[`
|
|
572
|
+
[line component]: https://formidable.com/open-source/victory/docs/victory-primitives#line
|
|
573
|
+
[arc component]: https://formidable.com/open-source/victory/docs/victory-primitives#arc
|
|
574
|
+
[`victorylabel`]: https://formidable.com/open-source/victory/docs/victory-label
|