diff --git a/dist-esm/billboard.js b/dist-esm/billboard.js index bf8f04735..5441b4f2b 100644 --- a/dist-esm/billboard.js +++ b/dist-esm/billboard.js @@ -5,7 +5,7 @@ * billboard.js, JavaScript chart library * https://naver.github.io/billboard.js/ * - * @version 3.9.2-nightly-20230805003715 + * @version 3.9.2-nightly-20230808003859 */ import { timeParse, utcParse, timeFormat, utcFormat } from 'd3-time-format'; import { pointer, select, namespaces, selectAll } from 'd3-selection'; @@ -1286,10 +1286,6 @@ var Store = /** @class */ (function () { return Store; }()); -/** - * Copyright (c) 2017 ~ present NAVER Corp. - * billboard.js project is licensed under the MIT license - */ /** * main config options */ @@ -1664,13 +1660,21 @@ var main = { * @memberof Options * @type {Array} * @default [] + * @see [Demo](https://naver.github.io/billboard.js/demo/#Region.RegionLabel) * @example * regions: [ * { * axis: "x", * start: 1, * end: 4, - * class: "region-1-4" + * class: "region-1-4", + * label: { + * text: "Region Text", + * x: 5, // position relative of the initial x coordinate + * y: 5, // position relative of the initial y coordinate + * color: "red", // color string + * rotated: true // make text to show in vertical or horizontal + * } * } * ] */ @@ -14655,7 +14659,8 @@ var region = { $T(regions.exit()) .style("opacity", "0") .remove(); - var regionsEnter = regions.enter() + var regionsEnter = regions + .enter() .append("g"); regionsEnter .append("rect") @@ -14663,16 +14668,35 @@ var region = { region.list = regionsEnter .merge(regions) .attr("class", $$.classRegion.bind($$)); + region.list.each(function (d) { + var _a; + var g = select(this); + if (g.select("text").size() === 0 && ((_a = d.label) === null || _a === void 0 ? void 0 : _a.text)) { + select(this).append("text") + .style("opacity", "0"); + } + }); }, redrawRegion: function (withTransition) { var $$ = this; var region = $$.$el.region, $T = $$.$T; var regions = region.list.select("rect"); + var label = region.list.selectAll("text"); regions = $T(regions, withTransition) .attr("x", $$.regionX.bind($$)) .attr("y", $$.regionY.bind($$)) .attr("width", $$.regionWidth.bind($$)) .attr("height", $$.regionHeight.bind($$)); + label = $T(label, withTransition) + .attr("transform", function (d) { + var _a; + var _b = (_a = d.label) !== null && _a !== void 0 ? _a : {}, _c = _b.x, x = _c === void 0 ? 0 : _c, _d = _b.y, y = _d === void 0 ? 0 : _d, _e = _b.rotated, rotated = _e === void 0 ? false : _e; + return "translate(".concat($$.regionX.bind($$)(d) + x, ", ").concat($$.regionY.bind($$)(d) + y, ")").concat(rotated ? " rotate(-90)" : ""); + }) + .attr("text-anchor", function (d) { var _a; return (((_a = d.label) === null || _a === void 0 ? void 0 : _a.rotated) ? "end" : null); }) + .attr("dy", "1em") + .style("fill", function (d) { var _a, _b; return (_b = (_a = d.label) === null || _a === void 0 ? void 0 : _a.color) !== null && _b !== void 0 ? _b : null; }) + .text(function (d) { var _a; return (_a = d.label) === null || _a === void 0 ? void 0 : _a.text; }); return [ regions .style("fill-opacity", function (d) { return (isValue(d.opacity) ? d.opacity : null); }) @@ -14681,7 +14705,8 @@ var region = { select(this.parentNode) .selectAll("rect:not([x])") .remove(); - }) + }), + label.style("opacity", null) ]; }, getRegionXY: function (type, d) { @@ -14885,10 +14910,6 @@ var sizeAxis = { } }; -/** - * Copyright (c) 2017 ~ present NAVER Corp. - * billboard.js project is licensed under the MIT license - */ /** * Axis based chart data config options */ @@ -22741,7 +22762,7 @@ var zoomModule = function () { var defaults = {}; /** * @namespace bb - * @version 3.9.2-nightly-20230805003715 + * @version 3.9.2-nightly-20230808003859 */ var bb = { /** @@ -22751,7 +22772,7 @@ var bb = { * bb.version; // "1.0.0" * @memberof bb */ - version: "3.9.2-nightly-20230805003715", + version: "3.9.2-nightly-20230808003859", /** * Generate chart * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when: diff --git a/dist-esm/plugin/billboardjs-plugin-bubblecompare.js b/dist-esm/plugin/billboardjs-plugin-bubblecompare.js index 272f543b0..fea209da9 100644 --- a/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +++ b/dist-esm/plugin/billboardjs-plugin-bubblecompare.js @@ -5,7 +5,7 @@ * billboard.js, JavaScript chart library * https://naver.github.io/billboard.js/ * - * @version 3.9.2-nightly-20230805003715 + * @version 3.9.2-nightly-20230808003859 * @requires billboard.js * @summary billboard.js plugin */ @@ -104,7 +104,7 @@ var Plugin = /** @class */ (function () { delete _this[key]; }); }; - Plugin.version = "3.9.2-nightly-20230805003715"; + Plugin.version = "3.9.2-nightly-20230808003859"; return Plugin; }()); var Plugin$1 = Plugin; diff --git a/dist-esm/plugin/billboardjs-plugin-sparkline.js b/dist-esm/plugin/billboardjs-plugin-sparkline.js index aa7cf4684..bae0f86f3 100644 --- a/dist-esm/plugin/billboardjs-plugin-sparkline.js +++ b/dist-esm/plugin/billboardjs-plugin-sparkline.js @@ -5,7 +5,7 @@ * billboard.js, JavaScript chart library * https://naver.github.io/billboard.js/ * - * @version 3.9.2-nightly-20230805003715 + * @version 3.9.2-nightly-20230808003859 * @requires billboard.js * @summary billboard.js plugin */ @@ -279,7 +279,7 @@ var Plugin = /** @class */ (function () { delete _this[key]; }); }; - Plugin.version = "3.9.2-nightly-20230805003715"; + Plugin.version = "3.9.2-nightly-20230808003859"; return Plugin; }()); var Plugin$1 = Plugin; diff --git a/dist-esm/plugin/billboardjs-plugin-stanford.js b/dist-esm/plugin/billboardjs-plugin-stanford.js index 238ca6b86..f9c58c0e2 100644 --- a/dist-esm/plugin/billboardjs-plugin-stanford.js +++ b/dist-esm/plugin/billboardjs-plugin-stanford.js @@ -5,7 +5,7 @@ * billboard.js, JavaScript chart library * https://naver.github.io/billboard.js/ * - * @version 3.9.2-nightly-20230805003715 + * @version 3.9.2-nightly-20230808003859 * @requires billboard.js * @summary billboard.js plugin */ @@ -487,7 +487,7 @@ var Plugin = /** @class */ (function () { delete _this[key]; }); }; - Plugin.version = "3.9.2-nightly-20230805003715"; + Plugin.version = "3.9.2-nightly-20230808003859"; return Plugin; }()); var Plugin$1 = Plugin; diff --git a/dist-esm/plugin/billboardjs-plugin-tableview.js b/dist-esm/plugin/billboardjs-plugin-tableview.js index 372136886..4bf935a3b 100644 --- a/dist-esm/plugin/billboardjs-plugin-tableview.js +++ b/dist-esm/plugin/billboardjs-plugin-tableview.js @@ -5,7 +5,7 @@ * billboard.js, JavaScript chart library * https://naver.github.io/billboard.js/ * - * @version 3.9.2-nightly-20230805003715 + * @version 3.9.2-nightly-20230808003859 * @requires billboard.js * @summary billboard.js plugin */ @@ -121,7 +121,7 @@ var Plugin = /** @class */ (function () { delete _this[key]; }); }; - Plugin.version = "3.9.2-nightly-20230805003715"; + Plugin.version = "3.9.2-nightly-20230808003859"; return Plugin; }()); var Plugin$1 = Plugin; diff --git a/dist-esm/plugin/billboardjs-plugin-textoverlap.js b/dist-esm/plugin/billboardjs-plugin-textoverlap.js index 1ec805058..efe8ec418 100644 --- a/dist-esm/plugin/billboardjs-plugin-textoverlap.js +++ b/dist-esm/plugin/billboardjs-plugin-textoverlap.js @@ -5,7 +5,7 @@ * billboard.js, JavaScript chart library * https://naver.github.io/billboard.js/ * - * @version 3.9.2-nightly-20230805003715 + * @version 3.9.2-nightly-20230808003859 * @requires billboard.js * @summary billboard.js plugin */ @@ -263,7 +263,7 @@ var Plugin = /** @class */ (function () { delete _this[key]; }); }; - Plugin.version = "3.9.2-nightly-20230805003715"; + Plugin.version = "3.9.2-nightly-20230808003859"; return Plugin; }()); var Plugin$1 = Plugin; diff --git a/dist/billboard.css b/dist/billboard.css index f03372c74..bb3eea3e6 100644 --- a/dist/billboard.css +++ b/dist/billboard.css @@ -5,7 +5,7 @@ * billboard.js, JavaScript chart library * https://naver.github.io/billboard.js/ * - * @version 3.9.2-nightly-20230805003715 + * @version 3.9.2-nightly-20230808003859 */ /*-- Chart --*/ .bb svg { @@ -102,7 +102,7 @@ opacity: .05 !important; } /*-- Region --*/ -.bb-region { +.bb-region rect { fill: steelblue; fill-opacity: .1; } diff --git a/dist/billboard.js b/dist/billboard.js index ee0f70b43..77cbbe9c7 100644 --- a/dist/billboard.js +++ b/dist/billboard.js @@ -5,7 +5,7 @@ * billboard.js, JavaScript chart library * https://naver.github.io/billboard.js/ * - * @version 3.9.2-nightly-20230805003715 + * @version 3.9.2-nightly-20230808003859 */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') @@ -1737,6 +1737,7 @@ var Store = /*#__PURE__*/function () { * Copyright (c) 2017 ~ present NAVER Corp. * billboard.js project is licensed under the MIT license */ + /** * main config options */ @@ -2111,13 +2112,21 @@ var Store = /*#__PURE__*/function () { * @memberof Options * @type {Array} * @default [] + * @see [Demo](https://naver.github.io/billboard.js/demo/#Region.RegionLabel) * @example * regions: [ * { * axis: "x", * start: 1, * end: 4, - * class: "region-1-4" + * class: "region-1-4", + * label: { + * text: "Region Text", + * x: 5, // position relative of the initial x coordinate + * y: 5, // position relative of the initial y coordinate + * color: "red", // color string + * rotated: true // make text to show in vertical or horizontal + * } * } * ] */ @@ -9589,75 +9598,76 @@ function title_getTextPos(pos, width) { len = d.length; var text, row, param, value, i; var _loop = function () { - var _this3 = this; - row = d[i]; - if (!row || !(getRowValue(row) || getRowValue(row) === 0)) { - return "continue"; - } - if (isUndefined(text)) { - var title = (state.hasAxis || state.hasRadar) && sanitise(titleFormat ? titleFormat(row.x) : row.x); - text = tplProcess(tpl[0], { - CLASS_TOOLTIP: $TOOLTIP.tooltip, - TITLE: isValue(title) ? tplStr ? title : "
'+(this.patterns?"{=COLOR}":'')+'{=NAME} | \n\t\t\t\t\t{=VALUE} | \n\t\t\t\t
'+(this.patterns?"{=COLOR}":'')+'{=NAME} | \n\t\t\t\t\t{=VALUE} | \n\t\t\t\t
'+(this.patterns?"{=COLOR}":'')+'{=NAME} | \n\t\t\t\t\t{=VALUE} | \n\t\t\t\t