billboard.js 4.0.2 → 4.0.3

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 (223) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +102 -71
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +16 -17
  5. package/dist/billboard.pkgd.js +102 -71
  6. package/dist/billboard.pkgd.min.js +22 -23
  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 +2 -2
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +2 -2
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +2 -2
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
  16. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  17. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
  19. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2 -2
  20. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +2 -2
  21. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +2 -2
  22. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +2 -2
  23. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2 -2
  24. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +2 -2
  25. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2 -2
  26. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +2 -2
  27. package/dist/theme/dark.css +1 -1
  28. package/dist/theme/dark.min.css +1 -1
  29. package/dist/theme/datalab.css +1 -1
  30. package/dist/theme/datalab.min.css +1 -1
  31. package/dist/theme/graph.css +1 -1
  32. package/dist/theme/graph.min.css +1 -1
  33. package/dist/theme/insight.css +1 -1
  34. package/dist/theme/insight.min.css +1 -1
  35. package/dist/theme/modern.css +1 -1
  36. package/dist/theme/modern.min.css +1 -1
  37. package/dist-esm/Chart/Chart.js +1 -1
  38. package/dist-esm/Chart/api/axis.js +1 -1
  39. package/dist-esm/Chart/api/category.js +1 -1
  40. package/dist-esm/Chart/api/chart.js +1 -1
  41. package/dist-esm/Chart/api/color.js +1 -1
  42. package/dist-esm/Chart/api/data.js +1 -1
  43. package/dist-esm/Chart/api/export.js +1 -1
  44. package/dist-esm/Chart/api/flow.js +1 -1
  45. package/dist-esm/Chart/api/focus.js +7 -11
  46. package/dist-esm/Chart/api/grid.js +1 -1
  47. package/dist-esm/Chart/api/group.js +1 -1
  48. package/dist-esm/Chart/api/legend.js +1 -1
  49. package/dist-esm/Chart/api/load.js +1 -1
  50. package/dist-esm/Chart/api/regions.js +1 -1
  51. package/dist-esm/Chart/api/selection.js +1 -1
  52. package/dist-esm/Chart/api/show.js +1 -1
  53. package/dist-esm/Chart/api/stubs.js +1 -1
  54. package/dist-esm/Chart/api/subchart.js +1 -1
  55. package/dist-esm/Chart/api/tooltip.js +1 -1
  56. package/dist-esm/Chart/api/x.js +1 -1
  57. package/dist-esm/Chart/api/zoom.js +1 -1
  58. package/dist-esm/ChartInternal/Axis/Axis.js +1 -1
  59. package/dist-esm/ChartInternal/Axis/AxisRenderer.js +1 -1
  60. package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +1 -1
  61. package/dist-esm/ChartInternal/ChartInternal.js +1 -1
  62. package/dist-esm/ChartInternal/data/convert.helper.js +1 -1
  63. package/dist-esm/ChartInternal/data/convert.js +1 -1
  64. package/dist-esm/ChartInternal/data/data.js +15 -6
  65. package/dist-esm/ChartInternal/data/load.js +1 -1
  66. package/dist-esm/ChartInternal/interactions/drag.js +1 -1
  67. package/dist-esm/ChartInternal/interactions/eventrect.js +1 -1
  68. package/dist-esm/ChartInternal/interactions/flow.js +1 -1
  69. package/dist-esm/ChartInternal/interactions/interaction.js +1 -1
  70. package/dist-esm/ChartInternal/interactions/subchart.js +1 -1
  71. package/dist-esm/ChartInternal/interactions/zoom.js +1 -1
  72. package/dist-esm/ChartInternal/internals/category.js +1 -1
  73. package/dist-esm/ChartInternal/internals/class.js +1 -1
  74. package/dist-esm/ChartInternal/internals/clip.js +1 -1
  75. package/dist-esm/ChartInternal/internals/color.js +5 -5
  76. package/dist-esm/ChartInternal/internals/domain.js +1 -1
  77. package/dist-esm/ChartInternal/internals/format.js +1 -1
  78. package/dist-esm/ChartInternal/internals/grid.js +1 -1
  79. package/dist-esm/ChartInternal/internals/legend.js +1 -1
  80. package/dist-esm/ChartInternal/internals/redraw.js +1 -1
  81. package/dist-esm/ChartInternal/internals/region.js +1 -1
  82. package/dist-esm/ChartInternal/internals/scale.js +1 -1
  83. package/dist-esm/ChartInternal/internals/selection.js +1 -1
  84. package/dist-esm/ChartInternal/internals/size.axis.js +1 -1
  85. package/dist-esm/ChartInternal/internals/size.js +1 -1
  86. package/dist-esm/ChartInternal/internals/style.js +1 -1
  87. package/dist-esm/ChartInternal/internals/text.arc.js +1 -1
  88. package/dist-esm/ChartInternal/internals/text.js +2 -2
  89. package/dist-esm/ChartInternal/internals/text.util.js +1 -1
  90. package/dist-esm/ChartInternal/internals/title.js +1 -1
  91. package/dist-esm/ChartInternal/internals/tooltip.js +1 -1
  92. package/dist-esm/ChartInternal/internals/transform.js +1 -1
  93. package/dist-esm/ChartInternal/internals/type.js +26 -34
  94. package/dist-esm/ChartInternal/shape/arc.js +1 -1
  95. package/dist-esm/ChartInternal/shape/area.js +1 -1
  96. package/dist-esm/ChartInternal/shape/bar.js +23 -7
  97. package/dist-esm/ChartInternal/shape/bubble.js +1 -1
  98. package/dist-esm/ChartInternal/shape/candlestick.js +1 -1
  99. package/dist-esm/ChartInternal/shape/core/barRadius.js +1 -1
  100. package/dist-esm/ChartInternal/shape/core/bubble.js +1 -1
  101. package/dist-esm/ChartInternal/shape/core/candlestick.js +1 -1
  102. package/dist-esm/ChartInternal/shape/core/dataRegion.js +1 -1
  103. package/dist-esm/ChartInternal/shape/core/geometry.js +1 -1
  104. package/dist-esm/ChartInternal/shape/core/path.js +1 -1
  105. package/dist-esm/ChartInternal/shape/core/point.js +1 -1
  106. package/dist-esm/ChartInternal/shape/core/treemap.js +1 -1
  107. package/dist-esm/ChartInternal/shape/funnel.js +1 -1
  108. package/dist-esm/ChartInternal/shape/gauge.js +1 -1
  109. package/dist-esm/ChartInternal/shape/line.js +2 -2
  110. package/dist-esm/ChartInternal/shape/point.js +22 -10
  111. package/dist-esm/ChartInternal/shape/polar.js +1 -1
  112. package/dist-esm/ChartInternal/shape/radar.js +1 -1
  113. package/dist-esm/ChartInternal/shape/shape.js +19 -4
  114. package/dist-esm/ChartInternal/shape/treemap.js +1 -1
  115. package/dist-esm/canvas/CanvasAxisRenderer.js +1 -1
  116. package/dist-esm/canvas/CanvasEngine.js +1 -1
  117. package/dist-esm/canvas/CanvasPainter.js +1 -1
  118. package/dist-esm/canvas/CanvasRenderer.js +1 -1
  119. package/dist-esm/canvas/CanvasTheme.js +1 -1
  120. package/dist-esm/canvas/HitDetector.js +1 -1
  121. package/dist-esm/canvas/axisTicks.js +1 -1
  122. package/dist-esm/canvas/classes.js +1 -1
  123. package/dist-esm/canvas/color.js +1 -1
  124. package/dist-esm/canvas/geometry.js +1 -1
  125. package/dist-esm/canvas/labels.js +1 -1
  126. package/dist-esm/canvas/pointPattern.js +1 -1
  127. package/dist-esm/canvas/util.js +1 -1
  128. package/dist-esm/config/Options/Options.js +1 -1
  129. package/dist-esm/config/Options/axis/axis.js +1 -1
  130. package/dist-esm/config/Options/axis/x.js +1 -1
  131. package/dist-esm/config/Options/axis/y.js +1 -1
  132. package/dist-esm/config/Options/axis/y2.js +1 -1
  133. package/dist-esm/config/Options/common/boost.js +1 -1
  134. package/dist-esm/config/Options/common/color.js +1 -1
  135. package/dist-esm/config/Options/common/grid.js +1 -1
  136. package/dist-esm/config/Options/common/legend.js +1 -1
  137. package/dist-esm/config/Options/common/main.js +1 -1
  138. package/dist-esm/config/Options/common/point.js +1 -1
  139. package/dist-esm/config/Options/common/title.js +1 -1
  140. package/dist-esm/config/Options/common/tooltip.js +1 -1
  141. package/dist-esm/config/Options/data/axis.js +1 -1
  142. package/dist-esm/config/Options/data/data.js +1 -1
  143. package/dist-esm/config/Options/data/selection.js +1 -1
  144. package/dist-esm/config/Options/interaction/interaction.js +1 -1
  145. package/dist-esm/config/Options/interaction/subchart.js +1 -1
  146. package/dist-esm/config/Options/interaction/zoom.js +1 -1
  147. package/dist-esm/config/Options/shape/arc.js +1 -1
  148. package/dist-esm/config/Options/shape/area.js +1 -1
  149. package/dist-esm/config/Options/shape/bar.js +1 -1
  150. package/dist-esm/config/Options/shape/bubble.js +1 -1
  151. package/dist-esm/config/Options/shape/candlestick.js +1 -1
  152. package/dist-esm/config/Options/shape/donut.js +1 -1
  153. package/dist-esm/config/Options/shape/funnel.js +1 -1
  154. package/dist-esm/config/Options/shape/gauge.js +1 -1
  155. package/dist-esm/config/Options/shape/line.js +1 -1
  156. package/dist-esm/config/Options/shape/pie.js +1 -1
  157. package/dist-esm/config/Options/shape/polar.js +1 -1
  158. package/dist-esm/config/Options/shape/radar.js +1 -1
  159. package/dist-esm/config/Options/shape/scatter.js +1 -1
  160. package/dist-esm/config/Options/shape/spline.js +1 -1
  161. package/dist-esm/config/Options/shape/treemap.js +1 -1
  162. package/dist-esm/config/Store/Element.js +1 -1
  163. package/dist-esm/config/Store/State.js +1 -1
  164. package/dist-esm/config/Store/Store.js +1 -1
  165. package/dist-esm/config/classes.js +1 -1
  166. package/dist-esm/config/config.js +1 -1
  167. package/dist-esm/config/const.js +1 -1
  168. package/dist-esm/config/resolver/axis.core.js +1 -1
  169. package/dist-esm/config/resolver/axis.js +1 -1
  170. package/dist-esm/config/resolver/canvas.js +1 -1
  171. package/dist-esm/config/resolver/canvasShape.js +1 -1
  172. package/dist-esm/config/resolver/category.js +1 -1
  173. package/dist-esm/config/resolver/export.js +1 -1
  174. package/dist-esm/config/resolver/flow.js +1 -1
  175. package/dist-esm/config/resolver/grid.js +1 -1
  176. package/dist-esm/config/resolver/interaction/selection.js +1 -1
  177. package/dist-esm/config/resolver/interaction/subchart.js +1 -1
  178. package/dist-esm/config/resolver/interaction/zoom.js +1 -1
  179. package/dist-esm/config/resolver/regions.js +1 -1
  180. package/dist-esm/config/resolver/shape/arc.helpers.js +1 -1
  181. package/dist-esm/config/resolver/shape/area.js +1 -1
  182. package/dist-esm/config/resolver/shape/axis.helpers.js +1 -1
  183. package/dist-esm/config/resolver/shape/bar.js +1 -1
  184. package/dist-esm/config/resolver/shape/bubble.js +1 -1
  185. package/dist-esm/config/resolver/shape/candlestick.js +1 -1
  186. package/dist-esm/config/resolver/shape/donut.js +1 -1
  187. package/dist-esm/config/resolver/shape/funnel.js +1 -1
  188. package/dist-esm/config/resolver/shape/gauge.js +1 -1
  189. package/dist-esm/config/resolver/shape/line.js +1 -1
  190. package/dist-esm/config/resolver/shape/pie.js +1 -1
  191. package/dist-esm/config/resolver/shape/polar.js +1 -1
  192. package/dist-esm/config/resolver/shape/radar.js +1 -1
  193. package/dist-esm/config/resolver/shape/scatter.js +1 -1
  194. package/dist-esm/config/resolver/shape/treemap.js +1 -1
  195. package/dist-esm/core.js +3 -3
  196. package/dist-esm/index.canvas.js +1 -1
  197. package/dist-esm/index.esm.js +1 -1
  198. package/dist-esm/module/Cache.js +1 -1
  199. package/dist-esm/module/browser.js +1 -1
  200. package/dist-esm/module/dsv.js +1 -1
  201. package/dist-esm/module/error.js +1 -1
  202. package/dist-esm/module/generator.js +1 -1
  203. package/dist-esm/module/sanitize.js +1 -1
  204. package/dist-esm/module/util/brush.js +1 -1
  205. package/dist-esm/module/util/dom.js +1 -1
  206. package/dist-esm/module/util/object.js +1 -1
  207. package/dist-esm/module/util/type-checks.js +1 -1
  208. package/dist-esm/module/worker.js +1 -1
  209. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  210. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
  211. package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
  212. package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
  213. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  214. package/package.json +1 -1
  215. package/src/Chart/api/focus.ts +8 -12
  216. package/src/ChartInternal/data/data.ts +15 -5
  217. package/src/ChartInternal/internals/color.ts +5 -4
  218. package/src/ChartInternal/internals/text.ts +1 -1
  219. package/src/ChartInternal/internals/type.ts +26 -32
  220. package/src/ChartInternal/shape/bar.ts +26 -7
  221. package/src/ChartInternal/shape/line.ts +1 -1
  222. package/src/ChartInternal/shape/point.ts +26 -12
  223. package/src/ChartInternal/shape/shape.ts +25 -3
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { scaleOrdinal } from 'd3-scale';
11
11
  import { select } from 'd3-selection';
