billboard.js 3.6.2 → 3.7.0-next.1

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.
Files changed (57) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +529 -167
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +1723 -1277
  6. package/dist/billboard.pkgd.min.js +4 -2
  7. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-sparkline.js +35 -3
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +35 -3
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +35 -3
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +35 -3
  16. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  17. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +933 -923
  18. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +966 -924
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +966 -924
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +966 -924
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +966 -924
  22. package/dist/theme/datalab.css +1 -1
  23. package/dist/theme/datalab.min.css +1 -1
  24. package/dist/theme/graph.css +1 -1
  25. package/dist/theme/graph.min.css +1 -1
  26. package/dist/theme/insight.css +1 -1
  27. package/dist/theme/insight.min.css +1 -1
  28. package/dist-esm/billboard.js +375 -108
  29. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  30. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
  31. package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
  32. package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
  33. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  34. package/package.json +40 -35
  35. package/src/Chart/api/chart.ts +13 -4
  36. package/src/Chart/api/export.ts +159 -14
  37. package/src/ChartInternal/Axis/Axis.ts +1 -1
  38. package/src/ChartInternal/Axis/AxisRendererHelper.ts +4 -2
  39. package/src/ChartInternal/data/IData.ts +1 -0
  40. package/src/ChartInternal/data/data.ts +21 -2
  41. package/src/ChartInternal/interactions/interaction.ts +6 -7
  42. package/src/ChartInternal/internals/domain.ts +11 -4
  43. package/src/ChartInternal/internals/format.ts +1 -1
  44. package/src/ChartInternal/internals/grid.ts +1 -1
  45. package/src/ChartInternal/shape/arc.ts +145 -68
  46. package/src/ChartInternal/shape/area.ts +3 -0
  47. package/src/ChartInternal/shape/bar.ts +3 -0
  48. package/src/ChartInternal/shape/line.ts +12 -15
  49. package/src/config/Options/common/tooltip.ts +11 -8
  50. package/src/config/Options/shape/arc.ts +47 -0
  51. package/src/config/Options/shape/gauge.ts +2 -2
  52. package/src/config/resolver/shape.ts +13 -4
  53. package/src/module/util.ts +1 -1
  54. package/types/chart.d.ts +7 -0
  55. package/types/options.d.ts +39 -624
  56. package/types/options.shape.d.ts +633 -0
  57. package/types/types.d.ts +2 -2
