billboard.js 4.0.0-next.3 → 4.0.0

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 (228) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +240 -149
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +20 -20
  5. package/dist/billboard.pkgd.js +240 -149
  6. package/dist/billboard.pkgd.min.js +27 -27
  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 +11 -13
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
  11. package/dist/plugin/billboardjs-plugin-stanford.js +11 -13
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +4 -4
  13. package/dist/plugin/billboardjs-plugin-tableview.js +28 -15
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +4 -4
  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 +11 -13
  20. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +9 -9
  21. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +11 -13
  22. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +3 -3
  23. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +28 -15
  24. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +6 -6
  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 +1 -1
  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 +53 -0
  54. package/dist-esm/Chart/api/subchart.js +2 -2
  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 +2 -2
  58. package/dist-esm/ChartInternal/Axis/Axis.js +1 -1
  59. package/dist-esm/ChartInternal/Axis/AxisRenderer.js +149 -96
  60. package/dist-esm/ChartInternal/Axis/AxisRendererHelper.js +1 -1
  61. package/dist-esm/ChartInternal/ChartInternal.js +8 -4
  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 +1 -1
  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 +2 -2
  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 +1 -1
  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 +1 -1
  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 +1 -1
  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 +1 -1
  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 +1 -1
  110. package/dist-esm/ChartInternal/shape/point.js +1 -1
  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 +6 -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 +18 -5
  117. package/dist-esm/canvas/CanvasPainter.js +1 -1
  118. package/dist-esm/canvas/CanvasRenderer.js +58 -35
  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 -13
  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 +17 -2
  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 +2 -1
  197. package/dist-esm/index.esm.js +2 -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 +16 -3
  202. package/dist-esm/module/generator.js +1 -1
  203. package/dist-esm/module/sanitize.js +14 -18
  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 +7 -4
  207. package/dist-esm/module/util/type-checks.js +1 -1
  208. package/dist-esm/module/worker.js +32 -22
  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 +32 -21
  213. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  214. package/package.json +37 -11
  215. package/src/ChartInternal/Axis/AxisRenderer.ts +179 -105
  216. package/src/ChartInternal/ChartInternal.ts +11 -3
  217. package/src/ChartInternal/interactions/eventrect.ts +3 -1
  218. package/src/ChartInternal/shape/shape.ts +5 -3
  219. package/src/Plugin/tableview/Options.ts +17 -1
  220. package/src/Plugin/tableview/index.ts +1 -1
  221. package/src/canvas/CanvasEngine.ts +18 -5
  222. package/src/canvas/CanvasRenderer.ts +71 -36
  223. package/src/config/Options/axis/y2.ts +0 -13
  224. package/src/module/sanitize.ts +13 -20
  225. package/src/module/util/object.ts +4 -2
  226. package/src/module/worker.ts +34 -24
  227. package/types/index.d.ts +0 -3
  228. package/types/plugin/tableview/options.d.ts +5 -0
@@ -188,6 +188,22 @@ function drawCanvasArea($$, target, indices, painter: CanvasPainter, isSub = fal
188
188
  });
189
189
  }
190
190
 
