billboard.js 4.0.3 → 4.1.0-next.2

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 (271) hide show
  1. package/README.md +82 -7
  2. package/dist/billboard.css +1 -1
  3. package/dist/billboard.js +1848 -494
  4. package/dist/billboard.min.css +1 -1
  5. package/dist/billboard.min.js +19 -24
  6. package/dist/billboard.pkgd.js +1844 -679
  7. package/dist/billboard.pkgd.min.js +24 -29
  8. package/dist/billboard.react.js +205 -0
  9. package/dist/billboard.react.min.js +9 -0
  10. package/dist/billboard.worker.js +10 -0
  11. package/dist/plugin/billboardjs-plugin-bubblecompare.js +5 -3
  12. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-sparkline.js +6 -3
  14. package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
  15. package/dist/plugin/billboardjs-plugin-stanford.js +6 -3
  16. package/dist/plugin/billboardjs-plugin-stanford.min.js +3 -3
  17. package/dist/plugin/billboardjs-plugin-tableview.js +59 -27
  18. package/dist/plugin/billboardjs-plugin-tableview.min.js +5 -5
  19. package/dist/plugin/billboardjs-plugin-textoverlap.js +75 -55
  20. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  21. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +5 -3
  22. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
  23. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +6 -3
  24. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +3 -3
  25. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +6 -3
  26. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +2 -2
  27. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +59 -27
  28. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +11 -11
  29. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +68 -3557
  30. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +8 -8
  31. package/dist/theme/dark.css +1 -1
  32. package/dist/theme/dark.min.css +1 -1
  33. package/dist/theme/datalab.css +1 -1
  34. package/dist/theme/datalab.min.css +1 -1
  35. package/dist/theme/graph.css +1 -1
  36. package/dist/theme/graph.min.css +1 -1
  37. package/dist/theme/insight.css +1 -1
  38. package/dist/theme/insight.min.css +1 -1
  39. package/dist/theme/modern.css +1 -1
  40. package/dist/theme/modern.min.css +1 -1
  41. package/dist-esm/Chart/Chart.js +134 -152
  42. package/dist-esm/Chart/api/axis.js +217 -237
  43. package/dist-esm/Chart/api/category.js +54 -54
  44. package/dist-esm/Chart/api/chart.js +172 -215
  45. package/dist-esm/Chart/api/color.js +21 -21
  46. package/dist-esm/Chart/api/data.js +172 -173
  47. package/dist-esm/Chart/api/export.js +242 -262
  48. package/dist-esm/Chart/api/flow.js +198 -254
  49. package/dist-esm/Chart/api/focus.js +136 -143
  50. package/dist-esm/Chart/api/grid.js +191 -190
  51. package/dist-esm/Chart/api/group.js +31 -34
  52. package/dist-esm/Chart/api/legend.js +54 -63
  53. package/dist-esm/Chart/api/load.js +237 -257
  54. package/dist-esm/Chart/api/regions.js +148 -168
  55. package/dist-esm/Chart/api/selection.js +181 -139
  56. package/dist-esm/Chart/api/show.js +133 -147
  57. package/dist-esm/Chart/api/stubs.js +43 -42
  58. package/dist-esm/Chart/api/subchart.js +155 -172
  59. package/dist-esm/Chart/api/tooltip.js +132 -177
  60. package/dist-esm/Chart/api/x.js +67 -71
  61. package/dist-esm/Chart/api/zoom.js +183 -220
  62. package/dist-esm/ChartInternal/Axis/Axis.js +1059 -1266
  63. package/dist-esm/ChartInternal/Axis/AxisRenderer.js +408 -540
  64. package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +113 -149
  65. package/dist-esm/ChartInternal/ChartInternal.js +573 -749
  66. package/dist-esm/ChartInternal/data/convert.helper.js +133 -159
  67. package/dist-esm/ChartInternal/data/convert.js +200 -229
  68. package/dist-esm/ChartInternal/data/data.js +967 -1153
  69. package/dist-esm/ChartInternal/data/load.js +145 -197
  70. package/dist-esm/ChartInternal/interactions/drag.js +86 -122
  71. package/dist-esm/ChartInternal/interactions/eventrect.js +455 -621
  72. package/dist-esm/ChartInternal/interactions/flow.js +151 -215
  73. package/dist-esm/ChartInternal/interactions/interaction.js +214 -252
  74. package/dist-esm/ChartInternal/interactions/subchart.js +425 -300
  75. package/dist-esm/ChartInternal/interactions/zoom.js +321 -440
  76. package/dist-esm/ChartInternal/internals/category.js +18 -18
  77. package/dist-esm/ChartInternal/internals/class.js +89 -99
  78. package/dist-esm/ChartInternal/internals/clip.js +88 -119
  79. package/dist-esm/ChartInternal/internals/color.js +233 -288
  80. package/dist-esm/ChartInternal/internals/domain.js +452 -588
  81. package/dist-esm/ChartInternal/internals/format.js +64 -77
  82. package/dist-esm/ChartInternal/internals/grid.js +333 -457
  83. package/dist-esm/ChartInternal/internals/legend.js +675 -927
  84. package/dist-esm/ChartInternal/internals/redraw.js +200 -289
  85. package/dist-esm/ChartInternal/internals/region.js +106 -159
  86. package/dist-esm/ChartInternal/internals/scale.js +186 -215
  87. package/dist-esm/ChartInternal/internals/selection.js +132 -159
  88. package/dist-esm/ChartInternal/internals/size.axis.js +92 -139
  89. package/dist-esm/ChartInternal/internals/size.js +286 -394
  90. package/dist-esm/ChartInternal/internals/style.js +39 -41
  91. package/dist-esm/ChartInternal/internals/subchart.util.js +49 -0
  92. package/dist-esm/ChartInternal/internals/text.arc.js +155 -219
  93. package/dist-esm/ChartInternal/internals/text.js +368 -528
  94. package/dist-esm/ChartInternal/internals/text.util.js +179 -239
  95. package/dist-esm/ChartInternal/internals/title.js +96 -121
  96. package/dist-esm/ChartInternal/internals/tooltip.js +450 -586
  97. package/dist-esm/ChartInternal/internals/transform.js +79 -97
  98. package/dist-esm/ChartInternal/internals/type.js +285 -236
  99. package/dist-esm/ChartInternal/shape/arc.js +825 -1112
  100. package/dist-esm/ChartInternal/shape/area.js +73 -94
  101. package/dist-esm/ChartInternal/shape/bar.js +227 -288
  102. package/dist-esm/ChartInternal/shape/bubble.js +9 -8
  103. package/dist-esm/ChartInternal/shape/candlestick.js +110 -138
  104. package/dist-esm/ChartInternal/shape/core/barRadius.js +197 -133
  105. package/dist-esm/ChartInternal/shape/core/bubble.js +64 -73
  106. package/dist-esm/ChartInternal/shape/core/candlestick.js +93 -86
  107. package/dist-esm/ChartInternal/shape/core/dataRegion.js +68 -75
  108. package/dist-esm/ChartInternal/shape/core/geometry.js +112 -112
  109. package/dist-esm/ChartInternal/shape/core/path.js +142 -115
  110. package/dist-esm/ChartInternal/shape/core/point.js +105 -125
  111. package/dist-esm/ChartInternal/shape/core/treemap.js +83 -88
  112. package/dist-esm/ChartInternal/shape/funnel.js +310 -338
  113. package/dist-esm/ChartInternal/shape/gauge.js +71 -103
  114. package/dist-esm/ChartInternal/shape/line.js +208 -278
  115. package/dist-esm/ChartInternal/shape/point.js +310 -425
  116. package/dist-esm/ChartInternal/shape/polar.js +84 -109
  117. package/dist-esm/ChartInternal/shape/radar.js +228 -318
  118. package/dist-esm/ChartInternal/shape/shape.js +782 -843
  119. package/dist-esm/ChartInternal/shape/treemap.js +152 -190
  120. package/dist-esm/canvas/CanvasAxisRenderer.js +1180 -1328
  121. package/dist-esm/canvas/CanvasEngine.js +148 -166
  122. package/dist-esm/canvas/CanvasPainter.js +395 -411
  123. package/dist-esm/canvas/CanvasRenderer.js +1584 -1834
  124. package/dist-esm/canvas/CanvasTheme.js +899 -802
  125. package/dist-esm/canvas/HitDetector.js +394 -463
  126. package/dist-esm/canvas/axisTicks.js +672 -786
  127. package/dist-esm/canvas/classes.js +19 -17
  128. package/dist-esm/canvas/color.js +40 -59
  129. package/dist-esm/canvas/geometry.js +38 -38
  130. package/dist-esm/canvas/labels.js +318 -371
  131. package/dist-esm/canvas/pointPattern.js +578 -580
  132. package/dist-esm/canvas/util.js +242 -262
  133. package/dist-esm/config/Options/Options.js +29 -32
  134. package/dist-esm/config/Options/axis/axis.js +101 -101
  135. package/dist-esm/config/Options/axis/x.js +759 -755
  136. package/dist-esm/config/Options/axis/y.js +525 -522
  137. package/dist-esm/config/Options/axis/y2.js +501 -485
  138. package/dist-esm/config/Options/common/boost.js +93 -32
  139. package/dist-esm/config/Options/common/color.js +88 -87
  140. package/dist-esm/config/Options/common/grid.js +74 -73
  141. package/dist-esm/config/Options/common/legend.js +180 -179
  142. package/dist-esm/config/Options/common/main.js +474 -473
  143. package/dist-esm/config/Options/common/point.js +160 -159
  144. package/dist-esm/config/Options/common/title.js +47 -46
  145. package/dist-esm/config/Options/common/tooltip.js +253 -252
  146. package/dist-esm/config/Options/data/axis.js +173 -172
  147. package/dist-esm/config/Options/data/data.js +958 -957
  148. package/dist-esm/config/Options/data/selection.js +131 -130
  149. package/dist-esm/config/Options/interaction/interaction.js +53 -52
  150. package/dist-esm/config/Options/interaction/subchart.js +164 -73
  151. package/dist-esm/config/Options/interaction/zoom.js +86 -85
  152. package/dist-esm/config/Options/shape/arc.js +150 -149
  153. package/dist-esm/config/Options/shape/area.js +69 -68
  154. package/dist-esm/config/Options/shape/bar.js +147 -146
  155. package/dist-esm/config/Options/shape/bubble.js +35 -34
  156. package/dist-esm/config/Options/shape/candlestick.js +61 -60
  157. package/dist-esm/config/Options/shape/donut.js +181 -180
  158. package/dist-esm/config/Options/shape/funnel.js +49 -48
  159. package/dist-esm/config/Options/shape/gauge.js +237 -236
  160. package/dist-esm/config/Options/shape/line.js +58 -57
  161. package/dist-esm/config/Options/shape/pie.js +185 -184
  162. package/dist-esm/config/Options/shape/polar.js +167 -166
  163. package/dist-esm/config/Options/shape/radar.js +76 -75
  164. package/dist-esm/config/Options/shape/scatter.js +36 -36
  165. package/dist-esm/config/Options/shape/spline.js +46 -46
  166. package/dist-esm/config/Options/shape/treemap.js +80 -79
  167. package/dist-esm/config/Store/Element.js +64 -62
  168. package/dist-esm/config/Store/State.js +189 -200
  169. package/dist-esm/config/Store/Store.js +25 -26
  170. package/dist-esm/config/classes.js +157 -155
  171. package/dist-esm/config/config.js +26 -35
  172. package/dist-esm/config/const.js +120 -128
  173. package/dist-esm/config/resolver/axis.core.js +25 -25
  174. package/dist-esm/config/resolver/axis.js +26 -27
  175. package/dist-esm/config/resolver/canvas.js +2071 -2472
  176. package/dist-esm/config/resolver/canvasShape.js +201 -177
  177. package/dist-esm/config/resolver/category.js +26 -27
  178. package/dist-esm/config/resolver/export.js +24 -26
  179. package/dist-esm/config/resolver/flow.js +29 -31
  180. package/dist-esm/config/resolver/grid.js +34 -35
  181. package/dist-esm/config/resolver/interaction/selection.js +17 -17
  182. package/dist-esm/config/resolver/interaction/subchart.js +17 -17
  183. package/dist-esm/config/resolver/interaction/zoom.js +17 -17
  184. package/dist-esm/config/resolver/regions.js +30 -31
  185. package/dist-esm/config/resolver/shape/arc.helpers.js +19 -19
  186. package/dist-esm/config/resolver/shape/area.js +17 -17
  187. package/dist-esm/config/resolver/shape/axis.helpers.js +28 -25
  188. package/dist-esm/config/resolver/shape/bar.js +13 -13
  189. package/dist-esm/config/resolver/shape/bubble.js +18 -14
  190. package/dist-esm/config/resolver/shape/candlestick.js +13 -13
  191. package/dist-esm/config/resolver/shape/donut.js +11 -11
  192. package/dist-esm/config/resolver/shape/funnel.js +11 -11
  193. package/dist-esm/config/resolver/shape/gauge.js +12 -12
  194. package/dist-esm/config/resolver/shape/line.js +10 -10
  195. package/dist-esm/config/resolver/shape/pie.js +11 -11
  196. package/dist-esm/config/resolver/shape/polar.js +12 -12
  197. package/dist-esm/config/resolver/shape/radar.js +22 -14
  198. package/dist-esm/config/resolver/shape/scatter.js +13 -13
  199. package/dist-esm/config/resolver/shape/treemap.js +11 -11
  200. package/dist-esm/core.js +208 -211
  201. package/dist-esm/index.canvas.js +14 -13
  202. package/dist-esm/index.esm.js +25 -24
  203. package/dist-esm/module/Cache.js +117 -129
  204. package/dist-esm/module/browser.js +30 -35
  205. package/dist-esm/module/dsv.js +107 -127
  206. package/dist-esm/module/error.js +45 -52
  207. package/dist-esm/module/generator.js +75 -83
  208. package/dist-esm/module/sanitize.js +302 -399
  209. package/dist-esm/module/util/brush.js +27 -38
  210. package/dist-esm/module/util/dom.js +288 -348
  211. package/dist-esm/module/util/object.js +277 -341
  212. package/dist-esm/module/util/type-checks.js +21 -25
  213. package/dist-esm/module/worker.js +312 -130
  214. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +185 -198
  215. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +442 -450
  216. package/dist-esm/plugin/billboardjs-plugin-stanford.js +813 -950
  217. package/dist-esm/plugin/billboardjs-plugin-tableview.js +708 -788
  218. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +344 -301
  219. package/dist-esm/react/index.js +157 -0
  220. package/package.json +28 -8
  221. package/src/Chart/api/selection.ts +130 -5
  222. package/src/ChartInternal/Axis/Axis.ts +164 -65
  223. package/src/ChartInternal/Axis/AxisRenderer.ts +41 -8
  224. package/src/ChartInternal/Axis/AxisRendererHelper.ts +1 -1
  225. package/src/ChartInternal/ChartInternal.ts +1 -1
  226. package/src/ChartInternal/data/convert.ts +54 -4
  227. package/src/ChartInternal/data/data.ts +4 -1
  228. package/src/ChartInternal/interactions/eventrect.ts +8 -2
  229. package/src/ChartInternal/interactions/subchart.ts +437 -66
  230. package/src/ChartInternal/internals/color.ts +2 -2
  231. package/src/ChartInternal/internals/domain.ts +15 -3
  232. package/src/ChartInternal/internals/grid.ts +21 -1
  233. package/src/ChartInternal/internals/scale.ts +9 -2
  234. package/src/ChartInternal/internals/selection.ts +1 -1
  235. package/src/ChartInternal/internals/subchart.util.ts +55 -0
  236. package/src/ChartInternal/internals/text.arc.ts +3 -1
  237. package/src/ChartInternal/internals/text.ts +18 -5
  238. package/src/ChartInternal/internals/transform.ts +8 -2
  239. package/src/ChartInternal/internals/type.ts +105 -1
  240. package/src/ChartInternal/shape/IShape.ts +6 -3
  241. package/src/ChartInternal/shape/bar.ts +62 -31
  242. package/src/ChartInternal/shape/core/barRadius.ts +129 -0
  243. package/src/ChartInternal/shape/core/candlestick.ts +1 -1
  244. package/src/ChartInternal/shape/core/path.ts +76 -9
  245. package/src/ChartInternal/shape/funnel.ts +2 -3
  246. package/src/ChartInternal/shape/point.ts +2 -2
  247. package/src/ChartInternal/shape/shape.ts +149 -17
  248. package/src/Plugin/stanford/index.ts +0 -4
  249. package/src/Plugin/tableview/index.ts +85 -3
  250. package/src/Plugin/textoverlap/index.ts +9 -15
  251. package/src/canvas/CanvasAxisRenderer.ts +184 -36
  252. package/src/canvas/CanvasRenderer.ts +247 -160
  253. package/src/canvas/CanvasTheme.ts +212 -0
  254. package/src/canvas/axisTicks.ts +122 -40
  255. package/src/config/Options/axis/y2.ts +13 -0
  256. package/src/config/Options/common/boost.ts +64 -4
  257. package/src/config/Options/common/color.ts +2 -2
  258. package/src/config/Options/interaction/subchart.ts +98 -1
  259. package/src/config/Options/shape/gauge.ts +1 -1
  260. package/src/config/Options/shape/treemap.ts +2 -2
  261. package/src/config/Store/Element.ts +3 -1
  262. package/src/config/Store/State.ts +1 -0
  263. package/src/config/classes.ts +1 -0
  264. package/src/config/resolver/canvas.ts +92 -10
  265. package/src/module/util/type-checks.ts +3 -1
  266. package/src/module/voronoi.ts +119 -0
  267. package/src/module/worker.entry.ts +61 -0
  268. package/src/module/worker.ts +346 -63
  269. package/src/react/index.ts +193 -0
  270. package/types/options.d.ts +206 -3
  271. package/types/react/index.d.ts +27 -0
