billboard.js 3.9.0-next.2 → 3.9.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 (39) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +59 -18
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +59 -18
  6. package/dist/billboard.pkgd.min.js +2 -2
  7. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-sparkline.js +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.js +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +2 -2
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +2 -2
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +2 -2
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +2 -2
  22. package/dist/theme/dark.css +1 -1
  23. package/dist/theme/dark.min.css +1 -1
  24. package/dist/theme/datalab.css +1 -1
  25. package/dist/theme/datalab.min.css +1 -1
  26. package/dist/theme/graph.css +1 -1
  27. package/dist/theme/graph.min.css +1 -1
  28. package/dist/theme/insight.css +1 -1
  29. package/dist/theme/insight.min.css +1 -1
  30. package/dist-esm/billboard.js +89 -42
  31. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +3 -3
  32. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +3 -3
  33. package/dist-esm/plugin/billboardjs-plugin-stanford.js +3 -3
  34. package/dist-esm/plugin/billboardjs-plugin-tableview.js +3 -3
  35. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +3 -3
  36. package/package.json +1 -1
  37. package/src/ChartInternal/internals/legend.ts +50 -34
  38. package/src/config/Options/common/legend.ts +37 -6
  39. package/types/options.d.ts +25 -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.9.0-next.2
8
+ * @version 3.9.0
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.9.0-next.2
8
+ * @version 3.9.0
9
9
  */
