1
1
import { svgDefaultProps } from '@nivo/radial-bar'
2
- import { defaultProps } from '@nivo/pie'
3
2
import { arcTransitionModes } from '@nivo/arcs'
4
3
import { themeProperty , motionProperties , groupProperties } from '../../../lib/componentProperties'
5
4
import { ChartProperty } from '../../../types'
@@ -188,9 +187,82 @@ const props: ChartProperty[] = [
188
187
step : 1 ,
189
188
} ,
190
189
} ,
190
+ {
191
+ key : 'enableLabels' ,
192
+ group : 'Labels' ,
193
+ type : 'boolean' ,
194
+ required : false ,
195
+ help : 'Enable/disable labels.' ,
196
+ flavors : [ 'svg' ] ,
197
+ defaultValue : svgDefaultProps . enableLabels ,
198
+ controlType : 'switch' ,
199
+ } ,
200
+ {
201
+ key : 'label' ,
202
+ group : 'Labels' ,
203
+ type : 'string | (bar: ComputedBar) => string' ,
204
+ required : false ,
205
+ help :
206
+ 'Defines how to get label text, can be a string (used to access current bar property) or a function which will receive the actual bar data.' ,
207
+ flavors : [ 'svg' ] ,
208
+ defaultValue : svgDefaultProps . label ,
209
+ controlType : 'choices' ,
210
+ controlOptions : {
211
+ choices : [ 'category' , 'groupId' , 'value' , 'formattedValue' ] . map ( choice => ( {
212
+ label : choice ,
213
+ value : choice ,
214
+ } ) ) ,
215
+ } ,
216
+ } ,
217
+ {
218
+ key : 'labelsSkipAngle' ,
219
+ group : 'Labels' ,
220
+ type : 'number' ,
221
+ required : false ,
222
+ help : `Skip label if corresponding arc's angle is lower than provided value.` ,
223
+ flavors : [ 'svg' ] ,
224
+ defaultValue : svgDefaultProps . labelsSkipAngle ,
225
+ controlType : 'range' ,
226
+ controlOptions : {
227
+ unit : '°' ,
228
+ min : 0 ,
229
+ max : 45 ,
230
+ step : 1 ,
231
+ } ,
232
+ } ,
233
+ {
234
+ key : 'labelsRadiusOffset' ,
235
+ group : 'Labels' ,
236
+ type : 'number' ,
237
+ required : false ,
238
+ help : `
239
+ Define the radius to use to determine the label position, starting from inner radius,
240
+ this is expressed as a ratio. Centered at 0.5 by default.
241
+ ` ,
242
+ flavors : [ 'svg' ] ,
243
+ defaultValue : svgDefaultProps . labelsRadiusOffset ,
244
+ controlType : 'range' ,
245
+ controlOptions : {
246
+ min : 0 ,
247
+ max : 2 ,
248
+ step : 0.05 ,
249
+ } ,
250
+ } ,
251
+ {
252
+ key : 'labelsTextColor' ,
253
+ group : 'Labels' ,
254
+ help : 'Defines how to compute label text color.' ,
255
+ type : 'string | object | Function' ,
256
+ required : false ,
257
+ flavors : [ 'svg' ] ,
258
+ defaultValue : svgDefaultProps . labelsTextColor ,
259
+ controlType : 'inheritedColor' ,
260
+ } ,
191
261
{
192
262
key : 'layers' ,
193
263
group : 'Customization' ,
264
+ type : '(RadialBarLayerId | RadialBarCustomLayer)[]' ,
265
+ required : false ,
194
266
help : 'Defines the order of layers and add custom layers.' ,
195
267
description : `
196
268
You can also use this to insert extra layers
@@ -199,8 +271,6 @@ const props: ChartProperty[] = [
199
271
The layer function which will receive the chart's
200
272
context & computed data and must return a valid SVG element.
201
273
` ,
202
- required : false ,
203
- type : '(RadarLayerId | FunctionComponent<RadarCustomLayerProps>)[]' ,
204
274
flavors : [ 'svg' ] ,
205
275
defaultValue : svgDefaultProps . layers ,
206
276
} ,
@@ -293,7 +363,7 @@ const props: ChartProperty[] = [
293
363
help : 'Define how transitions behave.' ,
294
364
type : 'string' ,
295
365
required : false ,
296
- defaultValue : defaultProps . transitionMode ,
366
+ defaultValue : svgDefaultProps . transitionMode ,
297
367
controlType : 'choices' ,
298
368
group : 'Motion' ,
299
369
controlOptions : {
0 commit comments