191
+ /**
192
+ * Get a target copy clipped to the current visible x range.
193
+ * @param {object} $$ ChartInternal instance
194
+ * @param {object} target Data target
195
+ * @returns {object} Original target or a visible values copy
196
+ * @private
197
+ */
198
+ function getVisibleCanvasTarget($$, target) {
199
+ const range = getCanvasTargetVisibleRange($$, target);
200
+
201
+ return range.start === 0 && range.end === target.values.length ? target : {
202
+ ...target,
203
+ values: target.values.slice(range.start, range.end)
204
+ };
205
+ }
206
+
191
207
  /**
192
208
  * Get focused row for a datum or target.
193
209
  * @param {Array} focusData Focused data rows
@@ -1657,8 +1673,7 @@ export default class CanvasRenderer {
1657
1673
  d &&
1658
1674
  (
1659
1675
  isCanvasBarType($$, d) ||
1660
- isCanvasCandlestickType($$, d) ||
1661
- (isCanvasPointType($$, d) && getPointOpacity($$, d) < 1)
1676
+ isCanvasCandlestickType($$, d)
1662
1677
  )
1663
1678
  );
1664
1679
  }
@@ -1684,7 +1699,9 @@ export default class CanvasRenderer {
1684
1699
 
1685
1700
  painter.withTranslation(margin.left, margin.top, () => {
1686
1701
  for (const target of targets) {
1687
- if (!target.values.some(hasCanvasDrawableValue.bind(null, $$))) {
1702
+ const visibleTarget = getVisibleCanvasTarget($$, target);
1703
+
1704
+ if (!visibleTarget.values.some(hasCanvasDrawableValue.bind(null, $$))) {
1688
1705
  continue;
1689
1706
  }
1690
1707
 
@@ -1693,9 +1710,9 @@ export default class CanvasRenderer {
1693
1710
  style.shape.lineFocusedWidth :
1694
1711
  style.shape.lineWidth;
1695
1712
  ctx.strokeStyle = $$.color(target.id);
1696
- $$.config.data_regions?.[target.id] ?
1697
- drawCanvasLineWithDataRegions($$, target, painter) :
1698
- drawCanvasLine($$, target, indices, painter);
1713
+ $$.config.data_regions?.[visibleTarget.id] ?
1714
+ drawCanvasLineWithDataRegions($$, visibleTarget, painter) :
1715
+ drawCanvasLine($$, visibleTarget, indices, painter);
1699
1716
  }
1700
1717
  ctx.globalAlpha = 1;
1701
1718
  });
@@ -1723,23 +1740,26 @@ export default class CanvasRenderer {
1723
1740
 
1724
1741
  painter.withTranslation(margin.left, margin.top, () => {
1725
1742
  for (const target of targets) {
1726
- if (!target.values.some(hasCanvasDrawableValue.bind(null, $$))) {
1743
+ const visibleTarget = getVisibleCanvasTarget($$, target);
1744
+
1745
+ if (!visibleTarget.values.some(hasCanvasDrawableValue.bind(null, $$))) {
1727
1746
  continue;
1728
1747
  }
1729
1748
 
1730
- const color = getCanvasRenderColor($$, target, focusData);
1749
+ const color = getCanvasRenderColor($$, visibleTarget, focusData);
1731
1750
 
1732
1751
  ctx.globalAlpha = style.shape.areaOpacity * getCanvasTargetFocusOpacity($$, target);
1733
1752
  ctx.fillStyle = getCanvasLinearGradientFill(
1734
1753
  $$,
1735
1754
  ctx,
1736
- target,
1755
+ visibleTarget,
1737
1756
  "area",
1738
- // bounds computation is a full O(n) pass: skip when no gradient is set
1757
+ // Bounds computation walks visible rows, so skip it when no gradient is set.
1758
+ // Use the original target so the range cache stays aligned with unsliced values.
1739
1759
  $$.config.area_linearGradient ? getCanvasAreaBounds($$, target, indices) : null,
1740
1760
  color
1741
1761
  );
1742
- drawCanvasArea($$, target, indices, painter);
1762
+ drawCanvasArea($$, visibleTarget, indices, painter);
1743
1763
  }
1744
1764
  ctx.globalAlpha = 1;
1745
1765
  });
@@ -2073,14 +2093,13 @@ export default class CanvasRenderer {
2073
2093
  ) &&
2074
2094
  isCanvasRenderableTarget($$, target)
2075
2095
  );
2076
- // single filtering pass: keep target-local index `i`, it drives geometry lookup
2077
- const targetRows: Array<{d, i: number, text: string}[]> = [];
2096
+ const targetRows: Array<{d, text: string}[]> = [];
2078
2097
  let labelCount = 0;
2079
2098
 
2080
2099
  targets.forEach(target => {
2081
2100
  const range = getCanvasTargetVisibleRange($$, target);
2082
2101
  const data = $$.labelishData(target);
2083
- const rows: {d, i: number, text: string}[] = [];
2102
+ const rows: {d, text: string}[] = [];
2084
2103
 
2085
2104
  for (let i = 0; i < data.length; i++) {
2086
2105
  const d = data[i];
@@ -2092,7 +2111,7 @@ export default class CanvasRenderer {
2092
2111
  d.index < range.end &&
2093
2112
  hasCanvasDrawableValue($$, d)
2094
2113
  ) {
2095
- rows.push({d, i, text});
2114
+ rows.push({d, text});
2096
2115
  }
2097
2116
  }
2098
2117
 
@@ -2110,12 +2129,12 @@ export default class CanvasRenderer {
2110
2129
 
2111
2130
  targetRows
2112
2131
  .forEach(rows => {
2113
- for (const {d, i, text} of rows) {
2132
+ for (const {d, text} of rows) {
2114
2133
  let x;
2115
2134
  let y;
2116
2135
 
2117
2136
  if (isCanvasBarType($$, d) && barPoints) {
2118
- const geometry = getCanvasBarGeometry($$, barPoints, d, i);
2137
+ const geometry = getCanvasBarGeometry($$, barPoints, d, d.index);
2119
2138
 
2120
2139
  if (!geometry) {
2121
2140
  continue;
@@ -2148,7 +2167,7 @@ export default class CanvasRenderer {
2148
2167
  $$,
2149
2168
  candlestickPoints,
2150
2169
  d,
2151
- i
2170
+ d.index
2152
2171
  );
2153
2172
  const isUp = value?._isUp;
2154
2173
 
@@ -2156,22 +2175,23 @@ export default class CanvasRenderer {
2156
2175
  continue;
2157
2176
  }
2158
2177
 
2159
- const {body} = geometry;
2178
+ const {wickEnd, wickStart} = geometry;
2179
+ const isInverted = $$.config[`axis_${$$.axis?.getId(d.id)}_inverted`];
2160
2180
 
2161
2181
  x = $$.config.axis_rotated ?
2162
- (isUp ? body.x + body.w + 4 : body.x - 4) :
2163
- body.x + body.w / 2;
2182
+ (isUp ? wickEnd[0] + 4 : wickStart[0] - 4) :
2183
+ wickStart[0];
2164
2184
  y = $$.config.axis_rotated ?
2165
- body.y + body.h / 2 :
2166
- (isUp ? body.y - 4 : body.y + body.h + 13);
2185
+ wickStart[1] + 3 :
2186
+ (isUp ? wickEnd[1] - 3 : wickStart[1] + 12);
2187
+ !$$.config.axis_rotated && isInverted &&
2188
+ (y += 15 * (isUp ? 1 : -1));
2167
2189
  ctx.textAlign = $$.config.axis_rotated ?
2168
2190
  (isUp ? "left" : "right") :
2169
2191
  "center";
2170
- ctx.textBaseline = $$.config.axis_rotated ?
2171
- "middle" :
2172
- (isUp ? "bottom" : "top");
2192
+ ctx.textBaseline = "alphabetic";
2173
2193
  } else if (cx && cy) {
2174
- ({x, y} = getShapePoint(shape.pos, d, i));
2194
+ ({x, y} = getShapePoint(shape.pos, d, d.index));
2175
2195
  ({x, y} = getPointLabelAnchor($$, ctx, d, x, y));
2176
2196
  }
2177
2197
 
@@ -2472,20 +2492,35 @@ export default class CanvasRenderer {
2472
2492
  const r = $$.pointExpandedR?.(d) ?? (baseR * 1.75);
2473
2493
  const overColor = getCanvasOverColor($$, d);
2474
2494
  const color = overColor || $$.color(d.id);
2495
+ const fill = overColor ||
2496
+ style.focusPoint.fill ||
2497
+ style.shape.pointFillColor ||
2498
+ color;
2499
+ const stroke = overColor || style.focusPoint.stroke || color;
2500
+ const lineWidth = style.focusPoint.lineWidth;
2501
+ const alpha = getPointOpacity($$, d);
2502
+ const hasStroke = !!stroke && (lineWidth ?? 0) > 0;
2503
+ const mergeSameColorStroke = pointType === "circle" &&
2504
+ hasStroke &&
2505
+ isNumber(alpha) &&
2506
+ alpha < 1 &&
2507
+ fill === stroke;
2475
2508
 
2476
2509
  if (!isFiniteCanvasCoordinate(x, y)) {
2477
2510
  return;
2478
2511
  }
2479
2512
 
2480
- drawPointPattern(painter, pointType, x, y, r, {
2481
- fill: overColor ||
2482
- style.focusPoint.fill ||
2483
- style.shape.pointFillColor ||
2484
- color,
2485
- lineWidth: style.focusPoint.lineWidth,
2486
- stroke: overColor || style.focusPoint.stroke || color,
2487
- alpha: getPointOpacity($$, d)
2488
- }, baseR);
2513
+ drawPointPattern(
2514
+ painter,
2515
+ pointType,
2516
+ x,
2517
+ y,
2518
+ mergeSameColorStroke ? r + (lineWidth || 0) / 2 : r,
2519
+ hasStroke && !mergeSameColorStroke ?
2520
+ {fill, lineWidth, stroke, alpha} :
2521
+ {fill, alpha},
2522
+ baseR
2523
+ );
2489
2524
  });
2490
2525
  }
2491
2526
 
@@ -6,19 +6,6 @@
6
6
  * y2 Axis config options
7
7
  */