@@ -0,0 +1,633 @@
1
+ /**
2
+ * Copyright (c) 2017 ~ present NAVER Corp.
3
+ * billboard.js project is licensed under the MIT license
4
+ */
5
+ import {DataItem, GaugeTypes} from "./types";
6
+ import {Chart} from "./chart";
7
+
8
+ export interface ArcOptions {
9
+ /**
10
+ * Set corner radius of Arc(donut/gauge/pie/polar) shape.
11
+ * - **NOTE:**
12
+ * - Corner radius can't surpass the `(outerRadius - innerRadius) /2` of indicated shape.
13
+ */
14
+ cornerRadius?: number | ((id: string, value: number, outerRadius: number) => number) | {
15
+ ratio?: number
16
+ };
17
+ }
18
+
19
+ export interface AreaOptions {
20
+ /**
21
+ * Set background area above the data chart line.
22
+ */
23
+ above?: boolean;
24
+
25
+ /**
26
+ * Set background area `below` the data chart line.
27
+ * - **NOTE**: Can't be used along with `above` option. When above & below options are set to true, `above` will be prioritized.
28
+ */
29
+ below?: boolean;
30
+
31
+ /**
32
+ * Set area node to be positioned over line node.
33
+ */
34
+ front?: boolean;
35
+
36
+ /**
37
+ * Set the linear gradient on area.<br><br>
38
+ * Or customize by giving below object value:
39
+ * - x {Array}: `x1`, `x2` value
40
+ * - y {Array}: `y1`, `y2` value
41
+ * - stops {Array}: Each item should be having `[offset, stop-color, stop-opacity]` values.
42
+ */
43
+ linearGradient?: boolean | LinearGradientOptions;
44
+
45
+ /**
46
+ * Set if min or max value will be 0 on area chart.
47
+ */
48
+ zerobased?: boolean;
49
+ }
50
+
51
+ export interface BarOptions {
52
+ /**
53
+ * Set threshold ratio to show/hide labels.
54
+ */
55
+ label?: {
56
+ threshold?: number;
57
+ };
58
+
59
+ /**
60
+ * Remove nullish data on bar indices positions.
61
+ */
62
+ indices?: {
63
+ removeNull?: boolean;
64
+ };
65
+
66
+ /**
67
+ * Set the linear gradient on bar.<br><br>
68
+ * Or customize by giving below object value:
69
+ * - x {Array}: `x1`, `x2` value
70
+ * - y {Array}: `y1`, `y2` value
71
+ * - stops {Array}: Each item should be having `[offset, stop-color, stop-opacity]` values.
72
+ */
73
+ linearGradient?: boolean | LinearGradientOptions;
74
+
75
+ /**
76
+ * Bars will be rendered at same position, which will be overlapped each other. (for non-grouped bars only)
77
+ */
78
+ orverlap?: boolean;
79
+
80
+ /**
81
+ * The padding pixel value between each bar.
82
+ */
83
+ padding?: number;
84
+
85
+ /**
86
+ * Set the radius of bar edge in pixel.
87
+ * - NOTE: Only for non-stacking bars.
88
+ */
89
+ radius?: number | {
90
+ /**
91
+ * Set the radius ratio of bar edge in relative the bar's width.
92
+ */
93
+ ratio?: number;
94
+ };
95
+
96
+ /**
97
+ * The senstivity offset value for interaction boundary.
98
+ */
99
+ sensitivity?: number;
100
+
101
+ /**
102
+ * Change the width of bar chart. If ratio is specified, change the width of bar chart by ratio.
103
+ */
104
+ width?: number | {
105
+ /**
106
+ * Set the width of each bar by ratio
107
+ */
108
+ ratio: number;
109
+
110
+ /**
111
+ * Set max width of each bar
112
+ */
113
+ max?: number;
114
+ } | {
115
+ /**
116
+ * Set the width option for specific dataset
117
+ */
118
+ [key: string]: number | {
119
+ ratio: number;
120
+ max: number;
121
+ }
122
+ };
123
+
124
+ /**
125
+ * Set if min or max value will be 0 on bar chart.
126
+ */
127
+ zerobased?: boolean;
128
+ }
129
+
130
+ export interface BubbleOptions {
131
+ /**
132
+ * Set the max bubble radius value
133
+ */
134
+ maxR?: ((this: Chart, d: {}) => number) | number;
135
+
136
+ /**
137
+ * Set if min or max value will be 0 on bubble chart.
138
+ */
139
+ zerobased?: boolean;
140
+ }
141
+
142
+ export interface CandlestickOptions {
143
+ /**
144
+ * Change the width of bar chart. If ratio is specified, change the width of bar chart by ratio.
145
+ */
146
+ width?: number | {
147
+ /**
148
+ * Set the width of each bar by ratio
149
+ */
150
+ ratio: number;
151
+
152
+ /**
153
+ * Set max width of each bar
154
+ */
155
+ max?: number;
156
+ } | {
157
+ /**
158
+ * Set the width option for specific dataset
159
+ */
160
+ [key: string]: number | {
161
+ ratio: number;
162
+ max: number;
163
+ }
164
+ };
165
+
166
+ color?: {
167
+ /**
168
+ * Change down value color.
169
+ */
170
+ down: string | {
171
+ /**
172
+ * Change down value color for indicated dataset only.
173
+ */
174
+ [key: string]: string;
175
+ }
176
+ };
177
+ }
178
+
179
+ export interface DonutOptions {
180
+ label?: {
181
+ /**
182
+ * Show or hide label on each donut piece.
183
+ */
184
+ show?: boolean;
185
+
186
+ /**
187
+ * Set formatter for the label on each donut piece.
188
+ */
189
+ format?: (this: Chart, value: number, ratio: number, id: string) => string;
190
+
191
+ /**
192
+ * Set ratio of labels position.
193
+ */
194
+ ratio?: number | ((this: Chart, d: DataItem, radius: number, h: number) => number)
195
+
196
+ /**
197
+ * Set threshold ratio to show/hide labels.
198
+ */
199
+ threshold?: number;
200
+ };
201
+
202
+ /**
203
+ * Enable or disable expanding donut pieces.
204
+ */
205
+ expand?: boolean | {
206
+ /**
207
+ * Set expand transition time in ms.
208
+ */
209
+ duration?: number;
210
+
211
+ /**
212
+ * Set expand rate.
213
+ */
214
+ rate?: number;
215
+ };
216
+
217
+ /**
218
+ * Set padding between data.
219
+ */
220
+ padAngle?: number;
221
+
222
+ /**
223
+ * Set starting angle where data draws.
224
+ */
225
+ startingAngle?: number;
226
+
227
+ /**
228
+ * Set width of donut chart.
229
+ */
230
+ width?: number;
231
+
232
+ /**
233
+ * Set title of donut chart.
234
+ */
235
+ title?: string;
236
+ }
237
+
238
+ export interface GaugeOptions {
239
+ /**
240
+ * Set background color. (The `.bb-chart-arcs-background` element)
241
+ */
242
+ background?: string;
243
+
244
+ /**
245
+ * Whether this should be displayed
246
+ * as a full circle instead of a
247
+ * half circle.
248
+ */
249
+ fullCircle?: boolean;
250
+
251
+ label?: {
252
+ /**
253
+ * Show or hide label on gauge.
254
+ */
255
+ show?: boolean;
256
+
257
+ /**
258
+ * Set formatter for the label on gauge.
259
+ */
260
+ format?(this: Chart, value: any, ratio: number, id: string): string;
261
+
262
+ /**
263
+ * Set customized min/max label text.
264
+ */
265
+ extents?(this: Chart, value: number, isMax: boolean): string | number;
266
+
267
+ /**
268
+ * Set threshold ratio to show/hide labels.
269
+ */
270
+ threshold?: number;
271
+ };
272
+
273
+ /**
274
+ * Enable or disable expanding gauge pieces.
275
+ */
276
+ expand?: boolean | {
277
+ /**
278
+ * Set expand transition time in ms.
279
+ */
280
+ duration?: number;
281
+
282
+ /**
283
+ * Set expand rate.
284
+ */
285
+ rate?: number;
286
+ };
287
+
288
+ /**
289
+ * Set type of the gauge.
290
+ */
291
+ type?: GaugeTypes;
292
+
293
+ /**
294
+ * Set min value of the gauge.
295
+ */
296
+ min?: number;
297
+
298
+ /**
299
+ * Set max value of the gauge.
300
+ */
301
+ max?: number;
302
+
303
+ /**
304
+ * Set starting angle where data draws.
305
+ */
306
+ startingAngle?: number;
307
+
308
+ /**
309
+ * Set title of gauge chart. Use `\n` character to enter line break.
310
+ */
311
+ title?: string;
312
+
313
+ /**
314
+ * Set units of the gauge.
315
+ */
316
+ units?: string;
317
+
318
+ /**
319
+ * Set width of gauge chart.
320
+ */
321
+ width?: number;
322
+
323
+ /**
324
+ * Set minimal width of gauge arcs until the innerRadius disappears.
325
+ */
326
+ arcs?: {
327
+ minWidth?: number;
328
+ };
329
+
330
+ /**
331
+ * Set the length of the arc to be drawn in percent from -100 to 100.
332
+ * Negative value will draw the arc **counterclockwise**.
333
+ */
334
+ arcLength?: number;
335
+ }
336
+
337
+ export interface LineOptions {
338
+ /**
339
+ * Set if null data point will be connected or not.
340
+ * If true set, the region of null data will be connected without any data point.
341
+ * If false set, the region of null data will not be connected and get empty.
342
+ */
343
+ connectNull?: boolean;
344
+
345
+ /**
346
+ * Change step type for step chart.
347
+ * 'step', 'step-before' and 'step-after' can be used.
348
+ */
349
+ step?: {
350
+ type?: "step" | "step-before" | "step-after";
351
+ };
352
+
353
+ /**
354
+ * Set if min or max value will be 0 on line chart.
355
+ */
356
+ zerobased?: boolean;
357
+
358
+ /**
359
+ * If set, used to set a css class on each line.
360
+ */
361
+ classes?: string[];
362
+
363
+ /**
364
+ * Set to false to not draw points on linecharts. Or pass an array of line ids to draw points for.
365
+ */
366
+ point?: boolean | string[];
367
+ }
368
+
369
+ export interface PieOptions {
370
+ label?: {
371
+ /**
372
+ * Show or hide label on each pie piece.
373
+ */
374
+ show?: boolean;
375
+
376
+ /**
377
+ * Set threshold ratio to show/hide labels.
378
+ */
379
+ threshold?: number;
380
+
381
+ /**
382
+ * Set formatter for the label on each pie piece.
383
+ */
384
+ format?(this: Chart, value: number, ratio: number, id: string): string;
385
+
386
+ /**
387
+ * Set ratio of labels position.
388
+ */
389
+ ratio?: ((this: Chart, d: DataItem, radius: number, h: number) => void) | number
390
+ };
391
+
392
+ /**
393
+ * Enable or disable expanding pie pieces.
394
+ */
395
+ expand?: boolean | {
396
+ /**
397
+ * Set expand transition time in ms.
398
+ */
399
+ duration?: number;
400
+
401
+ /**
402
+ * Set expand rate.
403
+ */
404
+ rate?: number;
405
+ };
406
+
407
+ /**
408
+ * Sets the inner radius of pie arc.
409
+ */
410
+ innerRadius?: number | {
411
+ [key: string]: number
412
+ };
413
+
414
+ /**
415
+ * Sets the outer radius of pie arc.
416
+ */
417
+ outerRadius?: number | {
418
+ [key: string]: number
419
+ };
420
+
421
+ /**
422
+ * Set padding between data.
423
+ */
424
+ padAngle?: number;
425
+
426
+ /**
427
+ * Sets the gap between pie arcs.
428
+ */
429
+ padding?: number;
430
+
431
+ /**
432
+ * Set starting angle where data draws.
433
+ */
434
+ startingAngle?: number;
435
+ }
436
+
437
+ export interface PolarOptions {
438
+ label?: {
439
+ /**
440
+ * Show or hide label on each polar piece.
441
+ */
442
+ show?: boolean;
443
+
444
+ /**
445
+ * Set threshold ratio to show/hide labels.
446
+ */
447
+ threshold?: number;
448
+
449
+ /**
450
+ * Set formatter for the label on each polar piece.
451
+ */
452
+ format?(this: Chart, value: number, ratio: number, id: string): string;
453
+
454
+ /**
455
+ * Set ratio of labels position.
456
+ */
457
+ ratio?: ((this: Chart, d: DataItem, radius: number, h: number) => void) | number
458
+ };
459
+ level?: {
460
+ /**
461
+ * Set the level depth.
462
+ */
463
+ depth?: number;
464
+
465
+ /**
466
+ * Set level max value.
467
+ */
468
+ max?: number;
469
+
470
+ /**
471
+ * Show or hide level.
472
+ */
473
+ show?: boolean;
474
+
475
+ text?: {
476
+ /**
477
+ * Set label text's background color.
478
+ */
479
+ backgroundColor?: string;
480
+
481
+ /**
482
+ * Set format function for the level value.
483
+ */
484
+ format?: (this: Chart, x: string) => string;
485
+
486
+ /**
487
+ * Show or hide level text.
488
+ */
489
+ show?: boolean;
490
+ }
491
+ };
492
+
493
+ /**
494
+ * Set padding between data.
495
+ */
496
+ padAngle?: number;
497
+
498
+ /**
499
+ * Sets the gap between pie arcs.
500
+ */
501
+ padding?: number;
502
+
503
+ /**
504
+ * Set starting angle where data draws.
505
+ */
506
+ startAngle?: number;
507
+ }
508
+
509
+ export interface RadarOptions {
510
+ axis?: {
511
+ /**
512
+ * The max value of axis. If not given, it'll take the max value from the given data.
513
+ */
514
+ max?: number;
515
+
516
+ line?: {
517
+ /**
518
+ * Show or hide axis line.
519
+ */
520
+ show?: boolean;
521
+ };
522
+
523
+ text?: {
524
+ position?: {
525
+ /**
526
+ * x coordinate position, relative the original
527
+ */
528
+ x?: number;
529
+
530
+ /**
531
+ * y coordinate position, relative the original
532
+ */
533
+ y?: number;
534
+ };
535
+
536
+ /**
537
+ * Show or hide axis text.
538
+ */
539
+ show?: boolean;
540
+ };
541
+ };
542
+
543
+ direction?: {
544
+ /**
545
+ * Set the direction to be drawn.
546
+ */
547
+ clockwise?: boolean;
548
+ };
549
+
550
+ level?: {
551
+ /**
552
+ * Set the level depth.
553
+ */
554
+ depth?: number;
555
+
556
+ /**
557
+ * Show or hide level.
558
+ */
559
+ show?: boolean;
560
+
561
+ text?: {
562
+ /**
563
+ * Set format function for the level value.
564
+ */
565
+ format?: (this: Chart, x: string) => string;
566
+
567
+ /**
568
+ * Show or hide level text.
569
+ */
570
+ show?: boolean;
571
+ };
572
+ };
573
+
574
+ size?: {
575
+ /**
576
+ * Set size ratio.
577
+ */
578
+ ratio?: number;
579
+ };
580
+ }
581
+
582
+ export interface ScatterOptions {
583
+ /**
584
+ * Set if min or max value will be 0 on scatter chart.
585
+ */
586
+ zerobased?: boolean;
587
+ }
588
+
589
+ export interface SplineOptions {
590
+ interpolation?: {
591
+ /**
592
+ * Set custom spline interpolation
593
+ */
594
+ type?: "basis"
595
+ | "basis-open"
596
+ | "bundle"
597
+ | "cardinal"
598
+ | "cardinal-closed"
599
+ | "cardinal-open"
600
+ | "catmull-rom"
601
+ | "catmull-rom-closed"
602
+ | "catmull-rom-open"
603
+ | "monotone-x"
604
+ | "monotone-y"
605
+ | "natural"
606
+ | "linear-closed"
607
+ | "linear"
608
+ | "step"
609
+ | "step-after"
610
+ | "step-before"
611
+ };
612
+ }
613
+
614
+ export interface LinearGradientOptions {
615
+ /**
616
+ * x1, x2 attributes
617
+ */
618
+ x?: [number, number];
619
+
620
+ /**
621
+ * y1, y2 attributes
622
+ */
623
+ y?: [number, number];
624
+
625
+ /**
626
+ * The ramp of colors to use on a gradient
627
+ *
628
+ * offset, stop-color, stop-opacity
629
+ * - setting 'null' for stop-color, will set its original data color
630
+ * - setting 'function' for stop-color, will pass data id as argument. It should return color string or null value
631
+ */
632
+ stops?: Array<[number, string | null | ((this: Chart, id: string) => string), number]>;
633
+ }
package/types/types.d.ts CHANGED
@@ -2,8 +2,8 @@
2
2
  * Copyright (c) 2017 ~ present NAVER Corp.
3
3
  * billboard.js project is licensed under the MIT license
4
4
  */
5
- import {Selection} from "d3-selection";
6
- import {Transition} from "d3-transition";
5
+ import type {Selection} from "d3-selection";
6
+ import type {Transition} from "d3-transition";
7
7
 
8
8
  export type PrimitiveArray = Array<
9
9
  string | boolean | number | Date | null |