@@ -389,26 +389,108 @@ export interface ScaleOptions extends ScaleDefaults {
389
389
*/
390
390
paddingOuter ?: number ;
391
391
392
- // axis and legend options
393
- legend ?: LegendType | boolean | null ; // for color, opacity, and symbol scales
392
+ /**
393
+ * If true, produces a legend for the scale (only *color*, *opacity*, and
394
+ * *symbol* scales are currently supported). For quantitative color scales,
395
+ * the legend defaults to *ramp* but may be set to *swatches* for discrete
396
+ * scale types such as *threshold*. An opacity scale is treated as a color
397
+ * scale with varying transparency. The symbol legend is combined with color
398
+ * if they encode the same channels. For more control, see *plot*.**legend**.
399
+ */
400
+ legend ?: LegendType | boolean | null ;
401
+
402
+ /**
403
+ * For a continuous scale axis (or *ramp* color legend), defines the ticks as
404
+ * an approximate number of ticks, an explicit array of tick values, or an
405
+ * interval such as *day* or *month*.
406
+ */
394
407
ticks ?: number | RangeInterval | Iterable < any > ;
408
+
409
+ /**
410
+ * The length of tick vectors in pixels; negative values extend in the
411
+ * opposite direction.
412
+ */
395
413
tickSize ?: number ;
414
+
415
+ /**
416
+ * The default approximate number of ticks is computed as the ratio between
417
+ * the axis’s length and this option, which defaults to 80 pixels for *x* and
418
+ * *fx*, and 35 pixels for *y* and *fy*.
419
+ */
396
420
tickSpacing ?: number ;
421
+
422
+ /**
423
+ * The separation between the tick vector and its label (in pixels; default
424
+ * 3).
425
+ */
397
426
tickPadding ?: number ;
427
+
428
+ /**
429
+ * The tick label format specifier. String specifiers are passed to
430
+ * [d3-format](https://github.com/d3/d3-format) for numeric scales, and
431
+ * [d3-time-format](https://github.com/d3/d3-time-format) for *time* and *utc*
432
+ * scales. If a function, it is passed the tick value and tick index, and
433
+ * returns a string. Plot also provides multilingual format helpers for
434
+ * convenience: **formatIsoDate**, **formatWeekDay** and **formatMonth**.
435
+ */
398
436
tickFormat ?: string | ( ( t : any , i : number ) => any ) | null ;
437
+
438
+ /**
439
+ * The rotation angle of tick labels in degrees (default 0).
440
+ */
399
441
tickRotate ?: number ;
442
+
443
+ /**
444
+ * The font-variant attribute for axis ticks; defaults to tabular-nums for
445
+ * quantitative axes.
446
+ */
400
447
fontVariant ?: string ;
448
+
449
+ /**
450
+ * A short label representing the axis in the accessibility tree.
451
+ */
401
452
ariaLabel ?: string ;
453
+
454
+ /**
455
+ * A textual description for the axis.
456
+ */
402
457
ariaDescription ?: string ;
458
+
459
+ /**
460
+ * Anchor for the axis label.
461
+ */
403
462
labelAnchor ?: "top" | "right" | "bottom" | "left" | "center" ;
404
463
labelOffset ?: number ;
464
+
465
+ /**
466
+ * Whether a line should be drawn on the axis.
467
+ */
405
468
line ?: boolean ;
406
469
}
407
470
408
471
export interface Scale extends ScaleOptions {
472
+ /**
473
+ * The scale’s materialized bandwidth (for a point or band scale); equal to
474
+ * the step minus any padding.
475
+ */
409
476
bandwidth ?: number ;
477
+
478
+ /**
479
+ * The scale’s materialized step (for a point or band scale), denoting the
480
+ * distance between two consecutive ticks, in pixels. See bandwidth.
481
+ */
410
482
step ?: number ;
483
+
484
+ /**
485
+ * The scale’s materialized forward function, transforming a value in the
486
+ * input domain into a value in the output range.
487
+ */
411
488
apply ( t : any ) : any ;
489
+
490
+ /**
491
+ * The scale’s materialized reverse function, returning a value in the input
492
+ * domain from a given value in the output range.
493
+ */
412
494
invert ?( t : any ) : any ;
413
495
}
414
496
0 commit comments