@@ -201,14 +201,14 @@ var color = {
201
201
  const id = `${state.datetimeId}-labels-bg${$$.getTargetSelectorSuffix(v)}${isString(color) ? $$.getTargetSelectorSuffix(color) : ""}`;
202
202
  const colorValue = sanitize(v === "" ? color : color?.[v] || "");
203
203
  if (defs.select(`#${id}`).empty()) {
204
- defs.append("filter")
204
+ const filter = defs.append("filter")
205
205
  .attr("x", attr.x)
206
206
  .attr("y", attr.y)
207
207
  .attr("width", attr.width)
208
208
  .attr("height", attr.height)
209
- .attr("id", id)
210
- .html(`<feFlood flood-color="${colorValue}" />
211
- <feComposite in="SourceGraphic" />`);
209
+ .attr("id", id);
210
+ filter.append("feFlood").attr("flood-color", colorValue);
211
+ filter.append("feComposite").attr("in", "SourceGraphic");
212
212
  }
213
213
  });
214
214
  }
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { TYPE, TYPE_BY_CATEGORY } from '../../config/const.js';
11
11
  import { KEY } from '../../module/Cache.js';
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { isArray, isValue, isObject, isFunction, isObjectType } from '../../module/util/type-checks.js';
11
11
 
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { select, selectAll } from 'd3-selection';
11
11
  import { $GRID, $AXIS, $FOCUS, $COMMON } from '../../config/classes.js';
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { select, namespaces } from 'd3-selection';
11
11
  import { $LEGEND, $FOCUS, $GAUGE } from '../../config/classes.js';
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { transition } from 'd3-transition';
11
11
  import { $TEXT, $COMMON, $SELECT } from '../../config/classes.js';
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { select } from 'd3-selection';
11
11
  import { $REGION } from '../../config/classes.js';
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { scaleUtc, scaleTime, scaleLog, scaleSymlog, scaleLinear } from 'd3-scale';
11
11
  import { parseDate } from '../../module/util/object.js';
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { select } from 'd3-selection';
11
11
  import { $SELECT, $SHAPE } from '../../config/classes.js';
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { isNumber } from '../../module/util/type-checks.js';
11
11
 
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { $SUBCHART, $AXIS } from '../../config/classes.js';
11
11
  import { document as doc } from '../../module/browser.js';
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { $SHAPE } from '../../config/classes.js';
11
11
  import { isFunction, isString } from '../../module/util/type-checks.js';
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { select } from 'd3-selection';
11
11
  import { $ARC } from '../../config/classes.js';
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { selectAll, select } from 'd3-selection';
11
11
  import { $TEXT, $COMMON } from '../../config/classes.js';