8
8
  export default {
9
- /**
10
- * Set clip-path attribute for y2 axis element
11
- * - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
12
- * @name axis․y2․clipPath
13
- * @memberof Options
14
- * @type {boolean}
15
- * @default true
16
- * @example
17
- * // don't set 'clip-path' attribute
18
- * clipPath: false
19
- */
20
- axis_y2_clipPath: true,
21
-
22
9
  /**
23
10
  * Show or hide y2 axis.
24
11
  * - **NOTE**:
@@ -214,10 +214,10 @@ function decodeHTMLEntities(str: string): string {
214
214
  .replace(/&amp;/gi, "&")
215
215
  .replace(/&quot;/gi, "\"")
216
216
  .replace(/&apos;/gi, "'")
217
- // Numeric entities (decimal)
218
- .replace(/&#(\d+);/gi, (_, code) => String.fromCharCode(parseInt(code, 10)))
219
- // Numeric entities (hex)
220
- .replace(/&#x([0-9a-f]+);/gi, (_, code) => String.fromCharCode(parseInt(code, 16)));
217
+ // Numeric entities (decimal) - trailing semicolon is optional per HTML5 tokenizer
218
+ .replace(/&#(\d+);?/gi, (_, code) => String.fromCharCode(parseInt(code, 10)))
219
+ // Numeric entities (hex) - trailing semicolon is optional per HTML5 tokenizer
220
+ .replace(/&#x([0-9a-f]+);?/gi, (_, code) => String.fromCharCode(parseInt(code, 16)));
221
221
  }
222
222
 
223
223
  /**
@@ -239,24 +239,17 @@ function isSafeURI(uri: string): boolean {
239
239
  return true;
240
240
  }
241
241
 
242
- // Relative paths are safe
243
- if (
244
- normalized.startsWith("/") ||
245
- normalized.startsWith("./") ||
246
- normalized.startsWith("../") ||
247
- !normalized.includes(":")
248
- ) {
249
- return true;
250
- }
251
-
252
- // Check if protocol is in whitelist
253
- const colonIndex = normalized.indexOf(":");
254
- if (colonIndex > 0) {
255
- const protocol = normalized.substring(0, colonIndex + 1);
256
- return ALLOWED_URI_PROTOCOLS.has(protocol);
242
+ // A ':' appearing before the first '/', '?' or '#' denotes a URI scheme.
243
+ // Reject the value unless that scheme is whitelisted - do NOT infer safety
244
+ // merely from the absence of a literal colon (which could be reconstructed
245
+ // from an alternate encoding once assigned to innerHTML).
246
+ const schemeMatch = normalized.match(/^[^/?#]*:/);
247
+ if (schemeMatch) {
248
+ return ALLOWED_URI_PROTOCOLS.has(schemeMatch[0]);
257
249
  }
258
250
 
259
- return false;
251
+ // No scheme → relative path / query / fragment only → safe
252
+ return true;
260
253
  }
261
254
 
262
255
  /**
@@ -25,7 +25,7 @@ function _forEachValidItem<T>(items: T[], callback: (item: T, index: number) =>
25
25
  for (let i = 0; i < items.length; i++) {
26
26
  const item = items[i];
27
27
 
28
- if (item) {
28
+ if (item !== null && isDefined(item)) {
29
29
  callback(item, i);
30
30
  }
31
31
  }
@@ -224,7 +224,9 @@ function mergeObj(target: object, ...objectN): any {
224
224
  if (!/^(__proto__|constructor|prototype)$/i.test(key)) {
225
225
  const value = source[key];
226
226
 
227
- if (isObject(value)) {
227
+ if (value instanceof Date) {
228
+ target[key] = new Date(value.getTime());
229
+ } else if (isObject(value)) {
228
230
  !target[key] && (target[key] = {});
229
231
  target[key] = mergeObj(target[key], value);
230
232
  } else {
@@ -17,29 +17,35 @@ let messageId = 0;
17
17
  * @returns {{key: string, src: string}} Cache key and Object URL
18
18
  * @private
19
19
  */
20
- function getOrCreateWorkerResources(fn: Function, depsFn?: Function[]): {key: string, src: string} {
20
+ function getOrCreateWorkerResources(fn: Function, depsFn?: Function[]):
21
+ | {key: string, src: string}
22
+ | null {
21
23
  const fnString = fn.toString();
22
24
  // Include depsFn in cache key to handle different dependencies
23
25
  const depsString = depsFn?.map(String).join(";") ?? "";
24
26
  const key = (fnString + depsString).replace(/(function|[\s\W\n])/g, "").substring(0, 30);
25
27
 
26
28
  if (!(key in cache)) {
27
- // Create Blob and Object URL for Web Worker
28
- const blob = new window.Blob([
29
- `${depsString}
30
-
31
- self.onmessage=function({data}) {
32
- const result = (${fnString}).apply(null, data.args);
33
- self.postMessage({id: data.id, result});
34
- };`
35
- ], {
36
- type: "text/javascript"
37
- });
38
-
39
- cache[key] = {
40
- src: window.URL.createObjectURL(blob),
41
- worker: null
42
- };
29
+ try {
30
+ // Create Blob and Object URL for Web Worker
31
+ const blob = new window.Blob([
32
+ `${depsString}
33
+
34
+ self.onmessage=function({data}) {
35
+ const result = (${fnString}).apply(null, data.args);
36
+ self.postMessage({id: data.id, result});
37
+ };`
38
+ ], {
39
+ type: "text/javascript"
40
+ });
41
+
42
+ cache[key] = {
43
+ src: window.URL.createObjectURL(blob),
44
+ worker: null
45
+ };
46
+ } catch {
47
+ return null;
48
+ }
43
49
  }
44
50
 
45
51
  return {key, src: cache[key].src};
@@ -61,7 +67,11 @@ export function getWorker(key: string, src: string): Worker | null {
61
67
  }
62
68
 
63
69
  if (!cached.worker) {
64
- cached.worker = new window.Worker(src);
70
+ try {
71
+ cached.worker = new window.Worker(src);
72
+ } catch {
73
+ return null;
74
+ }
65
75
 
66
76
  // handle error
67
77
  if (cached.worker) {
@@ -111,11 +121,11 @@ export function runWorker(
111
121
  };
112
122
 
113
123
  if (window.Worker && useWorker) {
114
- const {key, src} = getOrCreateWorkerResources(fn, depsFn);
115
- const worker = getWorker(key, src);
124
+ const workerResources = getOrCreateWorkerResources(fn, depsFn);
125
+ const worker = workerResources && getWorker(workerResources.key, workerResources.src);
116
126
 
117
- runFn = function(...args: unknown[]) {
118
- if (worker) {
127
+ if (worker) {
128
+ runFn = function(...args: unknown[]) {
119
129
  // workers are cached and shared: match the response by id so concurrent
120
130
  // callers don't steal each other's result
121
131
  const id = ++messageId;
@@ -129,8 +139,8 @@ export function runWorker(
129
139
 
130
140
  worker.addEventListener("message", handler);
131
141
  worker.postMessage({id, args});
132
- }
133
- };
142
+ };
143
+ }
134
144
  }
135
145
 
136
146
  return runFn;
package/types/index.d.ts CHANGED
@@ -31,9 +31,6 @@ export {
31
31
  step,
32
32
  treemap,
33
33
 
34
- // render modules
35
- canvas,
36
-
37
34
  // interaction modules
38
35
  selection,
39
36
  subchart,
@@ -40,4 +40,9 @@ export interface TableViewOptions {
40
40
  * Set how null value to be shown.
41
41
  */
42
42
  nullString?: string;
43
+
44
+ /**
45
+ * Set number format function.
46
+ */
47
+ numberFormat?: (v: number) => string;
43
48
  }