@@ -5,963 +5,964 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.3
8
+ * @version 4.1.0-next.2
9
9
  */
10
+ //#region src/config/Options/data/data.ts
10
11
  /**
11
- * data config options
12
- */
13
- var data = {
14
- /**
15
- * Specify the key of x values in the data.<br><br>
16
- * We can show the data with non-index x values by this option. This option is required when the type of x axis is timeseries. If this option is set on a category axis, the values of the data on the key will be used for category names.
17
- * @name data․x
18
- * @memberof Options
19
- * @type {string}
20
- * @default undefined
21
- * @example
22
- * data: {
23
- * x: "date"
24
- * }
25
- */
26
- data_x: undefined,
27
- /**
28
- * Converts data id value
29
- * @name data․idConverter
30
- * @memberof Options
31
- * @type {function}
32
- * @default function(id) { return id; }
33
- * @example
34
- * data: {
35
- * idConverter: function(id) {
36
- * // when id is 'data1', converts to be 'data2'
37
- * // 'data2' should be given as the initial data value
38
- * if (id === "data1") {
39
- * return "data2";
40
- * } else {
41
- * return id;
42
- * }
43
- * }
44
- * }
45
- */
46
- data_idConverter: id => id,
47
- /**
48
- * Set custom data name.
49
- * If a name is set to `null`, the series is omitted from the legend.
50
- * @name data․names
51
- * @memberof Options
52
- * @type {object}
53
- * @default {}
54
- * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataName)
55
- * @example
56
- * data: {
57
- * names: {
58
- * data1: "Data Name 1",
59
- * data2: "Data Name 2"
60
- * }
61
- * }
62
- */
63
- data_names: {},
64
- /**
65
- * Set custom data class.<br><br>
66
- * If this option is specified, the element g for the data has an additional class that has the prefix 'bb-target-' (eg. bb-target-additional-data1-class).
67
- * @name data․classes
68
- * @memberof Options
69
- * @type {object}
70
- * @default {}
71
- * @example
72
- * data: {
73
- * classes: {
74
- * data1: "additional-data1-class",
75
- * data2: "additional-data2-class"
76
- * }
77
- * }
78
- */
79
- data_classes: {},
80
- /**
81
- * Set chart type at once.<br><br>
82
- * If this option is specified, the type will be applied to every data. This setting can be overwritten by data.types.<br><br>
83
- * **Available Values:**
84
- * - area
85
- * - area-line-range
86
- * - area-spline
87
- * - area-spline-range
88
- * - area-step
89
- * - area-step-range
90
- * - bar
91
- * - bubble
92
- * - candlestick
93
- * - donut
94
- * - funnel
95
- * - gauge
96
- * - line
97
- * - pie
98
- * - polar
99
- * - radar
100
- * - scatter
101
- * - spline
102
- * - step
103
- * - treemap
104
- * @name data․type
105
- * @memberof Options
106
- * @type {string}
107
- * @default "line"<br>NOTE: When importing shapes by ESM, `line()` should be specified for type.
108
- * @example
109
- * data: {
110
- * type: "bar"
111
- * }
112
- * @example
113
- * // Generate chart by importing ESM
114
- * // Import types to be used only, where this will make smaller bundle size.
115
- * import bb, {
116
- * area,
117
- * areaLineRange,
118
- * areaSpline,
119
- * areaSplineRange,
120
- * areaStep,
121
- * areaStepRange,
122
- * bar,
123
- * bubble,
124
- * candlestick,
125
- * donut,
126
- * funnel,
127
- * gauge,
128
- * line,
129
- * pie,
130
- * polar,
131
- * radar,
132
- * scatter,
133
- * spline,
134
- * step,
135
- * treemap
136
- * }
137
- *
138
- * bb.generate({
139
- * ...,
140
- * data: {
141
- * type: bar()
142
- * }
143
- * });
144
- */
145
- data_type: undefined,
146
- /**
147
- * Set chart type for each data.<br>
148
- * This setting overwrites data.type setting.
149
- * - **NOTE:** `radar` and `treemap` type can't be combined with other types.
150
- * @name data․types
151
- * @memberof Options
152
- * @type {object}
153
- * @default {}
154
- * @example
155
- * data: {
156
- * types: {
157
- * data1: "bar",
158
- * data2: "spline"
159
- * }
160
- * }
161
- * @example
162
- * // Generate chart by importing ESM
163
- * // Import types to be used only, where this will make smaller bundle size.
164
- * import bb, {
165
- * area,
166
- * areaLineRange,
167
- * areaSpline,
168
- * areaSplineRange,
169
- * areaStep,
170
- * areaStepRange,
171
- * bar,
172
- * bubble,
173
- * candlestick,
174
- * donut,
175
- * funnel,
176
- * gauge,
177
- * line,
178
- * pie,
179
- * polar,
180
- * radar,
181
- * scatter,
182
- * spline,
183
- * step,
184
- * treemap
185
- * }
186
- *
187
- * bb.generate({
188
- * ...,
189
- * data: {
190
- * types: {
191
- * data1: bar(),
192
- * data1: spline()
193
- * }
194
- * }
195
- * });
196
- */
197
- data_types: {},
198
- /**
199
- * This option changes the order of stacking data and pieces of pie/donut.
200
- * - If `null` specified, it will be the order in which the data is loaded.
201
- * - If a function is specified, it will be used as [Array.sort compareFunction](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Parameters)<br><br>
202
- *
203
- * **Available Values:**
204
- * - `desc`: In descending order
205
- * - `asc`: In ascending order
206
- * - `null`: It keeps the data load order
207
- * - `function(data1, data2) { ... }`: Array.sort compareFunction
208
- *
209
- * **NOTE**: order function only works for Axis based types & Arc types, except `Radar` type.
210
- * @name data․order
211
- * @memberof Options
212
- * @type {string|function|null}
213
- * @default desc
214
- * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataOrder)
215
- * @example
216
- * data: {
217
- * // in descending order (default)
218
- * order: "desc"
219
- *
220
- * // in ascending order
221
- * order: "asc"
222
- *
223
- * // keeps data input order
224
- * order: null
225
- *
226
- * // specifying sort function
227
- * order: function(a, b) {
228
- * // param data passed format
229
- * // {
230
- * // id: "data1", id_org: "data1", values: [
231
- * // {x: 5, value: 250, id: "data1", index: 5, name: "data1"},
232
- * // ...
233
- * // ]
234
- * // }
235
- *
236
- * const reducer = (p, c) => p + Math.abs(c.value);
237
- * const aSum = a.values.reduce(reducer, 0);
238
- * const bSum = b.values.reduce(reducer, 0);
239
- *
240
- * // ascending order
241
- * return aSum - bSum;
242
- *
243
- * // descending order
244
- * // return bSum - aSum;
245
- * }
246
- * }
247
- */
248
- data_order: "desc",
249
- /**
250
- * Set groups for the data for stacking.
251
- * @name data․groups
252
- * @memberof Options
253
- * @type {Array}
254
- * @default []
255
- * @example
256
- * data: {
257
- * groups: [
258
- * ["data1", "data2"],
259
- * ["data3"]
260
- * ]
261
- * }
262
- */
263
- data_groups: [],
264
- /**
265
- * Set how zero value will be treated on groups.<br>
266
- * Possible values:
267
- * - `zero`: 0 will be positioned at the absolute axis zero point.
268
- * - `positive`: 0 will be positioned at the top of a stack.
269
- * - `negative`: 0 will be positioned at the bottom of a stack.
270
- * @name data․groupsZeroAs
271
- * @memberof Options
272
- * @type {string}
273
- * @default "positive"
274
- * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.Groups)
275
- * @example
276
- * data: {
277
- * groupsZeroAs: "zero" // "positive" or "negative"
278
- * }
279
- */
280
- data_groupsZeroAs: "positive",
281
- /**
282
- * Set color converter function.<br><br>
283
- * This option should be a function and the specified function receives color (e.g. '#ff0000') and d that has data parameters like id, value, index, etc. And it must return a string that represents color (e.g. '#00ff00').
284
- * @name data․color
285
- * @memberof Options
286
- * @type {function}
287
- * @default undefined
288
- * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataColor)
289
- * @example
290
- * data: {
291
- * color: function(color, d) { ... }
292
- * }
293
- */
294
- data_color: undefined,
295
- /**
296
- * Set color for each data.
297
- * @name data․colors
298
- * @memberof Options
299
- * @type {object}
300
- * @default {}
301
- * @example
302
- * data: {
303
- * colors: {
304
- * data1: "#ff0000",
305
- * data2: function(d) {
306
- * return "#000";
307
- * }
308
- * ...
309
- * }
310
- * }
311
- */
312
- data_colors: {},
313
- /**
314
- * Set labels options
315
- * @name data․labels
316
- * @memberof Options
317
- * @type {object}
318
- * @property {object} data Data object
319
- * @property {boolean} [data.labels=false] Show or hide labels on each data point
320
- * @property {boolean} [data.labels.centered=false] Centerize labels on `bar` shape. (**NOTE:** works only for 'bar' type)
321
- * @property {function} [data.labels.format] Set formatter function for data labels.<br>
322
- * The formatter function receives 4 arguments such as `v, id, i, texts` and it **must return a string** (`\n` character will be used as line break) that will be shown as the label.<br><br>
323
- * The arguments are:<br>
324
- * - `v` is the value of the data point where the label is shown.
325
- * - `id` is the id of the data where the label is shown.
326
- * - `i` is the index of the data series point where the label is shown.
327
- * - `texts` is an array of whole corresponding data series' text labels.<br><br>
328
- * Formatter function can be defined for each data by specifying as an object and D3 formatter function can be set (ex. d3.format('$'))
329
- * @property {string|object|function} [data.labels.backgroundColors] Set label text background colors.<br><br>
330
- * - **NOTE**: When a function is set, background colors can be specified one color per dataset.
331
- * - Within the function, the last returned color for dataset will be used.
332
- * - Only can control set or unset background color for each values.
333
- * @property {string|object|function} [data.labels.colors] Set label text colors.
334
- * @property {object|function} [data.labels.position] Set each dataset position, relative to the original.<br><br>
335
- * When a function is specified, it will receive 5 arguments such as `type, v, id, i, texts` and it must return a position number.<br><br>
336
- * The arguments are:<br>
337
- * - `type` coordinate type string, which will be 'x' or 'y'.
338
- * - `v` is the value of the data point where the label is shown.
339
- * - `id` is the id of the data where the label is shown.
340
- * - `i` is the index of the data series point where the label is shown.
341
- * - `texts` is an array of whole corresponding data series' text labels.<br><br>
342
- * @property {number} [data.labels.position.x=0] x coordinate position, relative to the original.
343
- * @property {number} [data.labels.position.y=0] y coordinate position, relative to the original.
344
- * @property {object} [data.labels.rotate] Rotate label text. Specify degree value in a range of `0 ~ 360`.
345
- * - **NOTE:** Depending on the rotate value, the text position needs to be adjusted manually(using `data.labels.position` option) to be shown nicely.
346
- * @property {boolean|object} [data.labels.border=false] Add border to data label text. NOTE: When set as `true`, styling isn't applied. Hence, you need to set it using `.bb-text-border` class.
347
- * @property {number|string|object} [data.labels.border.padding="3 5"] Border padding. Can be a single number, string or object with top, bottom, left, right properties.
348
- * @property {number} [data.labels.border.radius=10] Border radius value.
349
- * @property {number} [data.labels.border.strokeWidth=1] Border stroke width.
350
- * @property {string} [data.labels.border.stroke="#000"] Border stroke color.
351
- * @property {string} [data.labels.border.fill="none"] Border fill color.
352
- * @property {object|function} [data.labels.image] Set image to be displayed next to the label text.<br><br>
353
- * When a function is specified, it will receive 3 arguments such as `v, id, i` and it must return an image object with `url`, `width`, `height`, and optional `pos` properties.<br><br>
354
- * The arguments are:<br>
355
- * - `v` is the value of the data point where the label is shown.
356
- * - `id` is the id of the data where the label is shown.
357
- * - `i` is the index of the data series point where the label is shown.
358
- * @property {string} data.labels.image.url Image URL path. Can use placeholder `{=ID}` which will be replaced with the data ID.
359
- * @property {number} data.labels.image.width Image width in pixels.
360
- * @property {number} data.labels.image.height Image height in pixels.
361
- * @property {object} [data.labels.image.pos] Image position relative to the label text.
362
- * @property {number} [data.labels.image.pos.x=0] x coordinate position, relative to the original.
363
- * @property {number} [data.labels.image.pos.y=0] y coordinate position, relative to the original.
364
- * @memberof Options
365
- * @type {object}
366
- * @default {}
367
- * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataLabel)
368
- * @see [Demo: label border](https://naver.github.io/billboard.js/demo/#Data.DataLabelBorder)
369
- * @see [Demo: label colors](https://naver.github.io/billboard.js/demo/#Data.DataLabelColors)
370
- * @see [Demo: label format](https://naver.github.io/billboard.js/demo/#Data.DataLabelFormat)
371
- * @see [Demo: label image](https://naver.github.io/billboard.js/demo/#Data.DataLabelImage)
372
- * @see [Demo: label multiline](https://naver.github.io/billboard.js/demo/#Data.DataLabelMultiline)
373
- * @see [Demo: label overlap](https://naver.github.io/billboard.js/demo/#Data.DataLabelOverlap)
374
- * @see [Demo: label position](https://naver.github.io/billboard.js/demo/#Data.DataLabelPosition)
375
- * @see [Demo: label rotate](https://naver.github.io/billboard.js/demo/#Data.DataLabelRotate)
376
- * @example
377
- * data: {
378
- * labels: true,
379
- *
380
- * // or set specific options
381
- * labels: {
382
- * format: function(v, id, i, texts) {
383
- * ...
384
- * // to multiline, return with '\n' character
385
- * return "Line1\nLine2";
386
- * },
387
- *
388
- * // it's possible to set for each data
389
- * format: {
390
- * data1: function(v, id, i, texts) { ... },
391
- * ...
392
- * },
393
- *
394
- * // align text to center of the 'bar' shape (works only for 'bar' type)
395
- * centered: true,
396
- *
397
- * // apply background color for label texts
398
- * backgroundColors: "red",
399
- *
400
- * // set different background colors per dataset
401
- * backgroundColors: {
402
- * data1: "green",
403
- * data2: "yellow"
404
- * },
405
- *
406
- * // call back for label text background color
407
- * backgroundColors: function(color, d) {
408
- * // color: the default data label color string
409
- * // data: ex) {x: 0, value: 200, id: "data3", index: 0}
410
- * ....
411
- * return d.value > 200 ? "cyan" : "red";
412
- * },
413
- *
414
- * // apply for all label texts
415
- * colors: "red",
416
- *
417
- * // set different colors per dataset
418
- * // for not specified dataset, will have the default color value
419
- * colors: {
420
- * data1: "yellow",
421
- * data3: "green"
422
- * },
423
- *
424
- * // call back for label text color
425
- * colors: function(color, d) {
426
- * // color: the default data label color string
427
- * // data: ex) {x: 0, value: 200, id: "data3", index: 0}
428
- * ....
429
- * return d.value > 200 ? "cyan" : color;
430
- * },
431
- *
432
- * // return x, y coordinate position
433
- * // apt to handle each text position manually
434
- * position: function(type, v, id, i, texts) {
435
- * ...
436
- * return type == "x" ? 10 : 20;
437
- * },
438
- *
439
- * // set x, y coordinate position
440
- * position: {
441
- * x: -10,
442
- * y: 10
443
- * },
444
- *
445
- * // or set x, y coordinate position by each dataset
446
- * position: {
447
- * data1: {x: 5, y: 5},
448
- * data2: {x: 10, y: -20}
449
- * },
450
- *
451
- * // rotate degree for label text
452
- * rotate: 90,
453
- *
454
- * // add border to data label text
455
- * // NOTE: When set as `true`, styling aren't applied. Hence, need to set using '.bb-text-border' class.
456
- * // ex. ".bb-text-border { fill: red; stroke: #000; stroke-width: 2px; rx: 10px; ry: 10px; }"
457
- * border: true,
458
- *
459
- * // or set detailed border options
460
- * border: {
461
- * padding: 10, // set all padding to 10
462
- * padding: "5 10", // set top and bottom padding to 5, left and right padding to 10
463
- * padding: { // specify each padding
464
- * top: 3,
465
- * bottom: 5,
466
- * left: 10,
467
- * right: 13
468
- * },
469
- * radius: 10,
470
- * strokeWidth: 2,
471
- * stroke: "#000",
472
- * fill: "red"
473
- * },
474
- *
475
- * // set image to be displayed next to the label text
476
- * image: {
477
- * url: "./sample.svg",
478
- *
479
- * // use placeholder to dynamically set image URL based on data ID
480
- * url: "./images/{=ID}.svg", // will be replaced to "./images/data1.svg", "./images/data2.svg", etc.
481
- * width: 35,
482
- * height: 35,
483
- * pos: {
484
- * x: 0,
485
- * y: 0
486
- * }
487
- * },
488
- *
489
- * // or use function to return image configuration dynamically
490
- * image: function(v, id, i) {
491
- * // v is the value of the data point where the label is shown.
492
- * // id is the id of the data where the label is shown.
493
- * // i is the index of the data series point where the label is shown.
494
- *
495
- * // Return different images based on value
496
- * if (v > 500) {
497
- * return {
498
- * url: "./high-value.svg",
499
- * width: 40,
500
- * height: 40,
501
- * pos: { x: 0, y: 0 }
502
- * };
503
- * } else if (v > 100) {
504
- * return {
505
- * url: "./medium-value.svg",
506
- * width: 30,
507
- * height: 30,
508
- * pos: { x: 0, y: 0 }
509
- * };
510
- * } else if(v < 5) {
511
- * // Return falsy value in case you don't want to show image
512
- * return null;
513
- * } else {
514
- * return {
515
- * url: "./low-value.svg",
516
- * width: 20,
517
- * height: 20,
518
- * pos: { x: 0, y: 0 }
519
- * };
520
- * }
521
- * }
522
- * }
523
- * }
524
- */
525
- data_labels: {},
526
- data_labels_backgroundColors: undefined,
527
- data_labels_colors: undefined,
528
- data_labels_position: {},
529
- data_labels_imgUrl: undefined,
530
- /**
531
- * Hide each data when the chart appears.<br><br>
532
- * If true is specified, all of data will be hidden. If multiple ids are specified as an array, those will be hidden.
533
- * @name data․hide
534
- * @memberof Options
535
- * @type {boolean|Array}
536
- * @default false
537
- * @example
538
- * data: {
539
- * // all of data will be hidden
540
- * hide: true
541
- *
542
- * // specified data will be hidden
543
- * hide: ["data1", ...]
544
- * }
545
- */
546
- data_hide: false,
547
- /**
548
- * Filter values to be shown
549
- * The data value is the same as the returned by `.data()`.
550
- * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
551
- * @name data․filter
552
- * @memberof Options
553
- * @type {function}
554
- * @default undefined
555
- * @example
556
- * data: {
557
- * // filter for id value
558
- * filter: function(v) {
559
- * // v: [{id: "data1", id_org: "data1", values: [
560
- * // {x: 0, value: 130, id: "data2", index: 0}, ...]
561
- * // }, ...]
562
- * return v.id !== "data1";
563
- * }
564
- */
565
- data_filter: undefined,
566
- /**
567
- * Set a callback for click event on each data point.<br><br>
568
- * This callback will be called when each data point is clicked and will receive `d` and element as the arguments.
569
- * - `d` is the data clicked and element is the element clicked.
570
- * - `element` is the current interacting svg element.
571
- * - In this callback, `this` will be the Chart object.
572
- * @name data․onclick
573
- * @memberof Options
574
- * @type {function}
575
- * @default function() {}
576
- * @example
577
- * data: {
578
- * onclick: function(d, element) {
579
- * // d - ex) {x: 4, value: 150, id: "data1", index: 4, name: "data1"}
580
- * // element - <circle>
581
- * ...
582
- * }
583
- * }
584
- */
585
- data_onclick: () => { },
586
- /**
587
- * Set a callback for mouse/touch over event on each data point.<br><br>
588
- * This callback will be called when the mouse cursor or touch moves onto each data point and will receive `d` and `element` as the argument.
589
- * - `d` is the data where mouse cursor moves onto.
590
- * - `element` is the current interacting svg element.
591
- * - In this callback, `this` will be the Chart object.
592
- * @name data․onover
593
- * @memberof Options
594
- * @type {function}
595
- * @default function() {}
596
- * @example
597
- * data: {
598
- * onover: function(d, element) {
599
- * // d - ex) {x: 4, value: 150, id: "data1", index: 4}
600
- * // element - <circle>
601
- * ...
602
- * }
603
- * }
604
- */
605
- data_onover: () => { },
606
- /**
607
- * Set a callback for mouse/touch out event on each data point.<br><br>
608
- * This callback will be called when the mouse cursor or touch moves out each data point and will receive `d` as the argument.
609
- * - `d` is the data where mouse cursor moves out.
610
- * - `element` is the current interacting svg element.
611
- * - In this callback, `this` will be the Chart object.
612
- * @name data․onout
613
- * @memberof Options
614
- * @type {function}
615
- * @default function() {}
616
- * @example
617
- * data: {
618
- * onout: function(d, element) {
619
- * // d - ex) {x: 4, value: 150, id: "data1", index: 4}
620
- * // element - <circle>
621
- * ...
622
- * }
623
- * }
624
- */
625
- data_onout: () => { },
626
- /**
627
- * Set a callback for when data is shown.<br>
628
- * The callback will receive shown data ids in array.
629
- * @name data․onshown
630
- * @memberof Options
631
- * @type {function}
632
- * @default undefined
633
- * @example
634
- * data: {
635
- * onshown: function(ids) {
636
- * // ids - ["data1", "data2", ...]
637
- * ...
638
- * }
639
- * }
640
- */
641
- data_onshown: undefined,
642
- /**
643
- * Set a callback for when data is hidden.<br>
644
- * The callback will receive hidden data ids in array.
645
- * @name data․onhidden
646
- * @memberof Options
647
- * @type {function}
648
- * @default undefined
649
- * @example
650
- * data: {
651
- * onhidden: function(ids) {
652
- * // ids - ["data1", "data2", ...]
653
- * ...
654
- * }
655
- * }
656
- */
657
- data_onhidden: undefined,
658
- /**
659
- * Set a callback for minimum data
660
- * - **NOTE:** For 'area-line-range', 'area-step-range' and 'area-spline-range', `mid` data will be taken for the comparison
661
- * @name data․onmin
662
- * @memberof Options
663
- * @type {function}
664
- * @default undefined
665
- * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.OnMinMaxCallback)
666
- * @example
667
- * onmin: function(data) {
668
- * // data - ex) [{x: 3, value: 400, id: "data1", index: 3}, ... ]
669
- * ...
670
- * }
671
- */
672
- data_onmin: undefined,
673
- /**
674
- * Set a callback for maximum data
675
- * - **NOTE:** For 'area-line-range', 'area-step-range' and 'area-spline-range', `mid` data will be taken for the comparison
676
- * @name data․onmax
677
- * @memberof Options
678
- * @type {function}
679
- * @default undefined
680
- * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.OnMinMaxCallback)
681
- * @example
682
- * onmax: function(data) {
683
- * // data - ex) [{x: 3, value: 400, id: "data1", index: 3}, ... ]
684
- * ...
685
- * }
686
- */
687
- data_onmax: undefined,
688
- /**
689
- * Load a CSV or JSON file from a URL. NOTE that this will not work if loading via the "file://" protocol as most browsers will block XMLHTTPRequests.
690
- * @name data․url
691
- * @memberof Options
692
- * @type {string}
693
- * @default undefined
694
- * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.LoadData)
695
- * @example
696
- * data: {
697
- * url: "/data/test.csv"
698
- * }
699
- */
700
- data_url: undefined,
701
- /**
702
- * XHR header value
703
- * - **NOTE:** Should be used with `data.url` option
704
- * @name data․headers
705
- * @memberof Options
706
- * @type {string}
707
- * @default undefined
708
- * @see https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/setRequestHeader
709
- * @example
710
- * data: {
711
- * url: "/data/test.csv",
712
- * headers: {
713
- * "Content-Type": "text/xml",
714
- * ...
715
- * }
716
- * }
717
- */
718
- data_headers: undefined,
719
- /**
720
- * Parse a JSON object for data. See also data.keys.
721
- * @name data․json
722
- * @memberof Options
723
- * @type {Array}
724
- * @default undefined
725
- * @see [data․keys](#.data%25E2%2580%25A4keys)
726
- * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.JSONData)
727
- * @example
728
- * data: {
729
- * json: [
730
- * {name: "www.site1.com", upload: 200, download: 200, total: 400},
731
- * {name: "www.site2.com", upload: 100, download: 300, total: 400},
732
- * {name: "www.site3.com", upload: 300, download: 200, total: 500},
733
- * {name: "www.site4.com", upload: 400, download: 100, total: 500}
734
- * ],
735
- * keys: {
736
- * // case 1: specify 'x' key for category axis
737
- * x: "name", // 'name' key will be used as category x axis values
738
- * value: ["upload", "download"]
739
- *
740
- * // case 2: without 'x' key for non-category axis
741
- * value: ["upload", "download"]
742
- * }
743
- * }
744
- */
745
- data_json: undefined,
746
- /**
747
- * Load data from a multidimensional array, with the first element containing the data names, the following containing related data in that order.
748
- * @name data․rows
749
- * @memberof Options
750
- * @type {Array}
751
- * @default undefined
752
- * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.RowOrientedData)
753
- * @example
754
- * data: {
755
- * rows: [
756
- * ["A", "B", "C"],
757
- * [90, 120, 300],
758
- * [40, 160, 240],
759
- * [50, 200, 290],
760
- * [120, 160, 230],
761
- * [80, 130, 300],
762
- * [90, 220, 320]
763
- * ]
764
- * }
765
- *
766
- * // for 'bar' type, data can contain:
767
- * // - an array of [start, end] data following the order
768
- * data: {
769
- * rows: [
770
- * ["data1", "data2"],
771
- * [[100, 150], 120],
772
- * [[200, 300], 55],
773
- * [[-400, 500], 60]
774
- * ],
775
- * type: "bar"
776
- * }
777
- *
778
- * // for 'range' types('area-line-range' or 'area-step-range' or 'area-spline-range'), data should contain:
779
- * // - an array of [high, mid, low] data following the order
780
- * // - or an object with 'high', 'mid' and 'low' key value
781
- * data: {
782
- * rows: [
783
- * ["data1", "data2"],
784
- * [
785
- * // or {high:150, mid: 140, low: 110}, 120
786
- * [150, 140, 110], 120
787
- * ],
788
- * [[155, 130, 115], 55],
789
- * [[160, 135, 120], 60]
790
- * ],
791
- * types: {
792
- * data1: "area-line-range",
793
- * data2: "line"
794
- * }
795
- * }
796
- *
797
- * // for 'bubble' type, data can contain dimension value:
798
- * // - an array of [y, z] data following the order
799
- * // - or an object with 'y' and 'z' key value
800
- * // 'y' is for y axis coordination and 'z' is the bubble radius value
801
- * data: {
802
- * rows: [
803
- * ["data1", "data2"],
804
- * [
805
- * // or {y:10, z: 140}, 120
806
- * [10, 140], 120
807
- * ],
808
- * [[100, 30], 55],
809
- * [[50, 100], 60]
810
- * ],
811
- * types: {
812
- * data1: "bubble",
813
- * data2: "line"
814
- * }
815
- * }
816
- *
817
- * // for 'candlestick' type, data should contain:
818
- * // - an array of [open, high, low, close, volume(optional)] data following the order
819
- * // - or an object with 'open', 'high', 'low', 'close' and 'value'(optional) key value
820
- * data: {
821
- * rows: [
822
- * ["data1", "data2"],
823
- * [
824
- * // open, high, low, close, volume (optional)
825
- * {open: 1300, high: 1369, low: 1200, close: 1339, volume: 100},
826
- * [1000, 1100, 850, 870]
827
- * ],
828
- * [
829
- * {open: 1348, high: 1371, low: 1271, close: 1320},
830
- * [870, 1250, 830, 1200, 50]
831
- * ]
832
- * ],
833
- * type: "candlestick"
834
- * }
835
- */
836
- data_rows: undefined,
837
- /**
838
- * Load data from a multidimensional array, with each element containing an array consisting of a datum name and associated data values.
839
- * @name data․columns
840
- * @memberof Options
841
- * @type {Array}
842
- * @default undefined
843
- * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.ColumnOrientedData)
844
- * @example
845
- * data: {
846
- * columns: [
847
- * ["data1", 30, 20, 50, 40, 60, 50],
848
- * ["data2", 200, 130, 90, 240, 130, 220],
849
- * ["data3", 300, 200, 160, 400, 250, 250]
850
- * ]
851
- * }
852
- *
853
- * // for 'bar' type, data can contain:
854
- * // - an array of [start, end] data following the order
855
- * data: {
856
- * columns: [
857
- * ["data1", -100, 50, [100, 200], [200, 300]],
858
- * ["data2", -200, 300, [-100, 100], [-50, -30]],
859
- * ],
860
- * type: "bar"
861
- * }
862
- *
863
- * // for 'range' types('area-line-range' or 'area-step-range' or 'area-spline-range'), data should contain:
864
- * // - an array of [high, mid, low] data following the order
865
- * // - or an object with 'high', 'mid' and 'low' key value
866
- * data: {
867
- * columns: [
868
- * ["data1",
869
- * [150, 140, 110], // or {high:150, mid: 140, low: 110}
870
- * [150, 140, 110],
871
- * [150, 140, 110]
872
- * ]
873
- * ],
874
- * type: "area-line-range"
875
- * }
876
- *
877
- * // for 'bubble' type, data can contain dimension value:
878
- * // - an array of [y, z] data following the order
879
- * // - or an object with 'y' and 'z' key value
880
- * // 'y' is for y axis coordination and 'z' is the bubble radius value
881
- * data: {
882
- * columns: [
883
- * ["data1",
884
- * [10, 140], // or {y:10, z: 140}
885
- * [100, 30],
886
- * [50, 100]
887
- * ]
888
- * ],
889
- * type: "bubble"
890
- * }
891
- *
892
- * // for 'candlestick' type, data should contain:
893
- * // - an array of [open, high, low, close, volume(optional)] data following the order
894
- * // - or an object with 'open', 'high', 'low', 'close' and 'value'(optional) key value
895
- * data: {
896
- * columns: [
897
- * ["data1",
898
- * [1000, 1100, 850, 870, 100], // or {open:1000, high: 1100, low: 870, volume: 100}
899
- * [870, 1250, 830, 1200] // 'volume' can be omitted
900
- * ]
901
- * ],
902
- * type: "candlestick"
903
- * }
904
- */
905
- data_columns: undefined,
906
- /**
907
- * Used if loading JSON via data.url.
908
- * - **Available Values:**
909
- * - json
910
- * - csv
911
- * - tsv
912
- * @name data․mimeType
913
- * @memberof Options
914
- * @type {string}
915
- * @default csv
916
- * @example
917
- * data: {
918
- * mimeType: "json"
919
- * }
920
- */
921
- data_mimeType: "csv",
922
- /**
923
- * Choose which JSON object keys correspond to desired data.
924
- * - **NOTE:** Only for JSON object given as array.
925
- * @name data․keys
926
- * @memberof Options
927
- * @type {string}
928
- * @default undefined
929
- * @example
930
- * data: {
931
- * json: [
932
- * {name: "www.site1.com", upload: 200, download: 200, total: 400},
933
- * {name: "www.site2.com", upload: 100, download: 300, total: 400},
934
- * {name: "www.site3.com", upload: 300, download: 200, total: 500},
935
- * {name: "www.site4.com", upload: 400, download: 100, total: 500}
936
- * ],
937
- * keys: {
938
- * // case 1: specify 'x' key for category axis
939
- * x: "name", // 'name' key will be used as category x axis values
940
- * value: ["upload", "download"]
941
- *
942
- * // case 2: without 'x' key for non-category axis
943
- * value: ["upload", "download"]
944
- * }
945
- * }
946
- */
947
- data_keys: undefined,
948
- /**
949
- * Set text label to be displayed when there's no data to show.
950
- * - ex. Toggling all visible data to not be shown, unloading all current data, etc.
951
- * @name data․empty․label․text
952
- * @memberof Options
953
- * @type {string}
954
- * @default ""
955
- * @example
956
- * data: {
957
- * empty: {
958
- * label: {
959
- * text: "No Data"
960
- * }
961
- * }
962
- * }
963
- */
964
- data_empty_label_text: ""
12
+ * data config options
13
+ */
14
+ var data_default = {
15
+ /**
16
+ * Specify the key of x values in the data.<br><br>
17
+ * We can show the data with non-index x values by this option. This option is required when the type of x axis is timeseries. If this option is set on a category axis, the values of the data on the key will be used for category names.
18
+ * @name data․x
19
+ * @memberof Options
20
+ * @type {string}
21
+ * @default undefined
22
+ * @example
23
+ * data: {
24
+ * x: "date"
25
+ * }
26
+ */
27
+ data_x: void 0,
28
+ /**
29
+ * Converts data id value
30
+ * @name data․idConverter
31
+ * @memberof Options
32
+ * @type {function}
33
+ * @default function(id) { return id; }
34
+ * @example
35
+ * data: {
36
+ * idConverter: function(id) {
37
+ * // when id is 'data1', converts to be 'data2'
38
+ * // 'data2' should be given as the initial data value
39
+ * if (id === "data1") {
40
+ * return "data2";
41
+ * } else {
42
+ * return id;
43
+ * }
44
+ * }
45
+ * }
46
+ */
47
+ data_idConverter: (id) => id,
48
+ /**
49
+ * Set custom data name.
50
+ * If a name is set to `null`, the series is omitted from the legend.
51
+ * @name data․names
52
+ * @memberof Options
53
+ * @type {object}
54
+ * @default {}
55
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataName)
56
+ * @example
57
+ * data: {
58
+ * names: {
59
+ * data1: "Data Name 1",
60
+ * data2: "Data Name 2"
61
+ * }
62
+ * }
63
+ */
64
+ data_names: {},
65
+ /**
66
+ * Set custom data class.<br><br>
67
+ * If this option is specified, the element g for the data has an additional class that has the prefix 'bb-target-' (eg. bb-target-additional-data1-class).
68
+ * @name data․classes
69
+ * @memberof Options
70
+ * @type {object}
71
+ * @default {}
72
+ * @example
73
+ * data: {
74
+ * classes: {
75
+ * data1: "additional-data1-class",
76
+ * data2: "additional-data2-class"
77
+ * }
78
+ * }
79
+ */
80
+ data_classes: {},
81
+ /**
82
+ * Set chart type at once.<br><br>
83
+ * If this option is specified, the type will be applied to every data. This setting can be overwritten by data.types.<br><br>
84
+ * **Available Values:**
85
+ * - area
86
+ * - area-line-range
87
+ * - area-spline
88
+ * - area-spline-range
89
+ * - area-step
90
+ * - area-step-range
91
+ * - bar
92
+ * - bubble
93
+ * - candlestick
94
+ * - donut
95
+ * - funnel
96
+ * - gauge
97
+ * - line
98
+ * - pie
99
+ * - polar
100
+ * - radar
101
+ * - scatter
102
+ * - spline
103
+ * - step
104
+ * - treemap
105
+ * @name data․type
106
+ * @memberof Options
107
+ * @type {string}
108
+ * @default "line"<br>NOTE: When importing shapes by ESM, `line()` should be specified for type.
109
+ * @example
110
+ * data: {
111
+ * type: "bar"
112
+ * }
113
+ * @example
114
+ * // Generate chart by importing ESM
115
+ * // Import types to be used only, where this will make smaller bundle size.
116
+ * import bb, {
117
+ * area,
118
+ * areaLineRange,
119
+ * areaSpline,
120
+ * areaSplineRange,
121
+ * areaStep,
122
+ * areaStepRange,
123
+ * bar,
124
+ * bubble,
125
+ * candlestick,
126
+ * donut,
127
+ * funnel,
128
+ * gauge,
129
+ * line,
130
+ * pie,
131
+ * polar,
132
+ * radar,
133
+ * scatter,
134
+ * spline,
135
+ * step,
136
+ * treemap
137
+ * }
138
+ *
139
+ * bb.generate({
140
+ * ...,
141
+ * data: {
142
+ * type: bar()
143
+ * }
144
+ * });
145
+ */
146
+ data_type: void 0,
147
+ /**
148
+ * Set chart type for each data.<br>
149
+ * This setting overwrites data.type setting.
150
+ * - **NOTE:** `radar` and `treemap` type can't be combined with other types.
151
+ * @name data․types
152
+ * @memberof Options
153
+ * @type {object}
154
+ * @default {}
155
+ * @example
156
+ * data: {
157
+ * types: {
158
+ * data1: "bar",
159
+ * data2: "spline"
160
+ * }
161
+ * }
162
+ * @example
163
+ * // Generate chart by importing ESM
164
+ * // Import types to be used only, where this will make smaller bundle size.
165
+ * import bb, {
166
+ * area,
167
+ * areaLineRange,
168
+ * areaSpline,
169
+ * areaSplineRange,
170
+ * areaStep,
171
+ * areaStepRange,
172
+ * bar,
173
+ * bubble,
174
+ * candlestick,
175
+ * donut,
176
+ * funnel,
177
+ * gauge,
178
+ * line,
179
+ * pie,
180
+ * polar,
181
+ * radar,
182
+ * scatter,
183
+ * spline,
184
+ * step,
185
+ * treemap
186
+ * }
187
+ *
188
+ * bb.generate({
189
+ * ...,
190
+ * data: {
191
+ * types: {
192
+ * data1: bar(),
193
+ * data1: spline()
194
+ * }
195
+ * }
196
+ * });
197
+ */
198
+ data_types: {},
199
+ /**
200
+ * This option changes the order of stacking data and pieces of pie/donut.
201
+ * - If `null` specified, it will be the order in which the data is loaded.
202
+ * - If a function is specified, it will be used as [Array.sort compareFunction](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort#Parameters)<br><br>
203
+ *
204
+ * **Available Values:**
205
+ * - `desc`: In descending order
206
+ * - `asc`: In ascending order
207
+ * - `null`: It keeps the data load order
208
+ * - `function(data1, data2) { ... }`: Array.sort compareFunction
209
+ *
210
+ * **NOTE**: order function only works for Axis based types & Arc types, except `Radar` type.
211
+ * @name data․order
212
+ * @memberof Options
213
+ * @type {string|function|null}
214
+ * @default desc
215
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataOrder)
216
+ * @example
217
+ * data: {
218
+ * // in descending order (default)
219
+ * order: "desc"
220
+ *
221
+ * // in ascending order
222
+ * order: "asc"
223
+ *
224
+ * // keeps data input order
225
+ * order: null
226
+ *
227
+ * // specifying sort function
228
+ * order: function(a, b) {
229
+ * // param data passed format
230
+ * // {
231
+ * // id: "data1", id_org: "data1", values: [
232
+ * // {x: 5, value: 250, id: "data1", index: 5, name: "data1"},
233
+ * // ...
234
+ * // ]
235
+ * // }
236
+ *
237
+ * const reducer = (p, c) => p + Math.abs(c.value);
238
+ * const aSum = a.values.reduce(reducer, 0);
239
+ * const bSum = b.values.reduce(reducer, 0);
240
+ *
241
+ * // ascending order
242
+ * return aSum - bSum;
243
+ *
244
+ * // descending order
245
+ * // return bSum - aSum;
246
+ * }
247
+ * }
248
+ */
249
+ data_order: "desc",
250
+ /**
251
+ * Set groups for the data for stacking.
252
+ * @name data․groups
253
+ * @memberof Options
254
+ * @type {Array}
255
+ * @default []
256
+ * @example
257
+ * data: {
258
+ * groups: [
259
+ * ["data1", "data2"],
260
+ * ["data3"]
261
+ * ]
262
+ * }
263
+ */
264
+ data_groups: [],
265
+ /**
266
+ * Set how zero value will be treated on groups.<br>
267
+ * Possible values:
268
+ * - `zero`: 0 will be positioned at the absolute axis zero point.
269
+ * - `positive`: 0 will be positioned at the top of a stack.
270
+ * - `negative`: 0 will be positioned at the bottom of a stack.
271
+ * @name data․groupsZeroAs
272
+ * @memberof Options
273
+ * @type {string}
274
+ * @default "positive"
275
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.Groups)
276
+ * @example
277
+ * data: {
278
+ * groupsZeroAs: "zero" // "positive" or "negative"
279
+ * }
280
+ */
281
+ data_groupsZeroAs: "positive",
282
+ /**
283
+ * Set color converter function.<br><br>
284
+ * This option should be a function and the specified function receives color (e.g. '#ff0000') and d that has data parameters like id, value, index, etc. And it must return a string that represents color (e.g. '#00ff00').
285
+ * @name data․color
286
+ * @memberof Options
287
+ * @type {function}
288
+ * @default undefined
289
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataColor)
290
+ * @example
291
+ * data: {
292
+ * color: function(color, d) { ... }
293
+ * }
294
+ */
295
+ data_color: void 0,
296
+ /**
297
+ * Set color for each data.
298
+ * @name data․colors
299
+ * @memberof Options
300
+ * @type {object}
301
+ * @default {}
302
+ * @example
303
+ * data: {
304
+ * colors: {
305
+ * data1: "#ff0000",
306
+ * data2: function(d) {
307
+ * return "#000";
308
+ * }
309
+ * ...
310
+ * }
311
+ * }
312
+ */
313
+ data_colors: {},
314
+ /**
315
+ * Set labels options
316
+ * @name data․labels
317
+ * @memberof Options
318
+ * @type {object}
319
+ * @property {object} data Data object
320
+ * @property {boolean} [data.labels=false] Show or hide labels on each data point
321
+ * @property {boolean} [data.labels.centered=false] Centerize labels on `bar` shape. (**NOTE:** works only for 'bar' type)
322
+ * @property {function} [data.labels.format] Set formatter function for data labels.<br>
323
+ * The formatter function receives 4 arguments such as `v, id, i, texts` and it **must return a string** (`\n` character will be used as line break) that will be shown as the label.<br><br>
324
+ * The arguments are:<br>
325
+ * - `v` is the value of the data point where the label is shown.
326
+ * - `id` is the id of the data where the label is shown.
327
+ * - `i` is the index of the data series point where the label is shown.
328
+ * - `texts` is an array of whole corresponding data series' text labels.<br><br>
329
+ * Formatter function can be defined for each data by specifying as an object and D3 formatter function can be set (ex. d3.format('$'))
330
+ * @property {string|object|function} [data.labels.backgroundColors] Set label text background colors.<br><br>
331
+ * - **NOTE**: When a function is set, background colors can be specified one color per dataset.
332
+ * - Within the function, the last returned color for dataset will be used.
333
+ * - Only can control set or unset background color for each values.
334
+ * @property {string|object|function} [data.labels.colors] Set label text colors.
335
+ * @property {object|function} [data.labels.position] Set each dataset position, relative to the original.<br><br>
336
+ * When a function is specified, it will receive 5 arguments such as `type, v, id, i, texts` and it must return a position number.<br><br>
337
+ * The arguments are:<br>
338
+ * - `type` coordinate type string, which will be 'x' or 'y'.
339
+ * - `v` is the value of the data point where the label is shown.
340
+ * - `id` is the id of the data where the label is shown.
341
+ * - `i` is the index of the data series point where the label is shown.
342
+ * - `texts` is an array of whole corresponding data series' text labels.<br><br>
343
+ * @property {number} [data.labels.position.x=0] x coordinate position, relative to the original.
344
+ * @property {number} [data.labels.position.y=0] y coordinate position, relative to the original.
345
+ * @property {object} [data.labels.rotate] Rotate label text. Specify degree value in a range of `0 ~ 360`.
346
+ * - **NOTE:** Depending on the rotate value, the text position needs to be adjusted manually(using `data.labels.position` option) to be shown nicely.
347
+ * @property {boolean|object} [data.labels.border=false] Add border to data label text. NOTE: When set as `true`, styling isn't applied. Hence, you need to set it using `.bb-text-border` class.
348
+ * @property {number|string|object} [data.labels.border.padding="3 5"] Border padding. Can be a single number, string or object with top, bottom, left, right properties.
349
+ * @property {number} [data.labels.border.radius=10] Border radius value.
350
+ * @property {number} [data.labels.border.strokeWidth=1] Border stroke width.
351
+ * @property {string} [data.labels.border.stroke="#000"] Border stroke color.
352
+ * @property {string} [data.labels.border.fill="none"] Border fill color.
353
+ * @property {object|function} [data.labels.image] Set image to be displayed next to the label text.<br><br>
354
+ * When a function is specified, it will receive 3 arguments such as `v, id, i` and it must return an image object with `url`, `width`, `height`, and optional `pos` properties.<br><br>
355
+ * The arguments are:<br>
356
+ * - `v` is the value of the data point where the label is shown.
357
+ * - `id` is the id of the data where the label is shown.
358
+ * - `i` is the index of the data series point where the label is shown.
359
+ * @property {string} data.labels.image.url Image URL path. Can use placeholder `{=ID}` which will be replaced with the data ID.
360
+ * @property {number} data.labels.image.width Image width in pixels.
361
+ * @property {number} data.labels.image.height Image height in pixels.
362
+ * @property {object} [data.labels.image.pos] Image position relative to the label text.
363
+ * @property {number} [data.labels.image.pos.x=0] x coordinate position, relative to the original.
364
+ * @property {number} [data.labels.image.pos.y=0] y coordinate position, relative to the original.
365
+ * @memberof Options
366
+ * @type {object}
367
+ * @default {}
368
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataLabel)
369
+ * @see [Demo: label border](https://naver.github.io/billboard.js/demo/#Data.DataLabelBorder)
370
+ * @see [Demo: label colors](https://naver.github.io/billboard.js/demo/#Data.DataLabelColors)
371
+ * @see [Demo: label format](https://naver.github.io/billboard.js/demo/#Data.DataLabelFormat)
372
+ * @see [Demo: label image](https://naver.github.io/billboard.js/demo/#Data.DataLabelImage)
373
+ * @see [Demo: label multiline](https://naver.github.io/billboard.js/demo/#Data.DataLabelMultiline)
374
+ * @see [Demo: label overlap](https://naver.github.io/billboard.js/demo/#Data.DataLabelOverlap)
375
+ * @see [Demo: label position](https://naver.github.io/billboard.js/demo/#Data.DataLabelPosition)
376
+ * @see [Demo: label rotate](https://naver.github.io/billboard.js/demo/#Data.DataLabelRotate)
377
+ * @example
378
+ * data: {
379
+ * labels: true,
380
+ *
381
+ * // or set specific options
382
+ * labels: {
383
+ * format: function(v, id, i, texts) {
384
+ * ...
385
+ * // to multiline, return with '\n' character
386
+ * return "Line1\nLine2";
387
+ * },
388
+ *
389
+ * // it's possible to set for each data
390
+ * format: {
391
+ * data1: function(v, id, i, texts) { ... },
392
+ * ...
393
+ * },
394
+ *
395
+ * // align text to center of the 'bar' shape (works only for 'bar' type)
396
+ * centered: true,
397
+ *
398
+ * // apply background color for label texts
399
+ * backgroundColors: "red",
400
+ *
401
+ * // set different background colors per dataset
402
+ * backgroundColors: {
403
+ * data1: "green",
404
+ * data2: "yellow"
405
+ * },
406
+ *
407
+ * // call back for label text background color
408
+ * backgroundColors: function(color, d) {
409
+ * // color: the default data label color string
410
+ * // data: ex) {x: 0, value: 200, id: "data3", index: 0}
411
+ * ....
412
+ * return d.value > 200 ? "cyan" : "red";
413
+ * },
414
+ *
415
+ * // apply for all label texts
416
+ * colors: "red",
417
+ *
418
+ * // set different colors per dataset
419
+ * // for not specified dataset, will have the default color value
420
+ * colors: {
421
+ * data1: "yellow",
422
+ * data3: "green"
423
+ * },
424
+ *
425
+ * // call back for label text color
426
+ * colors: function(color, d) {
427
+ * // color: the default data label color string
428
+ * // data: ex) {x: 0, value: 200, id: "data3", index: 0}
429
+ * ....
430
+ * return d.value > 200 ? "cyan" : color;
431
+ * },
432
+ *
433
+ * // return x, y coordinate position
434
+ * // apt to handle each text position manually
435
+ * position: function(type, v, id, i, texts) {
436
+ * ...
437
+ * return type == "x" ? 10 : 20;
438
+ * },
439
+ *
440
+ * // set x, y coordinate position
441
+ * position: {
442
+ * x: -10,
443
+ * y: 10
444
+ * },
445
+ *
446
+ * // or set x, y coordinate position by each dataset
447
+ * position: {
448
+ * data1: {x: 5, y: 5},
449
+ * data2: {x: 10, y: -20}
450
+ * },
451
+ *
452
+ * // rotate degree for label text
453
+ * rotate: 90,
454
+ *
455
+ * // add border to data label text
456
+ * // NOTE: When set as `true`, styling aren't applied. Hence, need to set using '.bb-text-border' class.
457
+ * // ex. ".bb-text-border { fill: red; stroke: #000; stroke-width: 2px; rx: 10px; ry: 10px; }"
458
+ * border: true,
459
+ *
460
+ * // or set detailed border options
461
+ * border: {
462
+ * padding: 10, // set all padding to 10
463
+ * padding: "5 10", // set top and bottom padding to 5, left and right padding to 10
464
+ * padding: { // specify each padding
465
+ * top: 3,
466
+ * bottom: 5,
467
+ * left: 10,
468
+ * right: 13
469
+ * },
470
+ * radius: 10,
471
+ * strokeWidth: 2,
472
+ * stroke: "#000",
473
+ * fill: "red"
474
+ * },
475
+ *
476
+ * // set image to be displayed next to the label text
477
+ * image: {
478
+ * url: "./sample.svg",
479
+ *
480
+ * // use placeholder to dynamically set image URL based on data ID
481
+ * url: "./images/{=ID}.svg", // will be replaced to "./images/data1.svg", "./images/data2.svg", etc.
482
+ * width: 35,
483
+ * height: 35,
484
+ * pos: {
485
+ * x: 0,
486
+ * y: 0
487
+ * }
488
+ * },
489
+ *
490
+ * // or use function to return image configuration dynamically
491
+ * image: function(v, id, i) {
492
+ * // v is the value of the data point where the label is shown.
493
+ * // id is the id of the data where the label is shown.
494
+ * // i is the index of the data series point where the label is shown.
495
+ *
496
+ * // Return different images based on value
497
+ * if (v > 500) {
498
+ * return {
499
+ * url: "./high-value.svg",
500
+ * width: 40,
501
+ * height: 40,
502
+ * pos: { x: 0, y: 0 }
503
+ * };
504
+ * } else if (v > 100) {
505
+ * return {
506
+ * url: "./medium-value.svg",
507
+ * width: 30,
508
+ * height: 30,
509
+ * pos: { x: 0, y: 0 }
510
+ * };
511
+ * } else if(v < 5) {
512
+ * // Return falsy value in case you don't want to show image
513
+ * return null;
514
+ * } else {
515
+ * return {
516
+ * url: "./low-value.svg",
517
+ * width: 20,
518
+ * height: 20,
519
+ * pos: { x: 0, y: 0 }
520
+ * };
521
+ * }
522
+ * }
523
+ * }
524
+ * }
525
+ */
526
+ data_labels: {},
527
+ data_labels_backgroundColors: void 0,
528
+ data_labels_colors: void 0,
529
+ data_labels_position: {},
530
+ data_labels_imgUrl: void 0,
531
+ /**
532
+ * Hide each data when the chart appears.<br><br>
533
+ * If true is specified, all of data will be hidden. If multiple ids are specified as an array, those will be hidden.
534
+ * @name data․hide
535
+ * @memberof Options
536
+ * @type {boolean|Array}
537
+ * @default false
538
+ * @example
539
+ * data: {
540
+ * // all of data will be hidden
541
+ * hide: true
542
+ *
543
+ * // specified data will be hidden
544
+ * hide: ["data1", ...]
545
+ * }
546
+ */
547
+ data_hide: false,
548
+ /**
549
+ * Filter values to be shown
550
+ * The data value is the same as the returned by `.data()`.
551
+ * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter
552
+ * @name data․filter
553
+ * @memberof Options
554
+ * @type {function}
555
+ * @default undefined
556
+ * @example
557
+ * data: {
558
+ * // filter for id value
559
+ * filter: function(v) {
560
+ * // v: [{id: "data1", id_org: "data1", values: [
561
+ * // {x: 0, value: 130, id: "data2", index: 0}, ...]
562
+ * // }, ...]
563
+ * return v.id !== "data1";
564
+ * }
565
+ */
566
+ data_filter: void 0,
567
+ /**
568
+ * Set a callback for click event on each data point.<br><br>
569
+ * This callback will be called when each data point is clicked and will receive `d` and element as the arguments.
570
+ * - `d` is the data clicked and element is the element clicked.
571
+ * - `element` is the current interacting svg element.
572
+ * - In this callback, `this` will be the Chart object.
573
+ * @name data․onclick
574
+ * @memberof Options
575
+ * @type {function}
576
+ * @default function() {}
577
+ * @example
578
+ * data: {
579
+ * onclick: function(d, element) {
580
+ * // d - ex) {x: 4, value: 150, id: "data1", index: 4, name: "data1"}
581
+ * // element - <circle>
582
+ * ...
583
+ * }
584
+ * }
585
+ */
586
+ data_onclick: () => {},
587
+ /**
588
+ * Set a callback for mouse/touch over event on each data point.<br><br>
589
+ * This callback will be called when the mouse cursor or touch moves onto each data point and will receive `d` and `element` as the argument.
590
+ * - `d` is the data where mouse cursor moves onto.
591
+ * - `element` is the current interacting svg element.
592
+ * - In this callback, `this` will be the Chart object.
593
+ * @name data․onover
594
+ * @memberof Options
595
+ * @type {function}
596
+ * @default function() {}
597
+ * @example
598
+ * data: {
599
+ * onover: function(d, element) {
600
+ * // d - ex) {x: 4, value: 150, id: "data1", index: 4}
601
+ * // element - <circle>
602
+ * ...
603
+ * }
604
+ * }
605
+ */
606
+ data_onover: () => {},
607
+ /**
608
+ * Set a callback for mouse/touch out event on each data point.<br><br>
609
+ * This callback will be called when the mouse cursor or touch moves out each data point and will receive `d` as the argument.
610
+ * - `d` is the data where mouse cursor moves out.
611
+ * - `element` is the current interacting svg element.
612
+ * - In this callback, `this` will be the Chart object.
613
+ * @name data․onout
614
+ * @memberof Options
615
+ * @type {function}
616
+ * @default function() {}
617
+ * @example
618
+ * data: {
619
+ * onout: function(d, element) {
620
+ * // d - ex) {x: 4, value: 150, id: "data1", index: 4}
621
+ * // element - <circle>
622
+ * ...
623
+ * }
624
+ * }
625
+ */
626
+ data_onout: () => {},
627
+ /**
628
+ * Set a callback for when data is shown.<br>
629
+ * The callback will receive shown data ids in array.
630
+ * @name data․onshown
631
+ * @memberof Options
632
+ * @type {function}
633
+ * @default undefined
634
+ * @example
635
+ * data: {
636
+ * onshown: function(ids) {
637
+ * // ids - ["data1", "data2", ...]
638
+ * ...
639
+ * }
640
+ * }
641
+ */
642
+ data_onshown: void 0,
643
+ /**
644
+ * Set a callback for when data is hidden.<br>
645
+ * The callback will receive hidden data ids in array.
646
+ * @name data․onhidden
647
+ * @memberof Options
648
+ * @type {function}
649
+ * @default undefined
650
+ * @example
651
+ * data: {
652
+ * onhidden: function(ids) {
653
+ * // ids - ["data1", "data2", ...]
654
+ * ...
655
+ * }
656
+ * }
657
+ */
658
+ data_onhidden: void 0,
659
+ /**
660
+ * Set a callback for minimum data
661
+ * - **NOTE:** For 'area-line-range', 'area-step-range' and 'area-spline-range', `mid` data will be taken for the comparison
662
+ * @name data․onmin
663
+ * @memberof Options
664
+ * @type {function}
665
+ * @default undefined
666
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.OnMinMaxCallback)
667
+ * @example
668
+ * onmin: function(data) {
669
+ * // data - ex) [{x: 3, value: 400, id: "data1", index: 3}, ... ]
670
+ * ...
671
+ * }
672
+ */
673
+ data_onmin: void 0,
674
+ /**
675
+ * Set a callback for maximum data
676
+ * - **NOTE:** For 'area-line-range', 'area-step-range' and 'area-spline-range', `mid` data will be taken for the comparison
677
+ * @name data․onmax
678
+ * @memberof Options
679
+ * @type {function}
680
+ * @default undefined
681
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.OnMinMaxCallback)
682
+ * @example
683
+ * onmax: function(data) {
684
+ * // data - ex) [{x: 3, value: 400, id: "data1", index: 3}, ... ]
685
+ * ...
686
+ * }
687
+ */
688
+ data_onmax: void 0,
689
+ /**
690
+ * Load a CSV or JSON file from a URL. NOTE that this will not work if loading via the "file://" protocol as most browsers will block XMLHTTPRequests.
691
+ * @name data․url
692
+ * @memberof Options
693
+ * @type {string}
694
+ * @default undefined
695
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.LoadData)
696
+ * @example
697
+ * data: {
698
+ * url: "/data/test.csv"
699
+ * }
700
+ */
701
+ data_url: void 0,
702
+ /**
703
+ * XHR header value
704
+ * - **NOTE:** Should be used with `data.url` option
705
+ * @name data․headers
706
+ * @memberof Options
707
+ * @type {string}
708
+ * @default undefined
709
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/setRequestHeader
710
+ * @example
711
+ * data: {
712
+ * url: "/data/test.csv",
713
+ * headers: {
714
+ * "Content-Type": "text/xml",
715
+ * ...
716
+ * }
717
+ * }
718
+ */
719
+ data_headers: void 0,
720
+ /**
721
+ * Parse a JSON object for data. See also data.keys.
722
+ * @name data․json
723
+ * @memberof Options
724
+ * @type {Array}
725
+ * @default undefined
726
+ * @see [data․keys](#.data%25E2%2580%25A4keys)
727
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.JSONData)
728
+ * @example
729
+ * data: {
730
+ * json: [
731
+ * {name: "www.site1.com", upload: 200, download: 200, total: 400},
732
+ * {name: "www.site2.com", upload: 100, download: 300, total: 400},
733
+ * {name: "www.site3.com", upload: 300, download: 200, total: 500},
734
+ * {name: "www.site4.com", upload: 400, download: 100, total: 500}
735
+ * ],
736
+ * keys: {
737
+ * // case 1: specify 'x' key for category axis
738
+ * x: "name", // 'name' key will be used as category x axis values
739
+ * value: ["upload", "download"]
740
+ *
741
+ * // case 2: without 'x' key for non-category axis
742
+ * value: ["upload", "download"]
743
+ * }
744
+ * }
745
+ */
746
+ data_json: void 0,
747
+ /**
748
+ * Load data from a multidimensional array, with the first element containing the data names, the following containing related data in that order.
749
+ * @name data․rows
750
+ * @memberof Options
751
+ * @type {Array}
752
+ * @default undefined
753
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.RowOrientedData)
754
+ * @example
755
+ * data: {
756
+ * rows: [
757
+ * ["A", "B", "C"],
758
+ * [90, 120, 300],
759
+ * [40, 160, 240],
760
+ * [50, 200, 290],
761
+ * [120, 160, 230],
762
+ * [80, 130, 300],
763
+ * [90, 220, 320]
764
+ * ]
765
+ * }
766
+ *
767
+ * // for 'bar' type, data can contain:
768
+ * // - an array of [start, end] data following the order
769
+ * data: {
770
+ * rows: [
771
+ * ["data1", "data2"],
772
+ * [[100, 150], 120],
773
+ * [[200, 300], 55],
774
+ * [[-400, 500], 60]
775
+ * ],
776
+ * type: "bar"
777
+ * }
778
+ *
779
+ * // for 'range' types('area-line-range' or 'area-step-range' or 'area-spline-range'), data should contain:
780
+ * // - an array of [high, mid, low] data following the order
781
+ * // - or an object with 'high', 'mid' and 'low' key value
782
+ * data: {
783
+ * rows: [
784
+ * ["data1", "data2"],
785
+ * [
786
+ * // or {high:150, mid: 140, low: 110}, 120
787
+ * [150, 140, 110], 120
788
+ * ],
789
+ * [[155, 130, 115], 55],
790
+ * [[160, 135, 120], 60]
791
+ * ],
792
+ * types: {
793
+ * data1: "area-line-range",
794
+ * data2: "line"
795
+ * }
796
+ * }
797
+ *
798
+ * // for 'bubble' type, data can contain dimension value:
799
+ * // - an array of [y, z] data following the order
800
+ * // - or an object with 'y' and 'z' key value
801
+ * // 'y' is for y axis coordination and 'z' is the bubble radius value
802
+ * data: {
803
+ * rows: [
804
+ * ["data1", "data2"],
805
+ * [
806
+ * // or {y:10, z: 140}, 120
807
+ * [10, 140], 120
808
+ * ],
809
+ * [[100, 30], 55],
810
+ * [[50, 100], 60]
811
+ * ],
812
+ * types: {
813
+ * data1: "bubble",
814
+ * data2: "line"
815
+ * }
816
+ * }
817
+ *
818
+ * // for 'candlestick' type, data should contain:
819
+ * // - an array of [open, high, low, close, volume(optional)] data following the order
820
+ * // - or an object with 'open', 'high', 'low', 'close' and 'value'(optional) key value
821
+ * data: {
822
+ * rows: [
823
+ * ["data1", "data2"],
824
+ * [
825
+ * // open, high, low, close, volume (optional)
826
+ * {open: 1300, high: 1369, low: 1200, close: 1339, volume: 100},
827
+ * [1000, 1100, 850, 870]
828
+ * ],
829
+ * [
830
+ * {open: 1348, high: 1371, low: 1271, close: 1320},
831
+ * [870, 1250, 830, 1200, 50]
832
+ * ]
833
+ * ],
834
+ * type: "candlestick"
835
+ * }
836
+ */
837
+ data_rows: void 0,
838
+ /**
839
+ * Load data from a multidimensional array, with each element containing an array consisting of a datum name and associated data values.
840
+ * @name data․columns
841
+ * @memberof Options
842
+ * @type {Array}
843
+ * @default undefined
844
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.ColumnOrientedData)
845
+ * @example
846
+ * data: {
847
+ * columns: [
848
+ * ["data1", 30, 20, 50, 40, 60, 50],
849
+ * ["data2", 200, 130, 90, 240, 130, 220],
850
+ * ["data3", 300, 200, 160, 400, 250, 250]
851
+ * ]
852
+ * }
853
+ *
854
+ * // for 'bar' type, data can contain:
855
+ * // - an array of [start, end] data following the order
856
+ * data: {
857
+ * columns: [
858
+ * ["data1", -100, 50, [100, 200], [200, 300]],
859
+ * ["data2", -200, 300, [-100, 100], [-50, -30]],
860
+ * ],
861
+ * type: "bar"
862
+ * }
863
+ *
864
+ * // for 'range' types('area-line-range' or 'area-step-range' or 'area-spline-range'), data should contain:
865
+ * // - an array of [high, mid, low] data following the order
866
+ * // - or an object with 'high', 'mid' and 'low' key value
867
+ * data: {
868
+ * columns: [
869
+ * ["data1",
870
+ * [150, 140, 110], // or {high:150, mid: 140, low: 110}
871
+ * [150, 140, 110],
872
+ * [150, 140, 110]
873
+ * ]
874
+ * ],
875
+ * type: "area-line-range"
876
+ * }
877
+ *
878
+ * // for 'bubble' type, data can contain dimension value:
879
+ * // - an array of [y, z] data following the order
880
+ * // - or an object with 'y' and 'z' key value
881
+ * // 'y' is for y axis coordination and 'z' is the bubble radius value
882
+ * data: {
883
+ * columns: [
884
+ * ["data1",
885
+ * [10, 140], // or {y:10, z: 140}
886
+ * [100, 30],
887
+ * [50, 100]
888
+ * ]
889
+ * ],
890
+ * type: "bubble"
891
+ * }
892
+ *
893
+ * // for 'candlestick' type, data should contain:
894
+ * // - an array of [open, high, low, close, volume(optional)] data following the order
895
+ * // - or an object with 'open', 'high', 'low', 'close' and 'value'(optional) key value
896
+ * data: {
897
+ * columns: [
898
+ * ["data1",
899
+ * [1000, 1100, 850, 870, 100], // or {open:1000, high: 1100, low: 870, volume: 100}
900
+ * [870, 1250, 830, 1200] // 'volume' can be omitted
901
+ * ]
902
+ * ],
903
+ * type: "candlestick"
904
+ * }
905
+ */
906
+ data_columns: void 0,
907
+ /**
908
+ * Used if loading JSON via data.url.
909
+ * - **Available Values:**
910
+ * - json
911
+ * - csv
912
+ * - tsv
913
+ * @name data․mimeType
914
+ * @memberof Options
915
+ * @type {string}
916
+ * @default csv
917
+ * @example
918
+ * data: {
919
+ * mimeType: "json"
920
+ * }
921
+ */
922
+ data_mimeType: "csv",
923
+ /**
924
+ * Choose which JSON object keys correspond to desired data.
925
+ * - **NOTE:** Only for JSON object given as array.
926
+ * @name data․keys
927
+ * @memberof Options
928
+ * @type {string}
929
+ * @default undefined
930
+ * @example
931
+ * data: {
932
+ * json: [
933
+ * {name: "www.site1.com", upload: 200, download: 200, total: 400},
934
+ * {name: "www.site2.com", upload: 100, download: 300, total: 400},
935
+ * {name: "www.site3.com", upload: 300, download: 200, total: 500},
936
+ * {name: "www.site4.com", upload: 400, download: 100, total: 500}
937
+ * ],
938
+ * keys: {
939
+ * // case 1: specify 'x' key for category axis
940
+ * x: "name", // 'name' key will be used as category x axis values
941
+ * value: ["upload", "download"]
942
+ *
943
+ * // case 2: without 'x' key for non-category axis
944
+ * value: ["upload", "download"]
945
+ * }
946
+ * }
947
+ */
948
+ data_keys: void 0,
949
+ /**
950
+ * Set text label to be displayed when there's no data to show.
951
+ * - ex. Toggling all visible data to not be shown, unloading all current data, etc.
952
+ * @name data․empty․label․text
953
+ * @memberof Options
954
+ * @type {string}
955
+ * @default ""
956
+ * @example
957
+ * data: {
958
+ * empty: {
959
+ * label: {
960
+ * text: "No Data"
961
+ * }
962
+ * }
963
+ * }
964
+ */
965
+ data_empty_label_text: ""
965
966
  };
966
-
967
- export { data as default };
967
+ //#endregion
968
+ export { data_default as default };