@@ -505,7 +505,7 @@ var text = {
505
505
  const textNode = textNodes.filter(node => node.data.id === id);
506
506
  const translate = getTranslation(textNode.node());
507
507
  // Calculates the length of the hypotenuse
508
- const calcHypo = (x, y) => Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
508
+ const calcHypo = (x, y) => Math.sqrt(x * x + y * y);
509
509
  textNode.node() && filteredTextNodes.each(function () {
510
510
  const coordinate = getTranslation(this);
511
511
  const filteredTextNode = select(this);
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { select } from 'd3-selection';
11
11
  import { $TEXT } from '../../config/classes.js';
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { $TEXT } from '../../config/classes.js';
11
11
  import { getElementPos, getBBox, setTextValue, getBoundingRect } from '../../module/util/dom.js';
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { select } from 'd3-selection';
11
11
  import { $TOOLTIP, $ARC } from '../../config/classes.js';
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { $AXIS, $ARC } from '../../config/classes.js';
11
11
  import { asHalfPixel } from '../../module/util/type-checks.js';
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { TYPE_BY_CATEGORY, TYPE } from '../../config/const.js';
11
11
  import { isNumber, isArray, isString } from '../../module/util/type-checks.js';
@@ -14,6 +14,25 @@ import { isNumber, isArray, isString } from '../../module/util/type-checks.js';
14
14
  * Copyright (c) 2017 ~ present NAVER Corp.
15
15
  * billboard.js project is licensed under the MIT license
16
16
  */
17
+ // Module-level constant: avoids re-creating the list on every isInterpolationType() call
18
+ // https://github.com/d3/d3-shape#curves
19
+ const INTERPOLATION_TYPES = new Set([
20
+ "basis",
21
+ "basis-closed",
22
+ "basis-open",
23
+ "bundle",
24
+ "cardinal",
25
+ "cardinal-closed",
26
+ "cardinal-open",
27
+ "catmull-rom",
28
+ "catmull-rom-closed",
29
+ "catmull-rom-open",
30
+ "linear",
31
+ "linear-closed",
32
+ "monotone-x",
33
+ "monotone-y",
34
+ "natural"
35
+ ]);
17
36
  var typeInternals = {
18
37
  /**
19
38
  * Check if the given chart type is valid
@@ -69,29 +88,19 @@ var typeInternals = {
69
88
  const { config, state: { current } } = $$;
70
89
  const types = config.data_types;
71
90
  const targets = targetsValue || $$.data.targets;
72
- let has = false;
73
91
  if (!checkFromData && current.types?.indexOf(type) > -1) {
74
- has = true;
92
+ return true;
75
93
  }
76
94
  else if (targets?.length) {
77
- targets.forEach(target => {
95
+ return targets.some(target => {
78
96
  const t = types[target.id];
79
- if (t === type || (!t && type === "line")) {
80
- has = true;
81
- }
97
+ return t === type || (!t && type === "line");
82
98
  });
83
99
  }
84
100
  else if (Object.keys(types).length) {
85
- Object.keys(types).forEach(id => {
86
- if (types[id] === type) {
87
- has = true;
88
- }
89
- });
90
- }
91
- else {
92
- has = config.data_type === type;
101
+ return Object.values(types).some(t => t === type);
93
102
  }
94
- return has;
103
+ return config.data_type === type;
95
104
  },
96
105
  /**
97
106
  * Check if contains given chart types
@@ -230,25 +239,8 @@ var typeInternals = {
230
239
  barLineBubbleData(d) {
231
240
  return this.isBarType(d) || this.isLineType(d) || this.isBubbleType(d) ? d.values : [];
232
241
  },
233
- // https://github.com/d3/d3-shape#curves
234
242
  isInterpolationType(type) {
235
- return [
236
- "basis",
237
- "basis-closed",
238
- "basis-open",
239
- "bundle",
240
- "cardinal",
241
- "cardinal-closed",
242
- "cardinal-open",
243
- "catmull-rom",
244
- "catmull-rom-closed",
245
- "catmull-rom-open",
246
- "linear",
247
- "linear-closed",
248
- "monotone-x",
249
- "monotone-y",
250
- "natural"
251
- ].indexOf(type) >= 0;
243
+ return INTERPOLATION_TYPES.has(type);
252
244
  }
253
245
  };
254
246
 
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { interpolate } from 'd3-interpolate';
11
11
  import { select } from 'd3-selection';
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { select } from 'd3-selection';
11
11
  import { $AREA, $CIRCLE, $LINE } from '../../config/classes.js';
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { select } from 'd3-selection';
11
11
  import { $BAR, $COMMON } from '../../config/classes.js';
@@ -94,12 +94,23 @@ var shapeBar = {
94
94
  .remove();
95
95
  $root.bar = bar.enter().append("path")
96
96
  .attr("class", classBar)
97
- .style("fill", $$.updateBarColor.bind($$))
97
+ .style("fill", $$.generateUpdateBarColor())
98
98
  .merge(bar)
99
99
  .style("opacity", initialOpacity);
100
100
  // calculate ratio if grouped data exists
101
101
  $$.setRatioForGroupedData($root.bar.data());
102
102
  },
103
+ /**
104
+ * Generate bar color accessor, hoisting the bound color function
105
+ * to be created once per call (not per datum)
106
+ * @returns {function} Color accessor
107
+ * @private
108
+ */
109
+ generateUpdateBarColor() {
110
+ const $$ = this;
111
+ const fn = $$.getStylePropValue($$.color) || (() => null);
112
+ return (d) => getShapeColorWithGradient.call($$, d, "bar_linearGradient", fn);
113
+ },
103
114
  /**
104
115
  * Update bar color
105
116
  * @param {object} d Data object
@@ -107,9 +118,7 @@ var shapeBar = {
107
118
  * @private
108
119
  */
109
120
  updateBarColor(d) {
110
- const $$ = this;
111
- const fn = $$.getStylePropValue($$.color);
112
- return getShapeColorWithGradient.call($$, d, "bar_linearGradient", fn || (() => null));
121
+ return this.generateUpdateBarColor()(d);
113
122
  },
114
123
  /**
115
124
  * Redraw function
@@ -150,7 +159,7 @@ var shapeBar = {
150
159
  }
151
160
  return path[0];
152
161
  })
153
- .style("fill", $$.updateBarColor.bind($$))
162
+ .style("fill", $$.generateUpdateBarColor())
154
163
  .style("clip-path", d => d.clipPath)
155
164
  .style("opacity", null)
156
165
  ];
@@ -181,6 +190,7 @@ var shapeBar = {
181
190
  const getPoints = $$.generateGetBarPoints(barIndices, isSub);
182
191
  const getRadius = getBarRadiusResolver($$);
183
192
  const stackingRadiusSet = getRadius ? getStackingBarRadiusSet($$) : new Set();
193
+ const connectLineCache = new Map();
184
194
  return (d, i) => {
185
195
  // 4 points that make a bar
186
196
  const points = getPoints(d, i);
@@ -200,7 +210,13 @@ var shapeBar = {
200
210
  `H${pos} ${pathRadius[0]}V${points[2][indexY] - radius} ${pathRadius[1]}H${points[3][indexX]}` :
201
211
  `V${pos} ${pathRadius[0]}H${points[2][indexX] - radius} ${pathRadius[1]}V${points[3][indexY]}`;
202
212
  const coords = [`M${points[0][indexX]},${points[0][indexY]}${path}z`];
203
- if (_getConnectLineType.call($$, d.id)) {
213
+ // Memoize per series id: config lookup + regex runs once per id, not per bar
214
+ let connectLineType = connectLineCache.get(d.id);
215
+ if (connectLineType === undefined) {
216
+ connectLineType = _getConnectLineType.call($$, d.id);
217
+ connectLineCache.set(d.id, connectLineType);
218
+ }
219
+ if (connectLineType) {
204
220
  coords.push(config.axis_rotated ?
205
221
  {
206
222
  x: points[0][indexX],
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import shapeBubbleCommon from './core/bubble.js';
11
11
 
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { select } from 'd3-selection';
11
11
  import { $CANDLESTICK } from '../../config/classes.js';
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { isNumber } from '../../../module/util/type-checks.js';
11
11
 
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { KEY } from '../../../module/Cache.js';
11
11
  import { isObject, isFunction, isNumber } from '../../../module/util/type-checks.js';
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { isArray, isObject, isNumber } from '../../../module/util/type-checks.js';
11
11
 
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { isValue, isUndefined } from '../../../module/util/type-checks.js';
11
11
  import { parseDate } from '../../../module/util/object.js';
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  /**
11
11
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { area, line } from 'd3-shape';
11
11
 
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { select, namespaces } from 'd3-selection';
11
11
  import { document as doc } from '../../../module/browser.js';
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { hierarchy, treemap, treemapResquarify, treemapSquarify, treemapSliceDice, treemapSlice, treemapDice, treemapBinary } from 'd3-hierarchy';
11
11
 
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { select } from 'd3-selection';
11
11
  import { line, curveLinear } from 'd3-shape';
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { select } from 'd3-selection';
11
11
  import { $ARC, $COMMON, $GAUGE } from '../../config/classes.js';
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { $LINE } from '../../config/classes.js';
11
11
  import { getScale } from '../internals/scale.js';
@@ -228,7 +228,7 @@ var shapeLine = {
228
228
  if (hasNullDataValue) {
229
229
  const dx = x(data.x) - x(prevData.x);
230
230
  const dy = y(data.value) - y(prevData.value);
231
- const dd = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
231
+ const dd = Math.sqrt(dx * dx + dy * dy);
232
232
  diff = style[0] / dd; // dash
233
233
  diffx2 = diff * style[1]; // gap
234
234
  for (let j = diff; j <= 1; j += diffx2) {
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { select } from 'd3-selection';
11
11
  import { $COMMON, $SELECT, $CIRCLE } from '../../config/classes.js';
@@ -140,7 +140,7 @@ var shapePoint = {
140
140
  });
141
141
  circles.exit().remove();
142
142
  const pointR = $$.pointR.bind($$);
143
- const updateCircleColor = $$.updateCircleColor.bind($$);
143
+ const updateCircleColor = $$.generateUpdateCircleColor();
144
144
  const initialOpacityForCircle = $$.initialOpacityForCircle.bind($$);
145
145
  circles.enter()
146
146
  .filter(Boolean)
@@ -150,6 +150,17 @@ var shapePoint = {
150
150
  .style("opacity", initialOpacityForCircle);
151
151
  }
152
152
  },
153
+ /**
154
+ * Generate circle color accessor, hoisting the bound color function
155
+ * to be created once per call (not per datum)
156
+ * @returns {function} Color accessor
157
+ * @private
158
+ */
159
+ generateUpdateCircleColor() {
160
+ const $$ = this;
161
+ const fn = $$.getStylePropValue($$.color);
162
+ return (d) => ($$.config.point_radialGradient ? $$.getGradienColortUrl(d.id) : (fn ? fn(d) : null));
163
+ },
153
164
  /**
154
165
  * Update circle color
155
166
  * @param {object} d Data object
@@ -157,9 +168,7 @@ var shapePoint = {
157
168
  * @private
158
169
  */
159
170
  updateCircleColor(d) {
160
- const $$ = this;
161
- const fn = $$.getStylePropValue($$.color);
162
- return $$.config.point_radialGradient ? $$.getGradienColortUrl(d.id) : (fn ? fn(d) : null);
171
+ return this.generateUpdateCircleColor()(d);
163
172
  },
164
173
  redrawCircle(cx, cy, withTransition, flow, isSub = false) {
165
174
  const $$ = this;
@@ -172,6 +181,7 @@ var shapePoint = {
172
181
  const posAttr = $$.isCirclePoint() ? "c" : "";
173
182
  const t = getRandom();
174
183
  const opacityStyleFn = $$.opacityForCircle.bind($$);
184
+ const updateCircleColor = $$.generateUpdateCircleColor();
175
185
  // For standard circle type, batch the update across all circles in one pass
176
186
  if ($$.isCirclePoint()) {
177
187
  const sel = $root.circle;
@@ -188,14 +198,14 @@ var shapePoint = {
188
198
  $T(sel.filter(function () {
189
199
  return !!this.getAttribute("cx");
190
200
  }), true, `${t}-pos`)
191
- .attr("cx", cx).attr("cy", cy).style("fill", $$.updateCircleColor.bind($$));
201
+ .attr("cx", cx).attr("cy", cy).style("fill", updateCircleColor);
192
202
  sel.filter(function () {
193
203
  return !this.getAttribute("cx");
194
204
  })
195
- .attr("cx", cx).attr("cy", cy).style("fill", $$.updateCircleColor.bind($$));
205
+ .attr("cx", cx).attr("cy", cy).style("fill", updateCircleColor);
196
206
  }
197
207
  else {
198
- sel.attr("cx", cx).attr("cy", cy).style("fill", $$.updateCircleColor.bind($$));
208
+ sel.attr("cx", cx).attr("cy", cy).style("fill", updateCircleColor);
199
209
  }
200
210
  const result = $T(sel, withTransition || !rendered, t)
201
211
  .style("opacity", opacityStyleFn);
@@ -204,7 +214,7 @@ var shapePoint = {
204
214
  $T(selectedCircles, withTransition).attr("cx", cx).attr("cy", cy)
205
215
  ];
206
216
  }
207
- const fn = $$.point("update", $$, cx, cy, $$.updateCircleColor.bind($$), withTransition, flow, selectedCircles);
217
+ const fn = $$.point("update", $$, cx, cy, updateCircleColor, withTransition, flow, selectedCircles);
208
218
  const mainCircles = [];
209
219
  $root.circle.each(function (d) {
210
220
  let result = fn.bind(this)(d);
@@ -321,7 +331,9 @@ var shapePoint = {
321
331
  cx = x;
322
332
  cy = y;
323
333
  }
324
- return Math.sqrt(Math.pow(cx - mouse[0], 2) + Math.pow(cy - mouse[1], 2)) < (r || pointSensitivity);
334
+ const dx = cx - mouse[0];
335
+ const dy = cy - mouse[1];
336
+ return Math.sqrt(dx * dx + dy * dy) < (r || pointSensitivity);
325
337
  },
326
338
  updatePointClass(d) {
327
339
  const $$ = this;
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { $LEVEL } from '../../config/classes.js';
11
11
  import { getRange } from '../../module/util/object.js';
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 4.0.2
8
+ * @version 4.0.3
9
9
  */
10
10
  import { select } from 'd3-selection';
11
11
  import { $AXIS, $LEVEL, $TEXT, $COMMON, $RADAR, $SHAPE } from '../../config/classes.js';