billboard.js 3.6.0-next.1 → 3.6.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 (45) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +33 -10
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +1845 -1803
  6. package/dist/billboard.pkgd.min.js +3 -3
  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 +7 -3
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +7 -3
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +7 -3
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +7 -3
  16. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  17. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +1814 -1795
  18. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +1820 -1797
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +1821 -1798
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +1821 -1798
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +1821 -1798
  22. package/dist/theme/datalab.css +1 -1
  23. package/dist/theme/datalab.min.css +1 -1
  24. package/dist/theme/graph.css +1 -1
  25. package/dist/theme/graph.min.css +1 -1
  26. package/dist/theme/insight.css +1 -1
  27. package/dist/theme/insight.min.css +1 -1
  28. package/dist-esm/billboard.js +38 -13
  29. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  30. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +6 -2
  31. package/dist-esm/plugin/billboardjs-plugin-stanford.js +6 -2
  32. package/dist-esm/plugin/billboardjs-plugin-tableview.js +6 -2
  33. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +6 -2
  34. package/package.json +10 -10
  35. package/src/Chart/api/chart.ts +11 -3
  36. package/src/ChartInternal/ChartInternal.ts +3 -2
  37. package/src/ChartInternal/shape/bar.ts +2 -1
  38. package/src/ChartInternal/shape/candlestick.ts +4 -3
  39. package/src/ChartInternal/shape/shape.ts +22 -9
  40. package/src/config/Options/shape/bar.ts +6 -0
  41. package/src/config/Store/State.ts +1 -0
  42. package/src/config/config.ts +7 -1
  43. package/types/axis.d.ts +1 -1
  44. package/types/chart.d.ts +3 -1
  45. package/types/options.d.ts +5 -0
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.6.0-next.1
8
+ * @version 3.6.0-next.2
9
9
  */
10
10
  /*-- Chart --*/