10
10
  (function webpackUniversalModuleDefinition(root, factory) {
11
11
  if(typeof exports === 'object' && typeof module === 'object')
@@ -3190,17 +3190,34 @@ var data_this = undefined;
3190
3190
  * - defines the max step the legend has (e.g. If 2 set and legend has 3 legend item, the legend 2 columns).
3191
3191
  * @property {boolean} [legend.equally=false] Set to all items have same width size.
3192
3192
  * @property {number} [legend.padding=0] Set padding value
3193
+ * @property {boolean} [legend.item.interaction=true] Set legend item interaction.
3194
+ * - **NOTE:**
3195
+ * - This setting will not have effect on `.toggle()` method.
3196
+ * - `legend.item.onXXX` listener options will work if set, regardless of this option value.
3197
+ * @property {boolean} [legend.item.interaction.dblclick=false] Set legend item to interact on double click.
3198
+ * - **NOTE:**
3199
+ * - Double clicking will make focused clicked dataseries only, hiding all others.
3200
+ * - for single click case, `click + altKey(Win)/optionKey(Mac OS)` to have same effect.
3201
+ * - To return initial state(which all dataseries are showing), double click current focused legend item again.
3202
+ * - for single click case, `click + altKey(Win)/optionKey(Mac OS)` to have same effect.
3203
+ * - In this case, default `click` interaction will be disabled.
3193
3204
  * @property {Function} [legend.item.onclick=undefined] Set click event handler to the legend item.
3205
+ * - **NOTE:**
3206
+ * - When set, default `click` interaction will be disabled.
3207
+ * - When `interaction.dblclick=true` is set, will be called on double click.
3194
3208
  * @property {Function} [legend.item.onover=undefined] Set mouse/touch over event handler to the legend item.
3209
+ * - **NOTE:** When set, default `mouseover` interaction will be disabled.
3195
3210
  * @property {Function} [legend.item.onout=undefined] Set mouse/touch out event handler to the legend item.
3211
+ * - **NOTE:** When set, default `mouseout` interaction will be disabled.
3196
3212
  * @property {number} [legend.item.tile.width=10] Set width for 'rectangle' legend item tile element.
3197
- * @property {number} [legend.item.tile.height=10] ㄹ
3213
+ * @property {number} [legend.item.tile.height=10] Set height for 'rectangle' legend item tile element.
3198
3214
  * @property {number} [legend.item.tile.r=5] Set the radius for 'circle' legend item tile type.
3199
3215
  * @property {string} [legend.item.tile.type="rectangle"] Set legend item shape type.<br>
3200
3216
  * - **Available Values:**
3201
3217
  * - circle
3202
3218
  * - rectangle
3203
3219
  * @property {boolean} [legend.usePoint=false] Whether to use custom points in legend.
3220
+ * @see [Demo: item.interaction](https://naver.github.io/billboard.js/demo/#Legend.LegendItemInteraction)
3204
3221
  * @see [Demo: item.tile.type](https://naver.github.io/billboard.js/demo/#Legend.LegendItemTileType)
3205
3222
  * @see [Demo: position](https://naver.github.io/billboard.js/demo/#Legend.LegendPosition)
3206
3223
  * @see [Demo: contents.template](https://naver.github.io/billboard.js/demo/#Legend.LegendTemplate1)
@@ -3235,6 +3252,16 @@ var data_this = undefined;
3235
3252
  * equally: false,
3236
3253
  * padding: 10,
3237
3254
  * item: {
3255
+ * // will disable default interaction
3256
+ * interaction: false,
3257
+ *
3258
+ * // set legend interact on double click
3259
+ * // by double clicking, will make focused clicked dataseries only, hiding all others.
3260
+ * interaction: {
3261
+ * dblclick: true
3262
+ * }
3263
+ *
3264
+ * // when set below callback, will disable corresponding default interactions
3238
3265
  * onclick: function(id) { ... },
3239
3266
  * onover: function(id) { ... },
3240
3267
  * onout: function(id) { ... },
@@ -3255,24 +3282,26 @@ var data_this = undefined;
3255
3282
  * usePoint: true
3256
3283
  * }
3257
3284
  */
3258
- legend_show: !0,
3259
- legend_hide: !1,
3260
3285
  legend_contents_bindto: undefined,
3261
3286
  legend_contents_template: "<span style='color:#fff;padding:5px;background-color:{=COLOR}'>{=TITLE}</span>",
3262
- legend_position: "bottom",
3287
+ legend_equally: !1,
3288
+ legend_hide: !1,
3263
3289
  legend_inset_anchor: "top-left",
3264
3290
  legend_inset_x: 10,
3265
3291
  legend_inset_y: 0,
3266
3292
  legend_inset_step: undefined,
3293
+ legend_item_interaction: !0,
3294
+ legend_item_dblclick: !1,
3267
3295
  legend_item_onclick: undefined,
3268
3296
  legend_item_onover: undefined,
3269
3297
  legend_item_onout: undefined,
3270
- legend_equally: !1,
3271
- legend_padding: 0,
3272
3298
  legend_item_tile_width: 10,
3273
3299
  legend_item_tile_height: 10,
3274
3300
  legend_item_tile_r: 5,
3275
3301
  legend_item_tile_type: "rectangle",
3302
+ legend_padding: 0,
3303
+ legend_position: "bottom",
3304
+ legend_show: !0,
3276
3305
  legend_usePoint: !1
3277
3306
  });
3278
3307
  ;// CONCATENATED MODULE: ./src/config/Options/common/title.ts
@@ -7028,7 +7057,8 @@ function getLegendColor(id) {
7028
7057
  state = $$.state,
7029
7058
  isTouch = state.inputType === "touch",
7030
7059
  hasGauge = $$.hasType("gauge"),
7031
- useCssRule = config.boost_useCssRule;
7060
+ useCssRule = config.boost_useCssRule,
7061
+ interaction = config.legend_item_interaction;
7032
7062
  item.attr("class", function (id) {
7033
7063
  var node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
7034
7064
  itemClass = !node.empty() && node.attr("class") || "";
@@ -7046,19 +7076,27 @@ function getLegendColor(id) {
7046
7076
  $$.setCssRule(!1, selector, [props])($el.legend);
7047
7077
  }.bind(this));
7048
7078
  }
7049
- item.style("cursor", $$.getStylePropValue("pointer")).on("click", function (event, id) {
7079
+ item.on(interaction.dblclick ? "dblclick" : "click", interaction || isFunction(config.legend_item_onclick) ? function (event, id) {
7050
7080
  if (!callFn(config.legend_item_onclick, api, id)) {
7051
- if (event.altKey) {
7052
- api.hide();
7053
- api.show(id);
7081
+ var altKey = event.altKey,
7082
+ target = event.target,
7083
+ type = event.type;
7084
+ if (type === "dblclick" || altKey) {
7085
+ // when focused legend is clicked(with altKey or double clicked), reset all hiding.
7086
+ if (state.hiddenTargetIds.length && target.parentNode.getAttribute("class").indexOf($LEGEND.legendItemHidden) === -1) {
7087
+ api.show();
7088
+ } else {
7089
+ api.hide();
7090
+ api.show(id);
7091
+ }
7054
7092
  } else {
7055
7093
  api.toggle(id);
7056
7094
  (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed($FOCUS.legendItemFocused, !1);
7057
7095
  }
7058
7096
  }
7059
7097
  isTouch && $$.hideTooltip();
7060
- });
7061
- isTouch || item.on("mouseout", function (event, id) {
7098
+ } : null);
7099
+ isTouch || item.on("mouseout", interaction || isFunction(config.legend_item_onout) ? function (event, id) {
7062
7100
  if (!callFn(config.legend_item_onout, api, id)) {
7063
7101
  (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed($FOCUS.legendItemFocused, !1);
7064
7102
  if (hasGauge) {
@@ -7066,7 +7104,7 @@ function getLegendColor(id) {
7066
7104
  }
7067
7105
  $$.api.revert();
7068
7106
  }
7069
- }).on("mouseover", function (event, id) {
7107
+ } : null).on("mouseover", interaction || isFunction(config.legend_item_onover) ? function (event, id) {
7070
7108
  if (!callFn(config.legend_item_onover, api, id)) {
7071
7109
  (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).classed($FOCUS.legendItemFocused, !0);
7072
7110
  if (hasGauge) {
@@ -7076,7 +7114,10 @@ function getLegendColor(id) {
7076
7114
  api.focus(id);
7077
7115
  }
7078
7116
  }
7079
- });
7117
+ } : null);
7118
+
7119
+ // set cursor when has some interaction
7120
+ !item.empty() && item.on("click mouseout mouseover") && item.style("cursor", $$.getStylePropValue("pointer"));
7080
7121
  }
7081
7122
  },
7082
7123
  /**
@@ -25043,7 +25084,7 @@ var _defaults = {};
25043
25084
 
25044
25085
  /**
25045
25086
  * @namespace bb
25046
- * @version 3.9.0-next.2
25087
+ * @version 3.9.0
25047
25088
  */
25048
25089
  var bb = {
25049
25090
  /**
@@ -25053,7 +25094,7 @@ var bb = {
25053
25094
  * bb.version; // "1.0.0"
25054
25095
  * @memberof bb
25055
25096
  */
25056
- version: "3.9.0-next.2",
25097
+ version: "3.9.0",
25057
25098
  /**
25058
25099
  * Generate chart
25059
25100
  * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
@@ -5,5 +5,5 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.9.0-next.2
8
+ * @version 3.9.0
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-legend-item-tile,.bb-xgrid-focus,.bb-ygrid,.bb-ygrid-focus{shape-rendering:crispEdges}.bb-chart-arc .bb-gauge-value,.bb-chart-arcs .bb-needle{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-chart-treemaps rect{stroke:#fff;stroke-width:1px}.bb-tooltip-container{user-select:none;z-index:10}.bb-tooltip{background-color:#fff;border-collapse:collapse;border-spacing:0;box-shadow:7px 7px 12px -9px #777;empty-cells:show;opacity:.9;white-space:nowrap}.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}