billboard.js 3.6.0-next.2 → 3.6.1
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.
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +4808 -7179
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +8271 -11777
- package/dist/billboard.pkgd.min.js +2 -3
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +27 -62
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +303 -528
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +368 -648
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +305 -513
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +306 -500
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +2169 -2362
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +2940 -3599
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +3194 -4110
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +2943 -3585
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +3084 -3931
- package/dist/theme/datalab.css +1 -1
- package/dist/theme/datalab.min.css +1 -1
- package/dist/theme/graph.css +1 -1
- package/dist/theme/graph.min.css +1 -1
- package/dist/theme/insight.css +1 -1
- package/dist/theme/insight.min.css +1 -1
- package/dist-esm/billboard.js +369 -192
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +3 -8
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +3 -12
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +3 -12
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +3 -12
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +3 -8
- package/package.json +23 -23
- package/src/ChartInternal/data/IData.ts +8 -2
- package/src/ChartInternal/interactions/interaction.ts +39 -26
- package/src/ChartInternal/internals/color.ts +50 -0
- package/src/ChartInternal/internals/legend.ts +246 -145
- package/src/ChartInternal/shape/area.ts +9 -38
- package/src/ChartInternal/shape/bar.ts +20 -3
- package/src/config/Options/common/legend.ts +18 -3
- package/src/config/Options/shape/bar.ts +32 -0
- package/types/options.d.ts +30 -4
package/dist-esm/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.
|
|
8
|
+
* @version 3.6.1
|
|
9
9
|
*/
|
|
10
10
|
import { timeParse, utcParse, timeFormat, utcFormat } from 'd3-time-format';
|
|
11
11
|
import { pointer, select, namespaces, selectAll } from 'd3-selection';
|
|
@@ -145,20 +145,16 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
145
145
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
146
146
|
PERFORMANCE OF THIS SOFTWARE.
|
|
147
147
|
***************************************************************************** */
|
|
148
|
-
|
|
149
148
|
var _assign = function __assign() {
|
|
150
149
|
_assign = Object.assign || function (t) {
|
|
151
150
|
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
152
151
|
s = arguments[i];
|
|
153
|
-
|
|
154
152
|
for (var p in s) {
|
|
155
153
|
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
156
154
|
}
|
|
157
155
|
}
|
|
158
|
-
|
|
159
156
|
return t;
|
|
160
157
|
};
|
|
161
|
-
|
|
162
158
|
return _assign.apply(this, arguments);
|
|
163
159
|
};
|
|
164
160
|
function __spreadArray(to, from, pack) {
|
|
@@ -2672,9 +2668,15 @@ var legend$2 = {
|
|
|
2672
2668
|
* @property {Function} [legend.item.onclick=undefined] Set click event handler to the legend item.
|
|
2673
2669
|
* @property {Function} [legend.item.onover=undefined] Set mouse/touch over event handler to the legend item.
|
|
2674
2670
|
* @property {Function} [legend.item.onout=undefined] Set mouse/touch out event handler to the legend item.
|
|
2675
|
-
* @property {number} [legend.item.tile.width=10] Set width
|
|
2676
|
-
* @property {number} [legend.item.tile.height=10]
|
|
2671
|
+
* @property {number} [legend.item.tile.width=10] Set width for 'rectangle' legend item tile element.
|
|
2672
|
+
* @property {number} [legend.item.tile.height=10] ㄹ
|
|
2673
|
+
* @property {number} [legend.item.tile.r=5] Set the radius for 'circle' legend item tile type.
|
|
2674
|
+
* @property {string} [legend.item.tile.type="rectangle"] Set legend item shape type.<br>
|
|
2675
|
+
* - **Available Values:**
|
|
2676
|
+
* - circle
|
|
2677
|
+
* - rectangle
|
|
2677
2678
|
* @property {boolean} [legend.usePoint=false] Whether to use custom points in legend.
|
|
2679
|
+
* @see [Demo: item.tile.type](https://naver.github.io/billboard.js/demo/#Legend.LegendItemTileType)
|
|
2678
2680
|
* @see [Demo: position](https://naver.github.io/billboard.js/demo/#Legend.LegendPosition)
|
|
2679
2681
|
* @see [Demo: contents.template](https://naver.github.io/billboard.js/demo/#Legend.LegendTemplate1)
|
|
2680
2682
|
* @see [Demo: usePoint](https://naver.github.io/billboard.js/demo/#Legend.usePoint)
|
|
@@ -2714,8 +2716,15 @@ var legend$2 = {
|
|
|
2714
2716
|
*
|
|
2715
2717
|
* // set tile's size
|
|
2716
2718
|
* tile: {
|
|
2717
|
-
*
|
|
2719
|
+
* // set tile type
|
|
2720
|
+
* type: "circle" // or "rectangle" (default)
|
|
2721
|
+
*
|
|
2722
|
+
* // width & height, are only applicable for 'rectangle' legend type
|
|
2723
|
+
* width: 15,
|
|
2718
2724
|
* height: 15
|
|
2725
|
+
*
|
|
2726
|
+
* // radis is only applicable for 'circle' legend type
|
|
2727
|
+
* r: 10
|
|
2719
2728
|
* }
|
|
2720
2729
|
* },
|
|
2721
2730
|
* usePoint: true
|
|
@@ -2737,6 +2746,8 @@ var legend$2 = {
|
|
|
2737
2746
|
legend_padding: 0,
|
|
2738
2747
|
legend_item_tile_width: 10,
|
|
2739
2748
|
legend_item_tile_height: 10,
|
|
2749
|
+
legend_item_tile_r: 5,
|
|
2750
|
+
legend_item_tile_type: "rectangle",
|
|
2740
2751
|
legend_usePoint: false
|
|
2741
2752
|
};
|
|
2742
2753
|
|
|
@@ -4572,7 +4583,7 @@ var dataLoad = {
|
|
|
4572
4583
|
*/
|
|
4573
4584
|
var interaction = {
|
|
4574
4585
|
selectRectForSingle: function (context, eventRect, index) {
|
|
4575
|
-
var _a;
|
|
4586
|
+
var _a, _b;
|
|
4576
4587
|
var $$ = this;
|
|
4577
4588
|
var config = $$.config, main = $$.$el.main;
|
|
4578
4589
|
var isSelectionEnabled = config.data_selection_enabled;
|
|
@@ -4587,22 +4598,22 @@ var interaction = {
|
|
|
4587
4598
|
return;
|
|
4588
4599
|
}
|
|
4589
4600
|
}
|
|
4590
|
-
main.selectAll(".".concat($SHAPE.shape, "-").concat(index))
|
|
4601
|
+
var shapeAtIndex = main.selectAll(".".concat($SHAPE.shape, "-").concat(index))
|
|
4591
4602
|
.each(function () {
|
|
4592
|
-
var _a;
|
|
4593
4603
|
select(this).classed($COMMON.EXPANDED, true);
|
|
4594
4604
|
if (isSelectionEnabled) {
|
|
4595
4605
|
eventRect.style("cursor", isSelectionGrouped ? "pointer" : null);
|
|
4596
4606
|
}
|
|
4597
|
-
if (!isTooltipGrouped) {
|
|
4598
|
-
(_a = $$.hideGridFocus) === null || _a === void 0 ? void 0 : _a.call($$);
|
|
4599
|
-
$$.hideTooltip();
|
|
4600
|
-
!isSelectionGrouped && $$.setExpand(index);
|
|
4601
|
-
}
|
|
4602
4607
|
})
|
|
4603
4608
|
.filter(function (d) {
|
|
4604
4609
|
return $$.isWithinShape(this, d);
|
|
4605
|
-
})
|
|
4610
|
+
});
|
|
4611
|
+
if (shapeAtIndex.empty() && !isTooltipGrouped) {
|
|
4612
|
+
(_b = $$.hideGridFocus) === null || _b === void 0 ? void 0 : _b.call($$);
|
|
4613
|
+
$$.hideTooltip();
|
|
4614
|
+
!isSelectionGrouped && $$.setExpand(index);
|
|
4615
|
+
}
|
|
4616
|
+
shapeAtIndex
|
|
4606
4617
|
.call(function (selected) {
|
|
4607
4618
|
var _a, _b;
|
|
4608
4619
|
var d = selected.data();
|
|
@@ -4665,28 +4676,35 @@ var interaction = {
|
|
|
4665
4676
|
if (isArc || d !== -1) {
|
|
4666
4677
|
var callback_1 = config[isOver ? "data_onover" : "data_onout"].bind($$.api);
|
|
4667
4678
|
config.color_onover && $$.setOverColor(isOver, d, isArc);
|
|
4668
|
-
if (isArc) {
|
|
4679
|
+
if (isArc && "id") {
|
|
4669
4680
|
callback_1(d, main.select(".".concat($ARC.arc).concat($$.getTargetSelectorSuffix(d.id))).node());
|
|
4670
4681
|
}
|
|
4671
4682
|
else if (!config.tooltip_grouped) {
|
|
4672
4683
|
var last_1 = $$.cache.get(KEY.setOverOut) || [];
|
|
4673
|
-
|
|
4684
|
+
// select based on the index
|
|
4685
|
+
var shapesAtIndex = main.selectAll(".".concat($SHAPE.shape, "-").concat(d))
|
|
4674
4686
|
.filter(function (d) {
|
|
4675
4687
|
return $$.isWithinShape(this, d);
|
|
4676
4688
|
});
|
|
4677
|
-
|
|
4678
|
-
|
|
4689
|
+
// filter if has new selection
|
|
4690
|
+
var shape = shapesAtIndex.filter(function () {
|
|
4679
4691
|
var _this = this;
|
|
4680
|
-
|
|
4681
|
-
|
|
4692
|
+
return last_1.every(function (v) { return v !== _this; });
|
|
4693
|
+
});
|
|
4694
|
+
// call onout callback
|
|
4695
|
+
if (!isOver || shapesAtIndex.empty() || (last_1.length === shape.size() && shape.nodes().every((function (v, i) { return v !== last_1[i]; })))) {
|
|
4696
|
+
while (last_1.length) {
|
|
4697
|
+
var target = last_1.pop();
|
|
4698
|
+
config.data_onout.bind($$.api)(select(target).datum(), target);
|
|
4699
|
+
}
|
|
4700
|
+
}
|
|
4701
|
+
// call onover callback
|
|
4702
|
+
shape.each(function () {
|
|
4703
|
+
if (isOver) {
|
|
4704
|
+
callback_1(select(this).datum(), this);
|
|
4682
4705
|
last_1.push(this);
|
|
4683
4706
|
}
|
|
4684
4707
|
});
|
|
4685
|
-
if (last_1.length > 0 && shape.empty()) {
|
|
4686
|
-
callback_1 = config.data_onout.bind($$.api);
|
|
4687
|
-
last_1.forEach(function (v) { return callback_1(select(v).datum(), v); });
|
|
4688
|
-
last_1 = [];
|
|
4689
|
-
}
|
|
4690
4708
|
$$.cache.add(KEY.setOverOut, last_1);
|
|
4691
4709
|
}
|
|
4692
4710
|
else {
|
|
@@ -5082,6 +5100,45 @@ var color = {
|
|
|
5082
5100
|
});
|
|
5083
5101
|
}
|
|
5084
5102
|
},
|
|
5103
|
+
/**
|
|
5104
|
+
* Get data gradient color url
|
|
5105
|
+
* @param {string} id Data id
|
|
5106
|
+
* @returns {string}
|
|
5107
|
+
* @private
|
|
5108
|
+
*/
|
|
5109
|
+
getGradienColortUrl: function (id) {
|
|
5110
|
+
return "url(#".concat(this.state.datetimeId, "-gradient").concat(this.getTargetSelectorSuffix(id), ")");
|
|
5111
|
+
},
|
|
5112
|
+
/**
|
|
5113
|
+
* Update linear gradient definition (for area & bar only)
|
|
5114
|
+
* @private
|
|
5115
|
+
*/
|
|
5116
|
+
updateLinearGradient: function () {
|
|
5117
|
+
var $$ = this;
|
|
5118
|
+
var config = $$.config, targets = $$.data.targets, datetimeId = $$.state.datetimeId, defs = $$.$el.defs;
|
|
5119
|
+
targets.forEach(function (d) {
|
|
5120
|
+
var id = "".concat(datetimeId, "-gradient").concat($$.getTargetSelectorSuffix(d.id));
|
|
5121
|
+
var supportedType = ($$.isAreaType(d) && "area") || ($$.isBarType(d) && "bar");
|
|
5122
|
+
var isRotated = config.axis_rotated;
|
|
5123
|
+
if (supportedType && defs.select("#".concat(id)).empty()) {
|
|
5124
|
+
var color_1 = $$.color(d);
|
|
5125
|
+
var _a = config["".concat(supportedType, "_linearGradient")], _b = _a.x, x = _b === void 0 ? isRotated ? [1, 0] : [0, 0] : _b, _c = _a.y, y = _c === void 0 ? isRotated ? [0, 0] : [0, 1] : _c, _d = _a.stops, stops = _d === void 0 ? [[0, color_1, 1], [1, color_1, 0]] : _d;
|
|
5126
|
+
var linearGradient_1 = defs.append("linearGradient")
|
|
5127
|
+
.attr("id", "".concat(id))
|
|
5128
|
+
.attr("x1", x[0])
|
|
5129
|
+
.attr("x2", x[1])
|
|
5130
|
+
.attr("y1", y[0])
|
|
5131
|
+
.attr("y2", y[1]);
|
|
5132
|
+
stops.forEach(function (v) {
|
|
5133
|
+
var stopColor = isFunction(v[1]) ? v[1].bind($$.api)(d.id) : v[1];
|
|
5134
|
+
linearGradient_1.append("stop")
|
|
5135
|
+
.attr("offset", v[0])
|
|
5136
|
+
.attr("stop-color", stopColor || color_1)
|
|
5137
|
+
.attr("stop-opacity", v[2]);
|
|
5138
|
+
});
|
|
5139
|
+
}
|
|
5140
|
+
});
|
|
5141
|
+
},
|
|
5085
5142
|
/**
|
|
5086
5143
|
* Set the data over color.
|
|
5087
5144
|
* When is out, will restate in its previous color value
|
|
@@ -5508,6 +5565,20 @@ var format = {
|
|
|
5508
5565
|
* Copyright (c) 2017 ~ present NAVER Corp.
|
|
5509
5566
|
* billboard.js project is licensed under the MIT license
|
|
5510
5567
|
*/
|
|
5568
|
+
/**
|
|
5569
|
+
* Get color string for given data id
|
|
5570
|
+
* @param {string} id Data id
|
|
5571
|
+
* @returns {string} Color string
|
|
5572
|
+
* @private
|
|
5573
|
+
*/
|
|
5574
|
+
function getLegendColor(id) {
|
|
5575
|
+
var $$ = this;
|
|
5576
|
+
var data = $$.getDataById(id);
|
|
5577
|
+
var color = $$.levelColor ?
|
|
5578
|
+
$$.levelColor(data.values[0].value) :
|
|
5579
|
+
$$.color(data);
|
|
5580
|
+
return color;
|
|
5581
|
+
}
|
|
5511
5582
|
var legend$1 = {
|
|
5512
5583
|
/**
|
|
5513
5584
|
* Initialize the legend.
|
|
@@ -5875,81 +5946,169 @@ var legend$1 = {
|
|
|
5875
5946
|
updateLegendElement: function (targetIds, options) {
|
|
5876
5947
|
var $$ = this;
|
|
5877
5948
|
var config = $$.config, state = $$.state, legend = $$.$el.legend, $T = $$.$T;
|
|
5878
|
-
var
|
|
5879
|
-
var
|
|
5880
|
-
var
|
|
5881
|
-
var
|
|
5882
|
-
|
|
5883
|
-
|
|
5949
|
+
var legendType = config.legend_item_tile_type;
|
|
5950
|
+
var isRectangle = legendType !== "circle";
|
|
5951
|
+
var legendItemR = config.legend_item_tile_r;
|
|
5952
|
+
var itemTileSize = {
|
|
5953
|
+
width: isRectangle ? config.legend_item_tile_width : legendItemR * 2,
|
|
5954
|
+
height: isRectangle ? config.legend_item_tile_height : legendItemR * 2
|
|
5955
|
+
};
|
|
5956
|
+
var dimension = {
|
|
5957
|
+
padding: {
|
|
5958
|
+
top: 4,
|
|
5959
|
+
right: 10
|
|
5960
|
+
},
|
|
5961
|
+
max: {
|
|
5962
|
+
width: 0,
|
|
5963
|
+
height: 0
|
|
5964
|
+
},
|
|
5965
|
+
posMin: 10,
|
|
5966
|
+
step: 0,
|
|
5967
|
+
tileWidth: itemTileSize.width + 5,
|
|
5968
|
+
totalLength: 0
|
|
5969
|
+
};
|
|
5970
|
+
var sizes = {
|
|
5971
|
+
offsets: {},
|
|
5972
|
+
widths: {},
|
|
5973
|
+
heights: {},
|
|
5974
|
+
margins: [0],
|
|
5975
|
+
steps: {}
|
|
5976
|
+
};
|
|
5884
5977
|
var xForLegend;
|
|
5885
5978
|
var yForLegend;
|
|
5886
|
-
var totalLength = 0;
|
|
5887
|
-
var offsets = {};
|
|
5888
|
-
var widths = {};
|
|
5889
|
-
var heights = {};
|
|
5890
|
-
var margins = [0];
|
|
5891
|
-
var steps = {};
|
|
5892
|
-
var step = 0;
|
|
5893
5979
|
var background;
|
|
5894
|
-
var isLegendRightOrInset = state.isLegendRight || state.isLegendInset;
|
|
5895
5980
|
// Skip elements when their name is set to null
|
|
5896
5981
|
var targetIdz = targetIds
|
|
5897
5982
|
.filter(function (id) { return !isDefined(config.data_names[id]) || config.data_names[id] !== null; });
|
|
5898
5983
|
var withTransition = options.withTransition;
|
|
5899
|
-
var updatePositions =
|
|
5984
|
+
var updatePositions = $$.getUpdateLegendPositions(targetIdz, dimension, sizes);
|
|
5985
|
+
if (state.isLegendInset) {
|
|
5986
|
+
dimension.step = config.legend_inset_step ? config.legend_inset_step : targetIdz.length;
|
|
5987
|
+
$$.updateLegendStep(dimension.step);
|
|
5988
|
+
}
|
|
5989
|
+
if (state.isLegendRight) {
|
|
5990
|
+
xForLegend = function (id) { return dimension.max.width * sizes.steps[id]; };
|
|
5991
|
+
yForLegend = function (id) { return sizes.margins[sizes.steps[id]] + sizes.offsets[id]; };
|
|
5992
|
+
}
|
|
5993
|
+
else if (state.isLegendInset) {
|
|
5994
|
+
xForLegend = function (id) { return dimension.max.width * sizes.steps[id] + 10; };
|
|
5995
|
+
yForLegend = function (id) { return sizes.margins[sizes.steps[id]] + sizes.offsets[id]; };
|
|
5996
|
+
}
|
|
5997
|
+
else {
|
|
5998
|
+
xForLegend = function (id) { return sizes.margins[sizes.steps[id]] + sizes.offsets[id]; };
|
|
5999
|
+
yForLegend = function (id) { return dimension.max.height * sizes.steps[id]; };
|
|
6000
|
+
}
|
|
6001
|
+
var posFn = {
|
|
6002
|
+
xText: function (id, i) { return xForLegend(id, i) + 4 + itemTileSize.width; },
|
|
6003
|
+
xRect: function (id, i) { return xForLegend(id, i); },
|
|
6004
|
+
x1Tile: function (id, i) { return xForLegend(id, i) - 2; },
|
|
6005
|
+
x2Tile: function (id, i) { return xForLegend(id, i) - 2 + itemTileSize.width; },
|
|
6006
|
+
yText: function (id, i) { return yForLegend(id, i) + 9; },
|
|
6007
|
+
yRect: function (id, i) { return yForLegend(id, i) - 5; },
|
|
6008
|
+
yTile: function (id, i) { return yForLegend(id, i) + 4; }
|
|
6009
|
+
};
|
|
6010
|
+
$$.generateLegendItem(targetIdz, itemTileSize, updatePositions, posFn);
|
|
6011
|
+
// Set background for inset legend
|
|
6012
|
+
background = legend.select(".".concat($LEGEND.legendBackground, " rect"));
|
|
6013
|
+
if (state.isLegendInset && dimension.max.width > 0 && background.size() === 0) {
|
|
6014
|
+
background = legend.insert("g", ".".concat($LEGEND.legendItem))
|
|
6015
|
+
.attr("class", $LEGEND.legendBackground)
|
|
6016
|
+
.append("rect");
|
|
6017
|
+
}
|
|
6018
|
+
var texts = legend.selectAll("text")
|
|
6019
|
+
.data(targetIdz)
|
|
6020
|
+
.text(function (id) { return (isDefined(config.data_names[id]) ? config.data_names[id] : id); }) // MEMO: needed for update
|
|
6021
|
+
.each(function (id, i) {
|
|
6022
|
+
updatePositions(this, id, i);
|
|
6023
|
+
});
|
|
6024
|
+
$T(texts, withTransition)
|
|
6025
|
+
.attr("x", posFn.xText)
|
|
6026
|
+
.attr("y", posFn.yText);
|
|
6027
|
+
var rects = legend.selectAll("rect.".concat($LEGEND.legendItemEvent))
|
|
6028
|
+
.data(targetIdz);
|
|
6029
|
+
$T(rects, withTransition)
|
|
6030
|
+
.attr("width", function (id) { return sizes.widths[id]; })
|
|
6031
|
+
.attr("height", function (id) { return sizes.heights[id]; })
|
|
6032
|
+
.attr("x", posFn.xRect)
|
|
6033
|
+
.attr("y", posFn.yRect);
|
|
6034
|
+
// update legend items position
|
|
6035
|
+
$$.updateLegendItemPos(targetIdz, withTransition, posFn);
|
|
6036
|
+
if (background) {
|
|
6037
|
+
$T(background, withTransition)
|
|
6038
|
+
.attr("height", $$.getLegendHeight() - 12)
|
|
6039
|
+
.attr("width", dimension.max.width * (dimension.step + 1) + 10);
|
|
6040
|
+
}
|
|
6041
|
+
// Update all to reflect change of legend
|
|
6042
|
+
$$.updateLegendItemWidth(dimension.max.width);
|
|
6043
|
+
$$.updateLegendItemHeight(dimension.max.height);
|
|
6044
|
+
$$.updateLegendStep(dimension.step);
|
|
6045
|
+
},
|
|
6046
|
+
/**
|
|
6047
|
+
* Get position update function
|
|
6048
|
+
* @param {Array} targetIdz Data ids
|
|
6049
|
+
* @param {object} dimension Dimension object
|
|
6050
|
+
* @param {object} sizes Size object
|
|
6051
|
+
* @returns {Function} Update position function
|
|
6052
|
+
* @private
|
|
6053
|
+
*/
|
|
6054
|
+
getUpdateLegendPositions: function (targetIdz, dimension, sizes) {
|
|
6055
|
+
var $$ = this;
|
|
6056
|
+
var config = $$.config, state = $$.state;
|
|
6057
|
+
var isLegendRightOrInset = state.isLegendRight || state.isLegendInset;
|
|
6058
|
+
return function (textElement, id, index) {
|
|
5900
6059
|
var reset = index === 0;
|
|
5901
6060
|
var isLast = index === targetIdz.length - 1;
|
|
5902
6061
|
var box = $$.getLegendItemTextBox(id, textElement);
|
|
5903
|
-
var itemWidth = box.width + tileWidth +
|
|
5904
|
-
(isLast && !isLegendRightOrInset ? 0 :
|
|
5905
|
-
var itemHeight = box.height +
|
|
6062
|
+
var itemWidth = box.width + dimension.tileWidth +
|
|
6063
|
+
(isLast && !isLegendRightOrInset ? 0 : dimension.padding.right) + config.legend_padding;
|
|
6064
|
+
var itemHeight = box.height + dimension.padding.top;
|
|
5906
6065
|
var itemLength = isLegendRightOrInset ? itemHeight : itemWidth;
|
|
5907
6066
|
var areaLength = isLegendRightOrInset ? $$.getLegendHeight() : $$.getLegendWidth();
|
|
5908
6067
|
var margin;
|
|
5909
6068
|
// MEMO: care about condifion of step, totalLength
|
|
5910
6069
|
var updateValues = function (id2, withoutStep) {
|
|
5911
6070
|
if (!withoutStep) {
|
|
5912
|
-
margin = (areaLength - totalLength - itemLength) / 2;
|
|
5913
|
-
if (margin < posMin) {
|
|
6071
|
+
margin = (areaLength - dimension.totalLength - itemLength) / 2;
|
|
6072
|
+
if (margin < dimension.posMin) {
|
|
5914
6073
|
margin = (areaLength - itemLength) / 2;
|
|
5915
|
-
totalLength = 0;
|
|
5916
|
-
step++;
|
|
6074
|
+
dimension.totalLength = 0;
|
|
6075
|
+
dimension.step++;
|
|
5917
6076
|
}
|
|
5918
6077
|
}
|
|
5919
|
-
steps[id2] = step;
|
|
5920
|
-
margins[step] = state.isLegendInset ? 10 : margin;
|
|
5921
|
-
offsets[id2] = totalLength;
|
|
5922
|
-
totalLength += itemLength;
|
|
6078
|
+
sizes.steps[id2] = dimension.step;
|
|
6079
|
+
sizes.margins[dimension.step] = state.isLegendInset ? 10 : margin;
|
|
6080
|
+
sizes.offsets[id2] = dimension.totalLength;
|
|
6081
|
+
dimension.totalLength += itemLength;
|
|
5923
6082
|
};
|
|
5924
6083
|
if (reset) {
|
|
5925
|
-
totalLength = 0;
|
|
5926
|
-
step = 0;
|
|
5927
|
-
|
|
5928
|
-
|
|
6084
|
+
dimension.totalLength = 0;
|
|
6085
|
+
dimension.step = 0;
|
|
6086
|
+
dimension.max.width = 0;
|
|
6087
|
+
dimension.max.height = 0;
|
|
5929
6088
|
}
|
|
5930
6089
|
if (config.legend_show && !$$.isLegendToShow(id)) {
|
|
5931
|
-
widths[id] = 0;
|
|
5932
|
-
heights[id] = 0;
|
|
5933
|
-
steps[id] = 0;
|
|
5934
|
-
offsets[id] = 0;
|
|
6090
|
+
sizes.widths[id] = 0;
|
|
6091
|
+
sizes.heights[id] = 0;
|
|
6092
|
+
sizes.steps[id] = 0;
|
|
6093
|
+
sizes.offsets[id] = 0;
|
|
5935
6094
|
return;
|
|
5936
6095
|
}
|
|
5937
|
-
widths[id] = itemWidth;
|
|
5938
|
-
heights[id] = itemHeight;
|
|
5939
|
-
if (!
|
|
5940
|
-
|
|
6096
|
+
sizes.widths[id] = itemWidth;
|
|
6097
|
+
sizes.heights[id] = itemHeight;
|
|
6098
|
+
if (!dimension.max.width || itemWidth >= dimension.max.width) {
|
|
6099
|
+
dimension.max.width = itemWidth;
|
|
5941
6100
|
}
|
|
5942
|
-
if (!
|
|
5943
|
-
|
|
6101
|
+
if (!dimension.max.height || itemHeight >= dimension.max.height) {
|
|
6102
|
+
dimension.max.height = itemHeight;
|
|
5944
6103
|
}
|
|
5945
|
-
var maxLength = isLegendRightOrInset ?
|
|
6104
|
+
var maxLength = isLegendRightOrInset ? dimension.max.height : dimension.max.width;
|
|
5946
6105
|
if (config.legend_equally) {
|
|
5947
|
-
Object.keys(widths).forEach(function (id2) { return (widths[id2] =
|
|
5948
|
-
Object.keys(heights).forEach(function (id2) { return (heights[id2] =
|
|
6106
|
+
Object.keys(sizes.widths).forEach(function (id2) { return (sizes.widths[id2] = dimension.max.width); });
|
|
6107
|
+
Object.keys(sizes.heights).forEach(function (id2) { return (sizes.heights[id2] = dimension.max.height); });
|
|
5949
6108
|
margin = (areaLength - maxLength * targetIdz.length) / 2;
|
|
5950
|
-
if (margin < posMin) {
|
|
5951
|
-
totalLength = 0;
|
|
5952
|
-
step = 0;
|
|
6109
|
+
if (margin < dimension.posMin) {
|
|
6110
|
+
dimension.totalLength = 0;
|
|
6111
|
+
dimension.step = 0;
|
|
5953
6112
|
targetIdz.forEach(function (id2) { return updateValues(id2); });
|
|
5954
6113
|
}
|
|
5955
6114
|
else {
|
|
@@ -5960,29 +6119,23 @@ var legend$1 = {
|
|
|
5960
6119
|
updateValues(id);
|
|
5961
6120
|
}
|
|
5962
6121
|
};
|
|
5963
|
-
|
|
5964
|
-
|
|
5965
|
-
|
|
5966
|
-
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
|
|
5976
|
-
|
|
5977
|
-
|
|
5978
|
-
|
|
5979
|
-
var
|
|
5980
|
-
var xForLegendRect = function (id, i) { return xForLegend(id, i); };
|
|
5981
|
-
var x1ForLegendTile = function (id, i) { return xForLegend(id, i) - 2; };
|
|
5982
|
-
var x2ForLegendTile = function (id, i) { return xForLegend(id, i) - 2 + config.legend_item_tile_width; };
|
|
5983
|
-
var yForLegendText = function (id, i) { return yForLegend(id, i) + 9; };
|
|
5984
|
-
var yForLegendRect = function (id, i) { return yForLegend(id, i) - 5; };
|
|
5985
|
-
var yForLegendTile = function (id, i) { return yForLegend(id, i) + 4; };
|
|
6122
|
+
},
|
|
6123
|
+
/**
|
|
6124
|
+
* Generate legend item elements
|
|
6125
|
+
* @param {Array} targetIdz Data ids
|
|
6126
|
+
* @param {object} itemTileSize Item tile size {width, height}
|
|
6127
|
+
* @param {Function} updatePositions Update position function
|
|
6128
|
+
* @param {object} posFn Position functions
|
|
6129
|
+
* @private
|
|
6130
|
+
*/
|
|
6131
|
+
generateLegendItem: function (targetIdz, itemTileSize, updatePositions, posFn) {
|
|
6132
|
+
var $$ = this;
|
|
6133
|
+
var config = $$.config, state = $$.state, legend = $$.$el.legend;
|
|
6134
|
+
var usePoint = config.legend_usePoint;
|
|
6135
|
+
var legendItemR = config.legend_item_tile_r;
|
|
6136
|
+
var legendType = config.legend_item_tile_type;
|
|
6137
|
+
var isRectangle = legendType !== "circle";
|
|
6138
|
+
var isLegendRightOrInset = state.isLegendRight || state.isLegendInset;
|
|
5986
6139
|
var pos = -200;
|
|
5987
6140
|
// Define g for legend area
|
|
5988
6141
|
var l = legend.selectAll(".".concat($LEGEND.legendItem))
|
|
@@ -5996,21 +6149,13 @@ var legend$1 = {
|
|
|
5996
6149
|
updatePositions(this, id, i);
|
|
5997
6150
|
})
|
|
5998
6151
|
.style("pointer-events", $$.getStylePropValue("none"))
|
|
5999
|
-
.attr("x", isLegendRightOrInset ?
|
|
6000
|
-
.attr("y", isLegendRightOrInset ? pos :
|
|
6152
|
+
.attr("x", isLegendRightOrInset ? posFn.xText : pos)
|
|
6153
|
+
.attr("y", isLegendRightOrInset ? pos : posFn.yText);
|
|
6001
6154
|
l.append("rect")
|
|
6002
6155
|
.attr("class", $LEGEND.legendItemEvent)
|
|
6003
6156
|
.style("fill-opacity", $$.getStylePropValue("0"))
|
|
6004
|
-
.attr("x", isLegendRightOrInset ?
|
|
6005
|
-
.attr("y", isLegendRightOrInset ? pos :
|
|
6006
|
-
var getColor = function (id) {
|
|
6007
|
-
var data = $$.getDataById(id);
|
|
6008
|
-
var color = $$.levelColor ?
|
|
6009
|
-
$$.levelColor(data.values[0].value) :
|
|
6010
|
-
$$.color(data);
|
|
6011
|
-
return color;
|
|
6012
|
-
};
|
|
6013
|
-
var usePoint = config.legend_usePoint;
|
|
6157
|
+
.attr("x", isLegendRightOrInset ? posFn.xRect : pos)
|
|
6158
|
+
.attr("y", isLegendRightOrInset ? pos : posFn.yRect);
|
|
6014
6159
|
if (usePoint) {
|
|
6015
6160
|
var ids_2 = [];
|
|
6016
6161
|
l.append(function (d) {
|
|
@@ -6024,7 +6169,7 @@ var legend$1 = {
|
|
|
6024
6169
|
return doc.createElementNS(namespaces.svg, ("hasValidPointType" in $$) && $$.hasValidPointType(point) ? point : "use");
|
|
6025
6170
|
})
|
|
6026
6171
|
.attr("class", $LEGEND.legendItemPoint)
|
|
6027
|
-
.style("fill",
|
|
6172
|
+
.style("fill", getLegendColor.bind($$))
|
|
6028
6173
|
.style("pointer-events", $$.getStylePropValue("none"))
|
|
6029
6174
|
.attr("href", function (data, idx, selection) {
|
|
6030
6175
|
var node = selection[idx];
|
|
@@ -6034,39 +6179,42 @@ var legend$1 = {
|
|
|
6034
6179
|
});
|
|
6035
6180
|
}
|
|
6036
6181
|
else {
|
|
6037
|
-
l.append("line")
|
|
6182
|
+
l.append(isRectangle ? "line" : legendType)
|
|
6038
6183
|
.attr("class", $LEGEND.legendItemTile)
|
|
6039
|
-
.style("stroke",
|
|
6184
|
+
.style("stroke", getLegendColor.bind($$))
|
|
6040
6185
|
.style("pointer-events", $$.getStylePropValue("none"))
|
|
6041
|
-
.
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
|
|
6045
|
-
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6186
|
+
.call(function (selection) {
|
|
6187
|
+
if (legendType === "circle") {
|
|
6188
|
+
selection
|
|
6189
|
+
.attr("r", legendItemR)
|
|
6190
|
+
.style("fill", getLegendColor.bind($$))
|
|
6191
|
+
.attr("cx", isLegendRightOrInset ? posFn.x2Tile : pos)
|
|
6192
|
+
.attr("cy", isLegendRightOrInset ? pos : posFn.yTile);
|
|
6193
|
+
}
|
|
6194
|
+
else if (isRectangle) {
|
|
6195
|
+
selection
|
|
6196
|
+
.attr("stroke-width", itemTileSize.height)
|
|
6197
|
+
.attr("x1", isLegendRightOrInset ? posFn.x1Tile : pos)
|
|
6198
|
+
.attr("y1", isLegendRightOrInset ? pos : posFn.yTile)
|
|
6199
|
+
.attr("x2", isLegendRightOrInset ? posFn.x2Tile : pos)
|
|
6200
|
+
.attr("y2", isLegendRightOrInset ? pos : posFn.yTile);
|
|
6201
|
+
}
|
|
6202
|
+
});
|
|
6053
6203
|
}
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
var
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
.attr("x", xForLegendRect)
|
|
6069
|
-
.attr("y", yForLegendRect);
|
|
6204
|
+
},
|
|
6205
|
+
/**
|
|
6206
|
+
* Update legend item position
|
|
6207
|
+
* @param {Array} targetIdz Data ids
|
|
6208
|
+
* @param {boolean} withTransition Whether or not to apply transition
|
|
6209
|
+
* @param {object} posFn Position functions
|
|
6210
|
+
* @private
|
|
6211
|
+
*/
|
|
6212
|
+
updateLegendItemPos: function (targetIdz, withTransition, posFn) {
|
|
6213
|
+
var $$ = this;
|
|
6214
|
+
var config = $$.config, legend = $$.$el.legend, $T = $$.$T;
|
|
6215
|
+
var usePoint = config.legend_usePoint;
|
|
6216
|
+
var legendType = config.legend_item_tile_type;
|
|
6217
|
+
var isRectangle = legendType !== "circle";
|
|
6070
6218
|
if (usePoint) {
|
|
6071
6219
|
var tiles = legend.selectAll(".".concat($LEGEND.legendItemPoint))
|
|
6072
6220
|
.data(targetIdz);
|
|
@@ -6078,9 +6226,9 @@ var legend$1 = {
|
|
|
6078
6226
|
var y = "y";
|
|
6079
6227
|
var xOffset = 2;
|
|
6080
6228
|
var yOffset = 2.5;
|
|
6081
|
-
var radius;
|
|
6082
|
-
var width;
|
|
6083
|
-
var height;
|
|
6229
|
+
var radius = null;
|
|
6230
|
+
var width = null;
|
|
6231
|
+
var height = null;
|
|
6084
6232
|
if (nodeName === "circle") {
|
|
6085
6233
|
var size = pointR * 0.2;
|
|
6086
6234
|
x = "cx";
|
|
@@ -6096,32 +6244,36 @@ var legend$1 = {
|
|
|
6096
6244
|
yOffset = 3;
|
|
6097
6245
|
}
|
|
6098
6246
|
select(this)
|
|
6099
|
-
.attr(x, function (d) { return
|
|
6100
|
-
.attr(y, function (d) { return
|
|
6247
|
+
.attr(x, function (d) { return posFn.x1Tile(d) + xOffset; })
|
|
6248
|
+
.attr(y, function (d) { return posFn.yTile(d) - yOffset; })
|
|
6101
6249
|
.attr("r", radius)
|
|
6102
6250
|
.attr("width", width)
|
|
6103
6251
|
.attr("height", height);
|
|
6104
6252
|
});
|
|
6105
6253
|
}
|
|
6106
6254
|
else {
|
|
6107
|
-
var tiles = legend.selectAll("
|
|
6255
|
+
var tiles = legend.selectAll(".".concat($LEGEND.legendItemTile))
|
|
6108
6256
|
.data(targetIdz);
|
|
6109
6257
|
$T(tiles, withTransition)
|
|
6110
|
-
.style("stroke",
|
|
6111
|
-
.
|
|
6112
|
-
|
|
6113
|
-
|
|
6114
|
-
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6258
|
+
.style("stroke", getLegendColor.bind($$))
|
|
6259
|
+
.call(function (selection) {
|
|
6260
|
+
if (legendType === "circle") {
|
|
6261
|
+
selection
|
|
6262
|
+
.attr("cx", function (d) {
|
|
6263
|
+
var x2 = posFn.x2Tile(d);
|
|
6264
|
+
return x2 - ((x2 - posFn.x1Tile(d)) / 2);
|
|
6265
|
+
})
|
|
6266
|
+
.attr("cy", posFn.yTile);
|
|
6267
|
+
}
|
|
6268
|
+
else if (isRectangle) {
|
|
6269
|
+
selection
|
|
6270
|
+
.attr("x1", posFn.x1Tile)
|
|
6271
|
+
.attr("y1", posFn.yTile)
|
|
6272
|
+
.attr("x2", posFn.x2Tile)
|
|
6273
|
+
.attr("y2", posFn.yTile);
|
|
6274
|
+
}
|
|
6275
|
+
});
|
|
6120
6276
|
}
|
|
6121
|
-
// Update all to reflect change of legend
|
|
6122
|
-
$$.updateLegendItemWidth(maxWidth);
|
|
6123
|
-
$$.updateLegendItemHeight(maxHeight);
|
|
6124
|
-
$$.updateLegendStep(step);
|
|
6125
6277
|
}
|
|
6126
6278
|
};
|
|
6127
6279
|
|
|
@@ -16684,35 +16836,16 @@ var shapeArea = {
|
|
|
16684
16836
|
.insert("g", ".".concat(config.area_front ? $CIRCLE.circles : $LINE.lines))
|
|
16685
16837
|
.attr("class", $$.getClass("areas", true));
|
|
16686
16838
|
},
|
|
16687
|
-
|
|
16688
|
-
|
|
16689
|
-
|
|
16690
|
-
|
|
16691
|
-
|
|
16692
|
-
|
|
16693
|
-
var color_1 = $$.color(d);
|
|
16694
|
-
var _a = config.area_linearGradient, _b = _a.x, x = _b === void 0 ? [0, 0] : _b, _c = _a.y, y = _c === void 0 ? [0, 1] : _c, _d = _a.stops, stops = _d === void 0 ? [[0, color_1, 1], [1, color_1, 0]] : _d;
|
|
16695
|
-
var linearGradient_1 = defs.append("linearGradient")
|
|
16696
|
-
.attr("id", "".concat(id))
|
|
16697
|
-
.attr("x1", x[0])
|
|
16698
|
-
.attr("x2", x[1])
|
|
16699
|
-
.attr("y1", y[0])
|
|
16700
|
-
.attr("y2", y[1]);
|
|
16701
|
-
stops.forEach(function (v) {
|
|
16702
|
-
var stopColor = isFunction(v[1]) ? v[1].bind($$.api)(d.id) : v[1];
|
|
16703
|
-
linearGradient_1.append("stop")
|
|
16704
|
-
.attr("offset", v[0])
|
|
16705
|
-
.attr("stop-color", stopColor || color_1)
|
|
16706
|
-
.attr("stop-opacity", v[2]);
|
|
16707
|
-
});
|
|
16708
|
-
}
|
|
16709
|
-
});
|
|
16710
|
-
},
|
|
16839
|
+
/**
|
|
16840
|
+
* Update area color
|
|
16841
|
+
* @param {object} d Data object
|
|
16842
|
+
* @returns {string} Color string
|
|
16843
|
+
* @private
|
|
16844
|
+
*/
|
|
16711
16845
|
updateAreaColor: function (d) {
|
|
16712
16846
|
var $$ = this;
|
|
16713
16847
|
return $$.config.area_linearGradient ?
|
|
16714
|
-
|
|
16715
|
-
$$.color(d);
|
|
16848
|
+
$$.getGradienColortUrl(d.id) : $$.color(d);
|
|
16716
16849
|
},
|
|
16717
16850
|
/**
|
|
16718
16851
|
* Generate/Update elements
|
|
@@ -16725,7 +16858,7 @@ var shapeArea = {
|
|
|
16725
16858
|
var $$ = this;
|
|
16726
16859
|
var config = $$.config, state = $$.state, $el = $$.$el, $T = $$.$T;
|
|
16727
16860
|
var $root = isSub ? $el.subchart : $el;
|
|
16728
|
-
config.area_linearGradient && $$.
|
|
16861
|
+
config.area_linearGradient && $$.updateLinearGradient();
|
|
16729
16862
|
var area = $root.main.selectAll(".".concat($AREA.areas))
|
|
16730
16863
|
.selectAll(".".concat($AREA.area))
|
|
16731
16864
|
.data($$.lineData.bind($$));
|
|
@@ -16894,10 +17027,11 @@ var shapeBar = {
|
|
|
16894
17027
|
updateBar: function (withTransition, isSub) {
|
|
16895
17028
|
if (isSub === void 0) { isSub = false; }
|
|
16896
17029
|
var $$ = this;
|
|
16897
|
-
var $el = $$.$el, $T = $$.$T;
|
|
17030
|
+
var config = $$.config, $el = $$.$el, $T = $$.$T;
|
|
16898
17031
|
var $root = isSub ? $el.subchart : $el;
|
|
16899
17032
|
var classBar = $$.getClass("bar", true);
|
|
16900
17033
|
var initialOpacity = $$.initialOpacity.bind($$);
|
|
17034
|
+
config.bar_linearGradient && $$.updateLinearGradient();
|
|
16901
17035
|
var bar = $root.main.selectAll(".".concat($BAR.bars))
|
|
16902
17036
|
.selectAll(".".concat($BAR.bar))
|
|
16903
17037
|
.data($$.labelishData.bind($$));
|
|
@@ -16906,16 +17040,29 @@ var shapeBar = {
|
|
|
16906
17040
|
.remove();
|
|
16907
17041
|
$root.bar = bar.enter().append("path")
|
|
16908
17042
|
.attr("class", classBar)
|
|
16909
|
-
.style("fill", $$.
|
|
17043
|
+
.style("fill", $$.updateBarColor.bind($$))
|
|
16910
17044
|
.merge(bar)
|
|
16911
17045
|
.style("opacity", initialOpacity);
|
|
16912
17046
|
},
|
|
17047
|
+
/**
|
|
17048
|
+
* Update bar color
|
|
17049
|
+
* @param {object} d Data object
|
|
17050
|
+
* @returns {string} Color string
|
|
17051
|
+
* @private
|
|
17052
|
+
*/
|
|
17053
|
+
updateBarColor: function (d) {
|
|
17054
|
+
var $$ = this;
|
|
17055
|
+
var fn = $$.getStylePropValue($$.color);
|
|
17056
|
+
return $$.config.bar_linearGradient ?
|
|
17057
|
+
$$.getGradienColortUrl(d.id) : (fn ? fn(d) : null);
|
|
17058
|
+
},
|
|
16913
17059
|
/**
|
|
16914
17060
|
* Redraw function
|
|
16915
17061
|
* @param {Function} drawFn Retuned function from .getDrawShape() => .generateDrawBar()
|
|
16916
17062
|
* @param {boolean} withTransition With or without transition
|
|
16917
17063
|
* @param {boolean} isSub Subchart draw
|
|
16918
17064
|
* @returns {Array}
|
|
17065
|
+
* @private
|
|
16919
17066
|
*/
|
|
16920
17067
|
redrawBar: function (drawFn, withTransition, isSub) {
|
|
16921
17068
|
if (isSub === void 0) { isSub = false; }
|
|
@@ -16924,7 +17071,7 @@ var shapeBar = {
|
|
|
16924
17071
|
return [
|
|
16925
17072
|
$$.$T(bar, withTransition, getRandom())
|
|
16926
17073
|
.attr("d", function (d) { return (isNumber(d.value) || $$.isBarRangeType(d)) && drawFn(d); })
|
|
16927
|
-
.style("fill", $$.
|
|
17074
|
+
.style("fill", $$.updateBarColor.bind($$))
|
|
16928
17075
|
.style("opacity", null)
|
|
16929
17076
|
];
|
|
16930
17077
|
},
|
|
@@ -18777,6 +18924,11 @@ var optBar = {
|
|
|
18777
18924
|
* @property {object} bar Bar object
|
|
18778
18925
|
* @property {number} [bar.indices.removeNull=false] Remove nullish data on bar indices positions.
|
|
18779
18926
|
* @property {number} [bar.label.threshold=0] Set threshold ratio to show/hide labels.
|
|
18927
|
+
* @property {boolean|object} [bar.linearGradient=false] Set the linear gradient on bar.<br><br>
|
|
18928
|
+
* Or customize by giving below object value:
|
|
18929
|
+
* - x {Array}: `x1`, `x2` value
|
|
18930
|
+
* - y {Array}: `y1`, `y2` value
|
|
18931
|
+
* - stops {Array}: Each item should be having `[offset, stop-color, stop-opacity]` values.
|
|
18780
18932
|
* @property {boolean} [bar.overlap=false] Bars will be rendered at same position, which will be overlapped each other. (for non-grouped bars only)
|
|
18781
18933
|
* @property {number} [bar.padding=0] The padding pixel value between each bar.
|
|
18782
18934
|
* @property {number} [bar.radius] Set the radius of bar edge in pixel.
|
|
@@ -18805,6 +18957,30 @@ var optBar = {
|
|
|
18805
18957
|
* removeNull: true
|
|
18806
18958
|
* },
|
|
18807
18959
|
*
|
|
18960
|
+
* // will generate follwing linearGradient:
|
|
18961
|
+
* // <linearGradient x1="0" x2="0" y1="0" y2="1">
|
|
18962
|
+
* // <stop offset="0" stop-color="$DATA_COLOR" stop-opacity="1"></stop>
|
|
18963
|
+
* // <stop offset="1" stop-color="$DATA_COLOR" stop-opacity="0"></stop>
|
|
18964
|
+
* // </linearGradient>
|
|
18965
|
+
* linearGradient: true,
|
|
18966
|
+
*
|
|
18967
|
+
* // Or customized gradient
|
|
18968
|
+
* linearGradient: {
|
|
18969
|
+
* x: [0, 0], // x1, x2 attributes
|
|
18970
|
+
* y: [0, 0], // y1, y2 attributes
|
|
18971
|
+
* stops: [
|
|
18972
|
+
* // offset, stop-color, stop-opacity
|
|
18973
|
+
* [0, "#7cb5ec", 1],
|
|
18974
|
+
*
|
|
18975
|
+
* // setting 'null' for stop-color, will set its original data color
|
|
18976
|
+
* [0.5, null, 0],
|
|
18977
|
+
*
|
|
18978
|
+
* // setting 'function' for stop-color, will pass data id as argument.
|
|
18979
|
+
* // It should return color string or null value
|
|
18980
|
+
* [1, function(id) { return id === "data1" ? "red" : "blue"; }, 0],
|
|
18981
|
+
* ]
|
|
18982
|
+
* },
|
|
18983
|
+
*
|
|
18808
18984
|
* // remove nullish da
|
|
18809
18985
|
* overlap: true,
|
|
18810
18986
|
*
|
|
@@ -18847,6 +19023,7 @@ var optBar = {
|
|
|
18847
19023
|
* }
|
|
18848
19024
|
*/
|
|
18849
19025
|
bar_label_threshold: 0,
|
|
19026
|
+
bar_linearGradient: false,
|
|
18850
19027
|
bar_indices_removeNull: false,
|
|
18851
19028
|
bar_overlap: false,
|
|
18852
19029
|
bar_padding: 0,
|
|
@@ -21252,7 +21429,7 @@ var zoomModule = function () {
|
|
|
21252
21429
|
var defaults = {};
|
|
21253
21430
|
/**
|
|
21254
21431
|
* @namespace bb
|
|
21255
|
-
* @version 3.6.
|
|
21432
|
+
* @version 3.6.1
|
|
21256
21433
|
*/
|
|
21257
21434
|
var bb = {
|
|
21258
21435
|
/**
|
|
@@ -21262,7 +21439,7 @@ var bb = {
|
|
|
21262
21439
|
* bb.version; // "1.0.0"
|
|
21263
21440
|
* @memberof bb
|
|
21264
21441
|
*/
|
|
21265
|
-
version: "3.6.
|
|
21442
|
+
version: "3.6.1",
|
|
21266
21443
|
/**
|
|
21267
21444
|
* Generate chart
|
|
21268
21445
|
* - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
|