11
11
  .bb svg {
package/dist/billboard.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.6.0-next.1
8
+ * @version 3.6.0-next.2
9
9
  */
10
10
  (function webpackUniversalModuleDefinition(root, factory) {
11
11
  if(typeof exports === 'object' && typeof module === 'object')
@@ -1771,6 +1771,8 @@ var State = function () {
1771
1771
  hasNegativeValue: !1,
1772
1772
  hasPositiveValue: !0,
1773
1773
  orgAreaOpacity: "0.2",
1774
+ orgConfig: {},
1775
+ // user original genration config
1774
1776
  // ID strings
1775
1777
  hiddenTargetIds: [],
1776
1778
  hiddenLegendIds: [],
@@ -8546,6 +8548,7 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
8546
8548
  config = $$.config,
8547
8549
  scale = $$.scale,
8548
8550
  currScale = isSub ? scale.subX : scale.zoom || scale.x,
8551
+ barOverlap = config.bar_overlap,
8549
8552
  barPadding = config.bar_padding,
8550
8553
  sum = function (p, c) {
8551
8554
  _newArrowCheck(this, _this5);
@@ -8566,11 +8569,12 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
8566
8569
  var xPos = currScale(d.x, !0);
8567
8570
 
8568
8571
  if (halfWidth) {
8569
- x = xPos - (offset[d.id] || offset._$width) + offset._$total.slice(0, index + 1).reduce(sum) - halfWidth;
8572
+ var offsetWidth = offset[d.id] || offset._$width;
8573
+ x = barOverlap ? xPos - offsetWidth / 2 : xPos - offsetWidth + offset._$total.slice(0, index + 1).reduce(sum) - halfWidth;
8570
8574
  } else {
8571
- x = xPos - (isNumber(offset) ? offset : offset._$width) * (targetsNum / 2 - index);
8575
+ x = xPos - (isNumber(offset) ? offset : offset._$width) * (targetsNum / 2 - (barOverlap ? 1 : index));
8572
8576
  }
8573
- } // adjust x position for bar.padding optionq
8577
+ } // adjust x position for bar.padding option
8574
8578
 
8575
8579
 
8576
8580
  if (offset && x && targetsNum > 1 && barPadding) {
@@ -11310,7 +11314,7 @@ var ChartInternal = /*#__PURE__*/function () {
11310
11314
  } // Define g for chart area
11311
11315
 
11312
11316
 
11313
- main.append("g").attr("class", $COMMON.chart).attr("clip-path", state.clip.path);
11317
+ main.append("g").classed($COMMON.chart, !0).attr("clip-path", hasAxis ? state.clip.path : null);
11314
11318
  $$.callPluginHook("$init");
11315
11319
 
11316
11320
  if (hasAxis) {
@@ -11716,7 +11720,11 @@ function loadConfig(config) {
11716
11720
  if (isDefined(read)) {
11717
11721
  thisConfig[key] = read;
11718
11722
  }
11719
- }.bind(this));
11723
+ }.bind(this)); // only should run in the ChartInternal context
11724
+
11725
+ if (this.api) {
11726
+ this.state.orgConfig = config;
11727
+ }
11720
11728
  }
11721
11729
  ;// CONCATENATED MODULE: ./src/Chart/api/chart.ts
11722
11730
 
@@ -11869,7 +11877,9 @@ function loadConfig(config) {
11869
11877
  },
11870
11878
 
11871
11879
  /**
11872
- * Get or set single config option value.
11880
+ * Get or set config option value.
11881
+ * - **NOTE:** for without parameter occasion
11882
+ * - will return all specified generation options object only. (will exclude any other options not specified at the initialization)
11873
11883
  * @function config
11874
11884
  * @instance
11875
11885
  * @memberof Chart
@@ -11879,9 +11889,13 @@ function loadConfig(config) {
11879
11889
  * - **NOTE:** Doesn't guarantee work in all circumstances. It can be applied for limited options only.
11880
11890
  * @returns {*}
11881
11891
  * @example
11892
+ *
11882
11893
  * // Getter
11883
11894
  * chart.config("gauge.max");
11884
11895
  *
11896
+ * // without any arguments, it returns generation config object
11897
+ * chart.config(); // {data: { ... }, axis: { ... }, ...}
11898
+ *
11885
11899
  * // Setter
11886
11900
  * chart.config("gauge.max", 100);
11887
11901
  *
@@ -11891,10 +11905,11 @@ function loadConfig(config) {
11891
11905
  config: function (name, value, redraw) {
11892
11906
  var $$ = this.internal,
11893
11907
  config = $$.config,
11908
+ state = $$.state,
11894
11909
  key = name == null ? void 0 : name.replace(/\./g, "_"),
11895
11910
  res;
11896
11911
 
11897
- if (key in config) {
11912
+ if (name && key in config) {
11898
11913
  if (isDefined(value)) {
11899
11914
  config[key] = value;
11900
11915
  res = value;
@@ -11902,6 +11917,8 @@ function loadConfig(config) {
11902
11917
  } else {
11903
11918
  res = config[key];
11904
11919
  }
11920
+ } else {
11921
+ res = state.orgConfig;
11905
11922
  }
11906
11923
 
11907
11924
  return res;
@@ -22917,6 +22934,7 @@ var cacheKey = KEY.radarPoints;
22917
22934
  * @property {object} bar Bar object
22918
22935
  * @property {number} [bar.indices.removeNull=false] Remove nullish data on bar indices positions.
22919
22936
  * @property {number} [bar.label.threshold=0] Set threshold ratio to show/hide labels.
22937
+ * @property {boolean} [bar.overlap=false] Bars will be rendered at same position, which will be overlapped each other. (for non-grouped bars only)
22920
22938
  * @property {number} [bar.padding=0] The padding pixel value between each bar.
22921
22939
  * @property {number} [bar.radius] Set the radius of bar edge in pixel.
22922
22940
  * @property {number} [bar.radius.ratio] Set the radius ratio of bar edge in relative the bar's width.
@@ -22932,6 +22950,7 @@ var cacheKey = KEY.radarPoints;
22932
22950
  * @property {number} [bar.width.dataname.max] The maximum width value for ratio.
22933
22951
  * @property {boolean} [bar.zerobased=true] Set if min or max value will be 0 on bar chart.
22934
22952
  * @see [Demo: bar indices](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarIndices)
22953
+ * @see [Demo: bar overlap](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarOverlap)
22935
22954
  * @see [Demo: bar padding](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarPadding)
22936
22955
  * @see [Demo: bar radius](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarRadius)
22937
22956
  * @see [Demo: bar width](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarWidth)
@@ -22943,6 +22962,9 @@ var cacheKey = KEY.radarPoints;
22943
22962
  * removeNull: true
22944
22963
  * },
22945
22964
  *
22965
+ * // remove nullish da
22966
+ * overlap: true,
22967
+ *
22946
22968
  * padding: 1,
22947
22969
  *
22948
22970
  * // bar radius
@@ -22983,6 +23005,7 @@ var cacheKey = KEY.radarPoints;
22983
23005
  */
22984
23006
  bar_label_threshold: 0,
22985
23007
  bar_indices_removeNull: !1,
23008
+ bar_overlap: !1,
22986
23009
  bar_padding: 0,
22987
23010
  bar_radius: undefined,
22988
23011
  bar_radius_ratio: undefined,
@@ -25965,7 +25988,7 @@ var _defaults = {},
25965
25988
  * bb.version; // "1.0.0"
25966
25989
  * @memberof bb
25967
25990
  */
25968
- version: "3.6.0-next.1",
25991
+ version: "3.6.0-next.2",
25969
25992
 
25970
25993
  /**
25971
25994
  * Generate chart
@@ -26100,7 +26123,7 @@ var _defaults = {},
26100
26123
  };
26101
26124
  /**
26102
26125
  * @namespace bb
26103
- * @version 3.6.0-next.1
26126
+ * @version 3.6.0-next.2
26104
26127
  */
26105
26128
  ;// CONCATENATED MODULE: ./src/index.ts
26106
26129
 
@@ -5,5 +5,5 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.6.0-next.1
8
+ * @version 3.6.0-next.2
9
9
  */.bb svg{-webkit-tap-highlight-color:rgba(0,0,0,0);font:10px sans-serif}.bb line,.bb path{fill:none;stroke:#000}.bb .bb-button,.bb text{-webkit-user-select:none;-moz-user-select:none;user-select:none}.bb-bars path,.bb-event-rect,.bb-legend-item-tile,.bb-xgrid-focus,.bb-ygrid,.bb-ygrid-focus{shape-rendering:crispEdges}.bb-chart-arc .bb-gauge-value{fill:#000}.bb-chart-arc path{stroke:#fff}.bb-chart-arc rect{stroke:#fff;stroke-width:1}.bb-chart-arc text{fill:#fff;font-size:13px}.bb-axis{shape-rendering:crispEdges}.bb-grid{pointer-events:none}.bb-grid line{stroke:#aaa}.bb-grid text{fill:#aaa}.bb-xgrid,.bb-ygrid{stroke-dasharray:3 3}.bb-text.bb-empty{fill:grey;font-size:2em}.bb-line{stroke-width:1px}.bb-circle._expanded_{stroke-width:1px;stroke:#fff}.bb-selected-circle{fill:#fff;stroke-width:2px}.bb-bar{stroke-width:0}.bb-bar._expanded_{fill-opacity:.75}.bb-candlestick{stroke-width:1px}.bb-candlestick._expanded_{fill-opacity:.75}.bb-circles.bb-focused,.bb-target.bb-focused{opacity:1}.bb-circles.bb-focused path.bb-line,.bb-circles.bb-focused path.bb-step,.bb-target.bb-focused path.bb-line,.bb-target.bb-focused path.bb-step{stroke-width:2px}.bb-circles.bb-defocused,.bb-target.bb-defocused{opacity:.3!important}.bb-circles.bb-defocused .text-overlapping,.bb-target.bb-defocused .text-overlapping{opacity:.05!important}.bb-region{fill:#4682b4}.bb-brush .extent,.bb-region,.bb-zoom-brush{fill-opacity:.1}.bb-legend-item{font-size:12px;user-select:none}.bb-legend-item-hidden{opacity:.15}.bb-legend-background{fill:#fff;stroke:#d3d3d3;stroke-width:1;opacity:.75}.bb-title{font:14px sans-serif}.bb-tooltip-container{user-select:none;z-index:10}.bb-tooltip{background-color:#fff;border-collapse:collapse;border-spacing:0;-webkit-box-shadow:7px 7px 12px -9px #777;-moz-box-shadow:7px 7px 12px -9px #777;box-shadow:7px 7px 12px -9px #777;empty-cells:show;opacity:.9}.bb-tooltip tr{border:1px solid #ccc}.bb-tooltip th{background-color:#aaa;color:#fff;font-size:14px;padding:2px 5px;text-align:left}.bb-tooltip td{background-color:#fff;border-left:1px dotted #999;font-size:13px;padding:3px 6px}.bb-tooltip td>span,.bb-tooltip td>svg{display:inline-block;height:10px;margin-right:6px;width:10px}.bb-tooltip.value{text-align:right}.bb-area{stroke-width:0;opacity:.2}.bb-chart-arcs-title{dominant-baseline:middle;font-size:1.3em}text.bb-chart-arcs-gauge-title{dominant-baseline:middle;font-size:2.7em}.bb-chart-arcs .bb-chart-arcs-background{fill:#e0e0e0;stroke:#fff}.bb-chart-arcs .bb-chart-arcs-gauge-unit{fill:#000;font-size:16px}.bb-chart-arcs .bb-chart-arcs-gauge-max,.bb-chart-arcs .bb-chart-arcs-gauge-min{fill:#777}.bb-chart-arcs .bb-levels circle{fill:none;stroke:#848282;stroke-width:.5px}.bb-chart-arcs .bb-levels text{fill:#848282}.bb-chart-radars .bb-levels polygon{fill:none;stroke:#848282;stroke-width:.5px}.bb-chart-radars .bb-levels text{fill:#848282}.bb-chart-radars .bb-axis line{stroke:#848282;stroke-width:.5px}.bb-chart-radars .bb-axis text{cursor:default;font-size:1.15em}.bb-chart-radars .bb-shapes polygon{fill-opacity:.2;stroke-width:1px}.bb-button{position:absolute;right:10px;top:10px}.bb-button .bb-zoom-reset{background-color:#fff;border:1px solid #ccc;border-radius:5px;cursor:pointer;font-size:11px;padding:5px}