billboard.js 3.6.0-next.1 → 3.6.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.
- package/dist/billboard.css +1 -1
- package/dist/billboard.js +454 -244
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +2382 -2153
- package/dist/billboard.pkgd.min.js +3 -3
- package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.js +7 -3
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +7 -3
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +7 -3
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +7 -3
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +1926 -1907
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +1932 -1909
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +1933 -1910
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +1933 -1910
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +1933 -1910
- 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 +377 -178
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +6 -2
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +6 -2
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +6 -2
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +6 -2
- package/package.json +11 -11
- package/src/Chart/api/chart.ts +11 -3
- package/src/ChartInternal/ChartInternal.ts +3 -2
- 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 +22 -4
- package/src/ChartInternal/shape/candlestick.ts +4 -3
- package/src/ChartInternal/shape/shape.ts +22 -9
- package/src/config/Options/common/legend.ts +18 -3
- package/src/config/Options/shape/bar.ts +38 -0
- package/src/config/Store/State.ts +1 -0
- package/src/config/config.ts +7 -1
- package/types/axis.d.ts +1 -1
- package/types/chart.d.ts +3 -1
- package/types/options.d.ts +28 -4
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
|
|
8
|
+
* @version 3.6.0
|
|
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: [],
|
|
@@ -3317,9 +3319,15 @@ var data_this = undefined;
|
|
|
3317
3319
|
* @property {Function} [legend.item.onclick=undefined] Set click event handler to the legend item.
|
|
3318
3320
|
* @property {Function} [legend.item.onover=undefined] Set mouse/touch over event handler to the legend item.
|
|
3319
3321
|
* @property {Function} [legend.item.onout=undefined] Set mouse/touch out event handler to the legend item.
|
|
3320
|
-
* @property {number} [legend.item.tile.width=10] Set width
|
|
3321
|
-
* @property {number} [legend.item.tile.height=10]
|
|
3322
|
+
* @property {number} [legend.item.tile.width=10] Set width for 'rectangle' legend item tile element.
|
|
3323
|
+
* @property {number} [legend.item.tile.height=10] ㄹ
|
|
3324
|
+
* @property {number} [legend.item.tile.r=5] Set the radius for 'circle' legend item tile type.
|
|
3325
|
+
* @property {string} [legend.item.tile.type="rectangle"] Set legend item shape type.<br>
|
|
3326
|
+
* - **Available Values:**
|
|
3327
|
+
* - circle
|
|
3328
|
+
* - rectangle
|
|
3322
3329
|
* @property {boolean} [legend.usePoint=false] Whether to use custom points in legend.
|
|
3330
|
+
* @see [Demo: item.tile.type](https://naver.github.io/billboard.js/demo/#Legend.LegendItemTileType)
|
|
3323
3331
|
* @see [Demo: position](https://naver.github.io/billboard.js/demo/#Legend.LegendPosition)
|
|
3324
3332
|
* @see [Demo: contents.template](https://naver.github.io/billboard.js/demo/#Legend.LegendTemplate1)
|
|
3325
3333
|
* @see [Demo: usePoint](https://naver.github.io/billboard.js/demo/#Legend.usePoint)
|
|
@@ -3359,8 +3367,15 @@ var data_this = undefined;
|
|
|
3359
3367
|
*
|
|
3360
3368
|
* // set tile's size
|
|
3361
3369
|
* tile: {
|
|
3362
|
-
*
|
|
3370
|
+
* // set tile type
|
|
3371
|
+
* type: "circle" // or "rectangle" (default)
|
|
3372
|
+
*
|
|
3373
|
+
* // width & height, are only applicable for 'rectangle' legend type
|
|
3374
|
+
* width: 15,
|
|
3363
3375
|
* height: 15
|
|
3376
|
+
*
|
|
3377
|
+
* // radis is only applicable for 'circle' legend type
|
|
3378
|
+
* r: 10
|
|
3364
3379
|
* }
|
|
3365
3380
|
* },
|
|
3366
3381
|
* usePoint: true
|
|
@@ -3382,6 +3397,8 @@ var data_this = undefined;
|
|
|
3382
3397
|
legend_padding: 0,
|
|
3383
3398
|
legend_item_tile_width: 10,
|
|
3384
3399
|
legend_item_tile_height: 10,
|
|
3400
|
+
legend_item_tile_r: 5,
|
|
3401
|
+
legend_item_tile_type: "rectangle",
|
|
3385
3402
|
legend_usePoint: !1
|
|
3386
3403
|
});
|
|
3387
3404
|
;// CONCATENATED MODULE: ./src/config/Options/common/title.ts
|
|
@@ -6503,6 +6520,57 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6503
6520
|
}
|
|
6504
6521
|
},
|
|
6505
6522
|
|
|
6523
|
+
/**
|
|
6524
|
+
* Get data gradient color url
|
|
6525
|
+
* @param {string} id Data id
|
|
6526
|
+
* @returns {string}
|
|
6527
|
+
* @private
|
|
6528
|
+
*/
|
|
6529
|
+
getGradienColortUrl: function getGradienColortUrl(id) {
|
|
6530
|
+
return "url(#" + this.state.datetimeId + "-gradient" + this.getTargetSelectorSuffix(id) + ")";
|
|
6531
|
+
},
|
|
6532
|
+
|
|
6533
|
+
/**
|
|
6534
|
+
* Update linear gradient definition (for area & bar only)
|
|
6535
|
+
* @private
|
|
6536
|
+
*/
|
|
6537
|
+
updateLinearGradient: function updateLinearGradient() {
|
|
6538
|
+
var _this5 = this,
|
|
6539
|
+
$$ = this,
|
|
6540
|
+
config = $$.config,
|
|
6541
|
+
targets = $$.data.targets,
|
|
6542
|
+
datetimeId = $$.state.datetimeId,
|
|
6543
|
+
defs = $$.$el.defs;
|
|
6544
|
+
|
|
6545
|
+
targets.forEach(function (d) {
|
|
6546
|
+
var _this6 = this;
|
|
6547
|
+
|
|
6548
|
+
_newArrowCheck(this, _this5);
|
|
6549
|
+
|
|
6550
|
+
var id = datetimeId + "-gradient" + $$.getTargetSelectorSuffix(d.id),
|
|
6551
|
+
supportedType = $$.isAreaType(d) && "area" || $$.isBarType(d) && "bar",
|
|
6552
|
+
isRotated = config.axis_rotated;
|
|
6553
|
+
|
|
6554
|
+
if (supportedType && defs.select("#" + id).empty()) {
|
|
6555
|
+
var color = $$.color(d),
|
|
6556
|
+
_config = config[supportedType + "_linearGradient"],
|
|
6557
|
+
_config$x = _config.x,
|
|
6558
|
+
x = _config$x === void 0 ? isRotated ? [1, 0] : [0, 0] : _config$x,
|
|
6559
|
+
_config$y = _config.y,
|
|
6560
|
+
y = _config$y === void 0 ? isRotated ? [0, 0] : [0, 1] : _config$y,
|
|
6561
|
+
_config$stops = _config.stops,
|
|
6562
|
+
stops = _config$stops === void 0 ? [[0, color, 1], [1, color, 0]] : _config$stops,
|
|
6563
|
+
linearGradient = defs.append("linearGradient").attr("id", "" + id).attr("x1", x[0]).attr("x2", x[1]).attr("y1", y[0]).attr("y2", y[1]);
|
|
6564
|
+
stops.forEach(function (v) {
|
|
6565
|
+
_newArrowCheck(this, _this6);
|
|
6566
|
+
|
|
6567
|
+
var stopColor = isFunction(v[1]) ? v[1].bind($$.api)(d.id) : v[1];
|
|
6568
|
+
linearGradient.append("stop").attr("offset", v[0]).attr("stop-color", stopColor || color).attr("stop-opacity", v[2]);
|
|
6569
|
+
}.bind(this));
|
|
6570
|
+
}
|
|
6571
|
+
}.bind(this));
|
|
6572
|
+
},
|
|
6573
|
+
|
|
6506
6574
|
/**
|
|
6507
6575
|
* Set the data over color.
|
|
6508
6576
|
* When is out, will restate in its previous color value
|
|
@@ -6511,7 +6579,7 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6511
6579
|
* @private
|
|
6512
6580
|
*/
|
|
6513
6581
|
setOverColor: function setOverColor(isOver, d) {
|
|
6514
|
-
var
|
|
6582
|
+
var _this7 = this,
|
|
6515
6583
|
$$ = this,
|
|
6516
6584
|
config = $$.config,
|
|
6517
6585
|
main = $$.$el.main,
|
|
@@ -6522,13 +6590,13 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6522
6590
|
color = function (_ref) {
|
|
6523
6591
|
var id = _ref.id;
|
|
6524
6592
|
|
|
6525
|
-
_newArrowCheck(this,
|
|
6593
|
+
_newArrowCheck(this, _this7);
|
|
6526
6594
|
|
|
6527
6595
|
return id in onover ? onover[id] : $$.color(id);
|
|
6528
6596
|
}.bind(this);
|
|
6529
6597
|
} else if (isString(color)) {
|
|
6530
6598
|
color = function () {
|
|
6531
|
-
_newArrowCheck(this,
|
|
6599
|
+
_newArrowCheck(this, _this7);
|
|
6532
6600
|
|
|
6533
6601
|
return onover;
|
|
6534
6602
|
}.bind(this);
|
|
@@ -7096,6 +7164,20 @@ function getFormat($$, typeValue, v) {
|
|
|
7096
7164
|
|
|
7097
7165
|
|
|
7098
7166
|
|
|
7167
|
+
/**
|
|
7168
|
+
* Get color string for given data id
|
|
7169
|
+
* @param {string} id Data id
|
|
7170
|
+
* @returns {string} Color string
|
|
7171
|
+
* @private
|
|
7172
|
+
*/
|
|
7173
|
+
|
|
7174
|
+
function getLegendColor(id) {
|
|
7175
|
+
var $$ = this,
|
|
7176
|
+
data = $$.getDataById(id),
|
|
7177
|
+
color = $$.levelColor ? $$.levelColor(data.values[0].value) : $$.color(data);
|
|
7178
|
+
return color;
|
|
7179
|
+
}
|
|
7180
|
+
|
|
7099
7181
|
/* harmony default export */ var internals_legend = ({
|
|
7100
7182
|
/**
|
|
7101
7183
|
* Initialize the legend.
|
|
@@ -7515,96 +7597,248 @@ function getFormat($$, typeValue, v) {
|
|
|
7515
7597
|
state = $$.state,
|
|
7516
7598
|
legend = $$.$el.legend,
|
|
7517
7599
|
$T = $$.$T,
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7600
|
+
legendType = config.legend_item_tile_type,
|
|
7601
|
+
isRectangle = legendType !== "circle",
|
|
7602
|
+
legendItemR = config.legend_item_tile_r,
|
|
7603
|
+
itemTileSize = {
|
|
7604
|
+
width: isRectangle ? config.legend_item_tile_width : legendItemR * 2,
|
|
7605
|
+
height: isRectangle ? config.legend_item_tile_height : legendItemR * 2
|
|
7606
|
+
},
|
|
7607
|
+
dimension = {
|
|
7608
|
+
padding: {
|
|
7609
|
+
top: 4,
|
|
7610
|
+
right: 10
|
|
7611
|
+
},
|
|
7612
|
+
max: {
|
|
7613
|
+
width: 0,
|
|
7614
|
+
height: 0
|
|
7615
|
+
},
|
|
7616
|
+
posMin: 10,
|
|
7617
|
+
step: 0,
|
|
7618
|
+
tileWidth: itemTileSize.width + 5,
|
|
7619
|
+
totalLength: 0
|
|
7620
|
+
},
|
|
7621
|
+
sizes = {
|
|
7622
|
+
offsets: {},
|
|
7623
|
+
widths: {},
|
|
7624
|
+
heights: {},
|
|
7625
|
+
margins: [0],
|
|
7626
|
+
steps: {}
|
|
7627
|
+
},
|
|
7521
7628
|
xForLegend,
|
|
7522
7629
|
yForLegend,
|
|
7523
|
-
totalLength = 0,
|
|
7524
|
-
offsets = {},
|
|
7525
|
-
widths = {},
|
|
7526
|
-
heights = {},
|
|
7527
|
-
margins = [0],
|
|
7528
|
-
steps = {},
|
|
7529
|
-
step = 0,
|
|
7530
7630
|
background,
|
|
7531
|
-
isLegendRightOrInset = state.isLegendRight || state.isLegendInset,
|
|
7532
7631
|
targetIdz = targetIds.filter(function (id) {
|
|
7533
7632
|
_newArrowCheck(this, _this4);
|
|
7534
7633
|
|
|
7535
7634
|
return !isDefined(config.data_names[id]) || config.data_names[id] !== null;
|
|
7536
7635
|
}.bind(this)),
|
|
7537
7636
|
withTransition = options.withTransition,
|
|
7538
|
-
updatePositions =
|
|
7637
|
+
updatePositions = $$.getUpdateLegendPositions(targetIdz, dimension, sizes);
|
|
7638
|
+
|
|
7639
|
+
if (state.isLegendInset) {
|
|
7640
|
+
dimension.step = config.legend_inset_step ? config.legend_inset_step : targetIdz.length;
|
|
7641
|
+
$$.updateLegendStep(dimension.step);
|
|
7642
|
+
}
|
|
7643
|
+
|
|
7644
|
+
if (state.isLegendRight) {
|
|
7645
|
+
xForLegend = function (id) {
|
|
7646
|
+
_newArrowCheck(this, _this4);
|
|
7647
|
+
|
|
7648
|
+
return dimension.max.width * sizes.steps[id];
|
|
7649
|
+
}.bind(this);
|
|
7650
|
+
|
|
7651
|
+
yForLegend = function (id) {
|
|
7652
|
+
_newArrowCheck(this, _this4);
|
|
7653
|
+
|
|
7654
|
+
return sizes.margins[sizes.steps[id]] + sizes.offsets[id];
|
|
7655
|
+
}.bind(this);
|
|
7656
|
+
} else if (state.isLegendInset) {
|
|
7657
|
+
xForLegend = function (id) {
|
|
7658
|
+
_newArrowCheck(this, _this4);
|
|
7659
|
+
|
|
7660
|
+
return dimension.max.width * sizes.steps[id] + 10;
|
|
7661
|
+
}.bind(this);
|
|
7662
|
+
|
|
7663
|
+
yForLegend = function (id) {
|
|
7664
|
+
_newArrowCheck(this, _this4);
|
|
7665
|
+
|
|
7666
|
+
return sizes.margins[sizes.steps[id]] + sizes.offsets[id];
|
|
7667
|
+
}.bind(this);
|
|
7668
|
+
} else {
|
|
7669
|
+
xForLegend = function (id) {
|
|
7670
|
+
_newArrowCheck(this, _this4);
|
|
7671
|
+
|
|
7672
|
+
return sizes.margins[sizes.steps[id]] + sizes.offsets[id];
|
|
7673
|
+
}.bind(this);
|
|
7674
|
+
|
|
7675
|
+
yForLegend = function (id) {
|
|
7676
|
+
_newArrowCheck(this, _this4);
|
|
7677
|
+
|
|
7678
|
+
return dimension.max.height * sizes.steps[id];
|
|
7679
|
+
}.bind(this);
|
|
7680
|
+
}
|
|
7681
|
+
|
|
7682
|
+
var posFn = {
|
|
7683
|
+
xText: function xText(id, i) {
|
|
7684
|
+
_newArrowCheck(this, _this4);
|
|
7685
|
+
|
|
7686
|
+
return xForLegend(id, i) + 4 + itemTileSize.width;
|
|
7687
|
+
}.bind(this),
|
|
7688
|
+
xRect: function xRect(id, i) {
|
|
7689
|
+
_newArrowCheck(this, _this4);
|
|
7690
|
+
|
|
7691
|
+
return xForLegend(id, i);
|
|
7692
|
+
}.bind(this),
|
|
7693
|
+
x1Tile: function x1Tile(id, i) {
|
|
7694
|
+
_newArrowCheck(this, _this4);
|
|
7695
|
+
|
|
7696
|
+
return xForLegend(id, i) - 2;
|
|
7697
|
+
}.bind(this),
|
|
7698
|
+
x2Tile: function x2Tile(id, i) {
|
|
7699
|
+
_newArrowCheck(this, _this4);
|
|
7700
|
+
|
|
7701
|
+
return xForLegend(id, i) - 2 + itemTileSize.width;
|
|
7702
|
+
}.bind(this),
|
|
7703
|
+
yText: function yText(id, i) {
|
|
7704
|
+
_newArrowCheck(this, _this4);
|
|
7705
|
+
|
|
7706
|
+
return yForLegend(id, i) + 9;
|
|
7707
|
+
}.bind(this),
|
|
7708
|
+
yRect: function yRect(id, i) {
|
|
7709
|
+
_newArrowCheck(this, _this4);
|
|
7710
|
+
|
|
7711
|
+
return yForLegend(id, i) - 5;
|
|
7712
|
+
}.bind(this),
|
|
7713
|
+
yTile: function yTile(id, i) {
|
|
7714
|
+
_newArrowCheck(this, _this4);
|
|
7715
|
+
|
|
7716
|
+
return yForLegend(id, i) + 4;
|
|
7717
|
+
}.bind(this)
|
|
7718
|
+
};
|
|
7719
|
+
$$.generateLegendItem(targetIdz, itemTileSize, updatePositions, posFn); // Set background for inset legend
|
|
7720
|
+
|
|
7721
|
+
background = legend.select("." + $LEGEND.legendBackground + " rect");
|
|
7722
|
+
|
|
7723
|
+
if (state.isLegendInset && dimension.max.width > 0 && background.size() === 0) {
|
|
7724
|
+
background = legend.insert("g", "." + $LEGEND.legendItem).attr("class", $LEGEND.legendBackground).append("rect");
|
|
7725
|
+
}
|
|
7726
|
+
|
|
7727
|
+
var texts = legend.selectAll("text").data(targetIdz).text(function (id) {
|
|
7728
|
+
_newArrowCheck(this, _this4);
|
|
7729
|
+
|
|
7730
|
+
return isDefined(config.data_names[id]) ? config.data_names[id] : id;
|
|
7731
|
+
}.bind(this)) // MEMO: needed for update
|
|
7732
|
+
.each(function (id, i) {
|
|
7733
|
+
updatePositions(this, id, i);
|
|
7734
|
+
});
|
|
7735
|
+
$T(texts, withTransition).attr("x", posFn.xText).attr("y", posFn.yText);
|
|
7736
|
+
var rects = legend.selectAll("rect." + $LEGEND.legendItemEvent).data(targetIdz);
|
|
7737
|
+
$T(rects, withTransition).attr("width", function (id) {
|
|
7738
|
+
_newArrowCheck(this, _this4);
|
|
7739
|
+
|
|
7740
|
+
return sizes.widths[id];
|
|
7741
|
+
}.bind(this)).attr("height", function (id) {
|
|
7742
|
+
_newArrowCheck(this, _this4);
|
|
7743
|
+
|
|
7744
|
+
return sizes.heights[id];
|
|
7745
|
+
}.bind(this)).attr("x", posFn.xRect).attr("y", posFn.yRect); // update legend items position
|
|
7746
|
+
|
|
7747
|
+
$$.updateLegendItemPos(targetIdz, withTransition, posFn);
|
|
7748
|
+
|
|
7749
|
+
if (background) {
|
|
7750
|
+
$T(background, withTransition).attr("height", $$.getLegendHeight() - 12).attr("width", dimension.max.width * (dimension.step + 1) + 10);
|
|
7751
|
+
} // Update all to reflect change of legend
|
|
7752
|
+
|
|
7753
|
+
|
|
7754
|
+
$$.updateLegendItemWidth(dimension.max.width);
|
|
7755
|
+
$$.updateLegendItemHeight(dimension.max.height);
|
|
7756
|
+
$$.updateLegendStep(dimension.step);
|
|
7757
|
+
},
|
|
7758
|
+
|
|
7759
|
+
/**
|
|
7760
|
+
* Get position update function
|
|
7761
|
+
* @param {Array} targetIdz Data ids
|
|
7762
|
+
* @param {object} dimension Dimension object
|
|
7763
|
+
* @param {object} sizes Size object
|
|
7764
|
+
* @returns {Function} Update position function
|
|
7765
|
+
* @private
|
|
7766
|
+
*/
|
|
7767
|
+
getUpdateLegendPositions: function getUpdateLegendPositions(targetIdz, dimension, sizes) {
|
|
7768
|
+
var $$ = this,
|
|
7769
|
+
config = $$.config,
|
|
7770
|
+
state = $$.state,
|
|
7771
|
+
isLegendRightOrInset = state.isLegendRight || state.isLegendInset;
|
|
7772
|
+
return function (textElement, id, index) {
|
|
7539
7773
|
var _this5 = this,
|
|
7540
7774
|
isLast = index === targetIdz.length - 1,
|
|
7541
7775
|
box = $$.getLegendItemTextBox(id, textElement),
|
|
7542
|
-
itemWidth = box.width + tileWidth + (isLast && !isLegendRightOrInset ? 0 :
|
|
7543
|
-
itemHeight = box.height +
|
|
7776
|
+
itemWidth = box.width + dimension.tileWidth + (isLast && !isLegendRightOrInset ? 0 : dimension.padding.right) + config.legend_padding,
|
|
7777
|
+
itemHeight = box.height + dimension.padding.top,
|
|
7544
7778
|
itemLength = isLegendRightOrInset ? itemHeight : itemWidth,
|
|
7545
7779
|
areaLength = isLegendRightOrInset ? $$.getLegendHeight() : $$.getLegendWidth(),
|
|
7546
7780
|
margin,
|
|
7547
7781
|
updateValues = function (id2, withoutStep) {
|
|
7548
7782
|
if (!withoutStep) {
|
|
7549
|
-
margin = (areaLength - totalLength - itemLength) / 2;
|
|
7783
|
+
margin = (areaLength - dimension.totalLength - itemLength) / 2;
|
|
7550
7784
|
|
|
7551
|
-
if (margin <
|
|
7785
|
+
if (margin < dimension.posMin) {
|
|
7552
7786
|
margin = (areaLength - itemLength) / 2;
|
|
7553
|
-
totalLength = 0;
|
|
7554
|
-
step++;
|
|
7787
|
+
dimension.totalLength = 0;
|
|
7788
|
+
dimension.step++;
|
|
7555
7789
|
}
|
|
7556
7790
|
}
|
|
7557
7791
|
|
|
7558
|
-
steps[id2] = step;
|
|
7559
|
-
margins[step] = state.isLegendInset ? 10 : margin;
|
|
7560
|
-
offsets[id2] = totalLength;
|
|
7561
|
-
totalLength += itemLength;
|
|
7792
|
+
sizes.steps[id2] = dimension.step;
|
|
7793
|
+
sizes.margins[dimension.step] = state.isLegendInset ? 10 : margin;
|
|
7794
|
+
sizes.offsets[id2] = dimension.totalLength;
|
|
7795
|
+
dimension.totalLength += itemLength;
|
|
7562
7796
|
};
|
|
7563
7797
|
|
|
7564
7798
|
if (index === 0) {
|
|
7565
|
-
totalLength = 0;
|
|
7566
|
-
step = 0;
|
|
7567
|
-
|
|
7568
|
-
|
|
7799
|
+
dimension.totalLength = 0;
|
|
7800
|
+
dimension.step = 0;
|
|
7801
|
+
dimension.max.width = 0;
|
|
7802
|
+
dimension.max.height = 0;
|
|
7569
7803
|
}
|
|
7570
7804
|
|
|
7571
7805
|
if (config.legend_show && !$$.isLegendToShow(id)) {
|
|
7572
|
-
widths[id] = 0;
|
|
7573
|
-
heights[id] = 0;
|
|
7574
|
-
steps[id] = 0;
|
|
7575
|
-
offsets[id] = 0;
|
|
7806
|
+
sizes.widths[id] = 0;
|
|
7807
|
+
sizes.heights[id] = 0;
|
|
7808
|
+
sizes.steps[id] = 0;
|
|
7809
|
+
sizes.offsets[id] = 0;
|
|
7576
7810
|
return;
|
|
7577
7811
|
}
|
|
7578
7812
|
|
|
7579
|
-
widths[id] = itemWidth;
|
|
7580
|
-
heights[id] = itemHeight;
|
|
7813
|
+
sizes.widths[id] = itemWidth;
|
|
7814
|
+
sizes.heights[id] = itemHeight;
|
|
7581
7815
|
|
|
7582
|
-
if (!
|
|
7583
|
-
|
|
7816
|
+
if (!dimension.max.width || itemWidth >= dimension.max.width) {
|
|
7817
|
+
dimension.max.width = itemWidth;
|
|
7584
7818
|
}
|
|
7585
7819
|
|
|
7586
|
-
if (!
|
|
7587
|
-
|
|
7820
|
+
if (!dimension.max.height || itemHeight >= dimension.max.height) {
|
|
7821
|
+
dimension.max.height = itemHeight;
|
|
7588
7822
|
}
|
|
7589
7823
|
|
|
7590
|
-
var maxLength = isLegendRightOrInset ?
|
|
7824
|
+
var maxLength = isLegendRightOrInset ? dimension.max.height : dimension.max.width;
|
|
7591
7825
|
|
|
7592
7826
|
if (config.legend_equally) {
|
|
7593
|
-
Object.keys(widths).forEach(function (id2) {
|
|
7827
|
+
Object.keys(sizes.widths).forEach(function (id2) {
|
|
7594
7828
|
_newArrowCheck(this, _this5);
|
|
7595
7829
|
|
|
7596
|
-
return widths[id2] =
|
|
7830
|
+
return sizes.widths[id2] = dimension.max.width;
|
|
7597
7831
|
}.bind(this));
|
|
7598
|
-
Object.keys(heights).forEach(function (id2) {
|
|
7832
|
+
Object.keys(sizes.heights).forEach(function (id2) {
|
|
7599
7833
|
_newArrowCheck(this, _this5);
|
|
7600
7834
|
|
|
7601
|
-
return heights[id2] =
|
|
7835
|
+
return sizes.heights[id2] = dimension.max.height;
|
|
7602
7836
|
}.bind(this));
|
|
7603
7837
|
margin = (areaLength - maxLength * targetIdz.length) / 2;
|
|
7604
7838
|
|
|
7605
|
-
if (margin <
|
|
7606
|
-
totalLength = 0;
|
|
7607
|
-
step = 0;
|
|
7839
|
+
if (margin < dimension.posMin) {
|
|
7840
|
+
dimension.totalLength = 0;
|
|
7841
|
+
dimension.step = 0;
|
|
7608
7842
|
targetIdz.forEach(function (id2) {
|
|
7609
7843
|
_newArrowCheck(this, _this5);
|
|
7610
7844
|
|
|
@@ -7617,111 +7851,43 @@ function getFormat($$, typeValue, v) {
|
|
|
7617
7851
|
updateValues(id);
|
|
7618
7852
|
}
|
|
7619
7853
|
};
|
|
7854
|
+
},
|
|
7620
7855
|
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
_newArrowCheck(this, _this4);
|
|
7641
|
-
|
|
7642
|
-
return maxWidth * steps[id] + 10;
|
|
7643
|
-
}.bind(this);
|
|
7644
|
-
|
|
7645
|
-
yForLegend = function (id) {
|
|
7646
|
-
_newArrowCheck(this, _this4);
|
|
7647
|
-
|
|
7648
|
-
return margins[steps[id]] + offsets[id];
|
|
7649
|
-
}.bind(this);
|
|
7650
|
-
} else {
|
|
7651
|
-
xForLegend = function (id) {
|
|
7652
|
-
_newArrowCheck(this, _this4);
|
|
7653
|
-
|
|
7654
|
-
return margins[steps[id]] + offsets[id];
|
|
7655
|
-
}.bind(this);
|
|
7656
|
-
|
|
7657
|
-
yForLegend = function (id) {
|
|
7658
|
-
_newArrowCheck(this, _this4);
|
|
7659
|
-
|
|
7660
|
-
return maxHeight * steps[id];
|
|
7661
|
-
}.bind(this);
|
|
7662
|
-
}
|
|
7663
|
-
|
|
7664
|
-
var xForLegendText = function (id, i) {
|
|
7665
|
-
_newArrowCheck(this, _this4);
|
|
7666
|
-
|
|
7667
|
-
return xForLegend(id, i) + 4 + config.legend_item_tile_width;
|
|
7668
|
-
}.bind(this),
|
|
7669
|
-
xForLegendRect = function (id, i) {
|
|
7670
|
-
_newArrowCheck(this, _this4);
|
|
7671
|
-
|
|
7672
|
-
return xForLegend(id, i);
|
|
7673
|
-
}.bind(this),
|
|
7674
|
-
x1ForLegendTile = function (id, i) {
|
|
7675
|
-
_newArrowCheck(this, _this4);
|
|
7676
|
-
|
|
7677
|
-
return xForLegend(id, i) - 2;
|
|
7678
|
-
}.bind(this),
|
|
7679
|
-
x2ForLegendTile = function (id, i) {
|
|
7680
|
-
_newArrowCheck(this, _this4);
|
|
7681
|
-
|
|
7682
|
-
return xForLegend(id, i) - 2 + config.legend_item_tile_width;
|
|
7683
|
-
}.bind(this),
|
|
7684
|
-
yForLegendText = function (id, i) {
|
|
7685
|
-
_newArrowCheck(this, _this4);
|
|
7686
|
-
|
|
7687
|
-
return yForLegend(id, i) + 9;
|
|
7688
|
-
}.bind(this),
|
|
7689
|
-
yForLegendRect = function (id, i) {
|
|
7690
|
-
_newArrowCheck(this, _this4);
|
|
7691
|
-
|
|
7692
|
-
return yForLegend(id, i) - 5;
|
|
7693
|
-
}.bind(this),
|
|
7694
|
-
yForLegendTile = function (id, i) {
|
|
7695
|
-
_newArrowCheck(this, _this4);
|
|
7696
|
-
|
|
7697
|
-
return yForLegend(id, i) + 4;
|
|
7698
|
-
}.bind(this),
|
|
7699
|
-
pos = -200,
|
|
7856
|
+
/**
|
|
7857
|
+
* Generate legend item elements
|
|
7858
|
+
* @param {Array} targetIdz Data ids
|
|
7859
|
+
* @param {object} itemTileSize Item tile size {width, height}
|
|
7860
|
+
* @param {Function} updatePositions Update position function
|
|
7861
|
+
* @param {object} posFn Position functions
|
|
7862
|
+
* @private
|
|
7863
|
+
*/
|
|
7864
|
+
generateLegendItem: function generateLegendItem(targetIdz, itemTileSize, updatePositions, posFn) {
|
|
7865
|
+
var _this6 = this,
|
|
7866
|
+
$$ = this,
|
|
7867
|
+
config = $$.config,
|
|
7868
|
+
state = $$.state,
|
|
7869
|
+
legend = $$.$el.legend,
|
|
7870
|
+
usePoint = config.legend_usePoint,
|
|
7871
|
+
legendItemR = config.legend_item_tile_r,
|
|
7872
|
+
legendType = config.legend_item_tile_type,
|
|
7873
|
+
isRectangle = legendType !== "circle",
|
|
7874
|
+
isLegendRightOrInset = state.isLegendRight || state.isLegendInset,
|
|
7700
7875
|
l = legend.selectAll("." + $LEGEND.legendItem).data(targetIdz).enter().append("g");
|
|
7701
7876
|
|
|
7702
7877
|
$$.setLegendItem(l);
|
|
7703
7878
|
l.append("text").text(function (id) {
|
|
7704
|
-
_newArrowCheck(this,
|
|
7879
|
+
_newArrowCheck(this, _this6);
|
|
7705
7880
|
|
|
7706
7881
|
return isDefined(config.data_names[id]) ? config.data_names[id] : id;
|
|
7707
7882
|
}.bind(this)).each(function (id, i) {
|
|
7708
7883
|
updatePositions(this, id, i);
|
|
7709
|
-
}).style("pointer-events", $$.getStylePropValue("none")).attr("x", isLegendRightOrInset ?
|
|
7710
|
-
l.append("rect").attr("class", $LEGEND.legendItemEvent).style("fill-opacity", $$.getStylePropValue("0")).attr("x", isLegendRightOrInset ?
|
|
7711
|
-
|
|
7712
|
-
var getColor = function (id) {
|
|
7713
|
-
_newArrowCheck(this, _this4);
|
|
7714
|
-
|
|
7715
|
-
var data = $$.getDataById(id),
|
|
7716
|
-
color = $$.levelColor ? $$.levelColor(data.values[0].value) : $$.color(data);
|
|
7717
|
-
return color;
|
|
7718
|
-
}.bind(this),
|
|
7719
|
-
usePoint = config.legend_usePoint;
|
|
7884
|
+
}).style("pointer-events", $$.getStylePropValue("none")).attr("x", isLegendRightOrInset ? posFn.xText : -200).attr("y", isLegendRightOrInset ? -200 : posFn.yText);
|
|
7885
|
+
l.append("rect").attr("class", $LEGEND.legendItemEvent).style("fill-opacity", $$.getStylePropValue("0")).attr("x", isLegendRightOrInset ? posFn.xRect : -200).attr("y", isLegendRightOrInset ? -200 : posFn.yRect);
|
|
7720
7886
|
|
|
7721
7887
|
if (usePoint) {
|
|
7722
7888
|
var _ids = [];
|
|
7723
7889
|
l.append(function (d) {
|
|
7724
|
-
_newArrowCheck(this,
|
|
7890
|
+
_newArrowCheck(this, _this6);
|
|
7725
7891
|
|
|
7726
7892
|
var pattern = notEmpty(config.point_pattern) ? config.point_pattern : [config.point_type];
|
|
7727
7893
|
_ids.indexOf(d) === -1 && _ids.push(d);
|
|
@@ -7732,8 +7898,8 @@ function getFormat($$, typeValue, v) {
|
|
|
7732
7898
|
}
|
|
7733
7899
|
|
|
7734
7900
|
return browser_doc.createElementNS(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.namespaces.svg, "hasValidPointType" in $$ && $$.hasValidPointType(point) ? point : "use");
|
|
7735
|
-
}.bind(this)).attr("class", $LEGEND.legendItemPoint).style("fill",
|
|
7736
|
-
_newArrowCheck(this,
|
|
7901
|
+
}.bind(this)).attr("class", $LEGEND.legendItemPoint).style("fill", getLegendColor.bind($$)).style("pointer-events", $$.getStylePropValue("none")).attr("href", function (data, idx, selection) {
|
|
7902
|
+
_newArrowCheck(this, _this6);
|
|
7737
7903
|
|
|
7738
7904
|
var node = selection[idx],
|
|
7739
7905
|
nodeName = node.nodeName.toLowerCase(),
|
|
@@ -7741,49 +7907,47 @@ function getFormat($$, typeValue, v) {
|
|
|
7741
7907
|
return nodeName === "use" ? "#" + state.datetimeId + "-point" + id : undefined;
|
|
7742
7908
|
}.bind(this));
|
|
7743
7909
|
} else {
|
|
7744
|
-
l.append("line").attr("class", $LEGEND.legendItemTile).style("stroke",
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
background = legend.select("." + $LEGEND.legendBackground + " rect");
|
|
7910
|
+
l.append(isRectangle ? "line" : legendType).attr("class", $LEGEND.legendItemTile).style("stroke", getLegendColor.bind($$)).style("pointer-events", $$.getStylePropValue("none")).call(function (selection) {
|
|
7911
|
+
_newArrowCheck(this, _this6);
|
|
7749
7912
|
|
|
7750
|
-
|
|
7751
|
-
|
|
7913
|
+
if (legendType === "circle") {
|
|
7914
|
+
selection.attr("r", legendItemR).style("fill", getLegendColor.bind($$)).attr("cx", isLegendRightOrInset ? posFn.x2Tile : -200).attr("cy", isLegendRightOrInset ? -200 : posFn.yTile);
|
|
7915
|
+
} else if (isRectangle) {
|
|
7916
|
+
selection.attr("stroke-width", itemTileSize.height).attr("x1", isLegendRightOrInset ? posFn.x1Tile : -200).attr("y1", isLegendRightOrInset ? -200 : posFn.yTile).attr("x2", isLegendRightOrInset ? posFn.x2Tile : -200).attr("y2", isLegendRightOrInset ? -200 : posFn.yTile);
|
|
7917
|
+
}
|
|
7918
|
+
}.bind(this));
|
|
7752
7919
|
}
|
|
7920
|
+
},
|
|
7753
7921
|
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
_newArrowCheck(this, _this4);
|
|
7770
|
-
|
|
7771
|
-
return heights[id];
|
|
7772
|
-
}.bind(this)).attr("x", xForLegendRect).attr("y", yForLegendRect);
|
|
7922
|
+
/**
|
|
7923
|
+
* Update legend item position
|
|
7924
|
+
* @param {Array} targetIdz Data ids
|
|
7925
|
+
* @param {boolean} withTransition Whether or not to apply transition
|
|
7926
|
+
* @param {object} posFn Position functions
|
|
7927
|
+
* @private
|
|
7928
|
+
*/
|
|
7929
|
+
updateLegendItemPos: function updateLegendItemPos(targetIdz, withTransition, posFn) {
|
|
7930
|
+
var _this8 = this,
|
|
7931
|
+
$$ = this,
|
|
7932
|
+
config = $$.config,
|
|
7933
|
+
legend = $$.$el.legend,
|
|
7934
|
+
$T = $$.$T,
|
|
7935
|
+
usePoint = config.legend_usePoint,
|
|
7936
|
+
legendType = config.legend_item_tile_type;
|
|
7773
7937
|
|
|
7774
7938
|
if (usePoint) {
|
|
7775
7939
|
var tiles = legend.selectAll("." + $LEGEND.legendItemPoint).data(targetIdz);
|
|
7776
7940
|
$T(tiles, withTransition).each(function () {
|
|
7777
|
-
var
|
|
7941
|
+
var _this7 = this,
|
|
7778
7942
|
nodeName = this.nodeName.toLowerCase(),
|
|
7779
7943
|
pointR = config.point_r,
|
|
7780
7944
|
x = "x",
|
|
7781
7945
|
y = "y",
|
|
7782
7946
|
xOffset = 2,
|
|
7783
7947
|
yOffset = 2.5,
|
|
7784
|
-
radius,
|
|
7785
|
-
width,
|
|
7786
|
-
height;
|
|
7948
|
+
radius = null,
|
|
7949
|
+
width = null,
|
|
7950
|
+
height = null;
|
|
7787
7951
|
|
|
7788
7952
|
if (nodeName === "circle") {
|
|
7789
7953
|
var size = pointR * .2;
|
|
@@ -7801,29 +7965,35 @@ function getFormat($$, typeValue, v) {
|
|
|
7801
7965
|
}
|
|
7802
7966
|
|
|
7803
7967
|
(0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).attr(x, function (d) {
|
|
7804
|
-
_newArrowCheck(this,
|
|
7968
|
+
_newArrowCheck(this, _this7);
|
|
7805
7969
|
|
|
7806
|
-
return
|
|
7970
|
+
return posFn.x1Tile(d) + xOffset;
|
|
7807
7971
|
}.bind(this)).attr(y, function (d) {
|
|
7808
|
-
_newArrowCheck(this,
|
|
7972
|
+
_newArrowCheck(this, _this7);
|
|
7809
7973
|
|
|
7810
|
-
return
|
|
7974
|
+
return posFn.yTile(d) - yOffset;
|
|
7811
7975
|
}.bind(this)).attr("r", radius).attr("width", width).attr("height", height);
|
|
7812
7976
|
});
|
|
7813
7977
|
} else {
|
|
7814
|
-
var _tiles = legend.selectAll("
|
|
7978
|
+
var _tiles = legend.selectAll("." + $LEGEND.legendItemTile).data(targetIdz);
|
|
7815
7979
|
|
|
7816
|
-
$T(_tiles, withTransition).style("stroke",
|
|
7817
|
-
|
|
7980
|
+
$T(_tiles, withTransition).style("stroke", getLegendColor.bind($$)).call(function (selection) {
|
|
7981
|
+
var _this9 = this;
|
|
7818
7982
|
|
|
7819
|
-
|
|
7820
|
-
$T(background, withTransition).attr("height", $$.getLegendHeight() - 12).attr("width", maxWidth * (step + 1) + 10);
|
|
7821
|
-
} // Update all to reflect change of legend
|
|
7983
|
+
_newArrowCheck(this, _this8);
|
|
7822
7984
|
|
|
7985
|
+
if (legendType === "circle") {
|
|
7986
|
+
selection.attr("cx", function (d) {
|
|
7987
|
+
_newArrowCheck(this, _this9);
|
|
7823
7988
|
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7989
|
+
var x2 = posFn.x2Tile(d);
|
|
7990
|
+
return x2 - (x2 - posFn.x1Tile(d)) / 2;
|
|
7991
|
+
}.bind(this)).attr("cy", posFn.yTile);
|
|
7992
|
+
} else if (legendType !== "circle") {
|
|
7993
|
+
selection.attr("x1", posFn.x1Tile).attr("y1", posFn.yTile).attr("x2", posFn.x2Tile).attr("y2", posFn.yTile);
|
|
7994
|
+
}
|
|
7995
|
+
}.bind(this));
|
|
7996
|
+
}
|
|
7827
7997
|
}
|
|
7828
7998
|
});
|
|
7829
7999
|
// EXTERNAL MODULE: external {"commonjs":"d3-transition","commonjs2":"d3-transition","amd":"d3-transition","root":"d3"}
|
|
@@ -8546,6 +8716,7 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8546
8716
|
config = $$.config,
|
|
8547
8717
|
scale = $$.scale,
|
|
8548
8718
|
currScale = isSub ? scale.subX : scale.zoom || scale.x,
|
|
8719
|
+
barOverlap = config.bar_overlap,
|
|
8549
8720
|
barPadding = config.bar_padding,
|
|
8550
8721
|
sum = function (p, c) {
|
|
8551
8722
|
_newArrowCheck(this, _this5);
|
|
@@ -8566,11 +8737,12 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
|
|
|
8566
8737
|
var xPos = currScale(d.x, !0);
|
|
8567
8738
|
|
|
8568
8739
|
if (halfWidth) {
|
|
8569
|
-
|
|
8740
|
+
var offsetWidth = offset[d.id] || offset._$width;
|
|
8741
|
+
x = barOverlap ? xPos - offsetWidth / 2 : xPos - offsetWidth + offset._$total.slice(0, index + 1).reduce(sum) - halfWidth;
|
|
8570
8742
|
} else {
|
|
8571
|
-
x = xPos - (isNumber(offset) ? offset : offset._$width) * (targetsNum / 2 - index);
|
|
8743
|
+
x = xPos - (isNumber(offset) ? offset : offset._$width) * (targetsNum / 2 - (barOverlap ? 1 : index));
|
|
8572
8744
|
}
|
|
8573
|
-
} // adjust x position for bar.padding
|
|
8745
|
+
} // adjust x position for bar.padding option
|
|
8574
8746
|
|
|
8575
8747
|
|
|
8576
8748
|
if (offset && x && targetsNum > 1 && barPadding) {
|
|
@@ -11310,7 +11482,7 @@ var ChartInternal = /*#__PURE__*/function () {
|
|
|
11310
11482
|
} // Define g for chart area
|
|
11311
11483
|
|
|
11312
11484
|
|
|
11313
|
-
main.append("g").
|
|
11485
|
+
main.append("g").classed($COMMON.chart, !0).attr("clip-path", hasAxis ? state.clip.path : null);
|
|
11314
11486
|
$$.callPluginHook("$init");
|
|
11315
11487
|
|
|
11316
11488
|
if (hasAxis) {
|
|
@@ -11716,7 +11888,11 @@ function loadConfig(config) {
|
|
|
11716
11888
|
if (isDefined(read)) {
|
|
11717
11889
|
thisConfig[key] = read;
|
|
11718
11890
|
}
|
|
11719
|
-
}.bind(this));
|
|
11891
|
+
}.bind(this)); // only should run in the ChartInternal context
|
|
11892
|
+
|
|
11893
|
+
if (this.api) {
|
|
11894
|
+
this.state.orgConfig = config;
|
|
11895
|
+
}
|
|
11720
11896
|
}
|
|
11721
11897
|
;// CONCATENATED MODULE: ./src/Chart/api/chart.ts
|
|
11722
11898
|
|
|
@@ -11869,7 +12045,9 @@ function loadConfig(config) {
|
|
|
11869
12045
|
},
|
|
11870
12046
|
|
|
11871
12047
|
/**
|
|
11872
|
-
* Get or set
|
|
12048
|
+
* Get or set config option value.
|
|
12049
|
+
* - **NOTE:** for without parameter occasion
|
|
12050
|
+
* - will return all specified generation options object only. (will exclude any other options not specified at the initialization)
|
|
11873
12051
|
* @function config
|
|
11874
12052
|
* @instance
|
|
11875
12053
|
* @memberof Chart
|
|
@@ -11879,9 +12057,13 @@ function loadConfig(config) {
|
|
|
11879
12057
|
* - **NOTE:** Doesn't guarantee work in all circumstances. It can be applied for limited options only.
|
|
11880
12058
|
* @returns {*}
|
|
11881
12059
|
* @example
|
|
12060
|
+
*
|
|
11882
12061
|
* // Getter
|
|
11883
12062
|
* chart.config("gauge.max");
|
|
11884
12063
|
*
|
|
12064
|
+
* // without any arguments, it returns generation config object
|
|
12065
|
+
* chart.config(); // {data: { ... }, axis: { ... }, ...}
|
|
12066
|
+
*
|
|
11885
12067
|
* // Setter
|
|
11886
12068
|
* chart.config("gauge.max", 100);
|
|
11887
12069
|
*
|
|
@@ -11891,10 +12073,11 @@ function loadConfig(config) {
|
|
|
11891
12073
|
config: function (name, value, redraw) {
|
|
11892
12074
|
var $$ = this.internal,
|
|
11893
12075
|
config = $$.config,
|
|
12076
|
+
state = $$.state,
|
|
11894
12077
|
key = name == null ? void 0 : name.replace(/\./g, "_"),
|
|
11895
12078
|
res;
|
|
11896
12079
|
|
|
11897
|
-
if (key in config) {
|
|
12080
|
+
if (name && key in config) {
|
|
11898
12081
|
if (isDefined(value)) {
|
|
11899
12082
|
config[key] = value;
|
|
11900
12083
|
res = value;
|
|
@@ -11902,6 +12085,8 @@ function loadConfig(config) {
|
|
|
11902
12085
|
} else {
|
|
11903
12086
|
res = config[key];
|
|
11904
12087
|
}
|
|
12088
|
+
} else {
|
|
12089
|
+
res = state.orgConfig;
|
|
11905
12090
|
}
|
|
11906
12091
|
|
|
11907
12092
|
return res;
|
|
@@ -20335,42 +20520,16 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
20335
20520
|
config = $$.config;
|
|
20336
20521
|
mainLine.insert("g", "." + (config.area_front ? $CIRCLE.circles : $LINE.lines)).attr("class", $$.getClass("areas", !0));
|
|
20337
20522
|
},
|
|
20338
|
-
updateAreaGradient: function updateAreaGradient() {
|
|
20339
|
-
var _this = this,
|
|
20340
|
-
$$ = this,
|
|
20341
|
-
config = $$.config,
|
|
20342
|
-
datetimeId = $$.state.datetimeId,
|
|
20343
|
-
defs = $$.$el.defs;
|
|
20344
|
-
|
|
20345
|
-
$$.data.targets.forEach(function (d) {
|
|
20346
|
-
var _this2 = this;
|
|
20347
|
-
|
|
20348
|
-
_newArrowCheck(this, _this);
|
|
20349
|
-
|
|
20350
|
-
var id = datetimeId + "-areaGradient" + $$.getTargetSelectorSuffix(d.id);
|
|
20351
|
-
|
|
20352
|
-
if ($$.isAreaType(d) && defs.select("#" + id).empty()) {
|
|
20353
|
-
var color = $$.color(d),
|
|
20354
|
-
_config$area_linearGr = config.area_linearGradient,
|
|
20355
|
-
_config$area_linearGr2 = _config$area_linearGr.x,
|
|
20356
|
-
x = _config$area_linearGr2 === void 0 ? [0, 0] : _config$area_linearGr2,
|
|
20357
|
-
_config$area_linearGr3 = _config$area_linearGr.y,
|
|
20358
|
-
y = _config$area_linearGr3 === void 0 ? [0, 1] : _config$area_linearGr3,
|
|
20359
|
-
_config$area_linearGr4 = _config$area_linearGr.stops,
|
|
20360
|
-
stops = _config$area_linearGr4 === void 0 ? [[0, color, 1], [1, color, 0]] : _config$area_linearGr4,
|
|
20361
|
-
linearGradient = defs.append("linearGradient").attr("id", "" + id).attr("x1", x[0]).attr("x2", x[1]).attr("y1", y[0]).attr("y2", y[1]);
|
|
20362
|
-
stops.forEach(function (v) {
|
|
20363
|
-
_newArrowCheck(this, _this2);
|
|
20364
20523
|
|
|
20365
|
-
|
|
20366
|
-
|
|
20367
|
-
|
|
20368
|
-
|
|
20369
|
-
|
|
20370
|
-
|
|
20524
|
+
/**
|
|
20525
|
+
* Update area color
|
|
20526
|
+
* @param {object} d Data object
|
|
20527
|
+
* @returns {string} Color string
|
|
20528
|
+
* @private
|
|
20529
|
+
*/
|
|
20371
20530
|
updateAreaColor: function updateAreaColor(d) {
|
|
20372
20531
|
var $$ = this;
|
|
20373
|
-
return $$.config.area_linearGradient ?
|
|
20532
|
+
return $$.config.area_linearGradient ? $$.getGradienColortUrl(d.id) : $$.color(d);
|
|
20374
20533
|
},
|
|
20375
20534
|
|
|
20376
20535
|
/**
|
|
@@ -20390,7 +20549,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
20390
20549
|
$el = $$.$el,
|
|
20391
20550
|
$T = $$.$T,
|
|
20392
20551
|
$root = isSub ? $el.subchart : $el;
|
|
20393
|
-
config.area_linearGradient && $$.
|
|
20552
|
+
config.area_linearGradient && $$.updateLinearGradient();
|
|
20394
20553
|
var area = $root.main.selectAll("." + $AREA.areas).selectAll("." + $AREA.area).data($$.lineData.bind($$));
|
|
20395
20554
|
$T(area.exit(), withTransition).style("opacity", "0").remove();
|
|
20396
20555
|
$root.area = area.enter().append("path").attr("class", $$.getClass("area", !0)).style("fill", $$.updateAreaColor.bind($$)).style("opacity", function () {
|
|
@@ -20408,7 +20567,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
20408
20567
|
* @returns {Array}
|
|
20409
20568
|
*/
|
|
20410
20569
|
redrawArea: function redrawArea(drawFn, withTransition, isSub) {
|
|
20411
|
-
var
|
|
20570
|
+
var _this = this;
|
|
20412
20571
|
|
|
20413
20572
|
if (isSub === void 0) {
|
|
20414
20573
|
isSub = !1;
|
|
@@ -20420,7 +20579,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
20420
20579
|
orgAreaOpacity = $$.state.orgAreaOpacity;
|
|
20421
20580
|
|
|
20422
20581
|
return [$$.$T(area, withTransition, getRandom()).attr("d", drawFn).style("fill", $$.updateAreaColor.bind($$)).style("opacity", function (d) {
|
|
20423
|
-
_newArrowCheck(this,
|
|
20582
|
+
_newArrowCheck(this, _this);
|
|
20424
20583
|
|
|
20425
20584
|
return ($$.isAreaRangeType(d) ? orgAreaOpacity / 1.75 : orgAreaOpacity) + "";
|
|
20426
20585
|
}.bind(this))];
|
|
@@ -20434,7 +20593,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
20434
20593
|
* @private
|
|
20435
20594
|
*/
|
|
20436
20595
|
generateDrawArea: function generateDrawArea(areaIndices, isSub) {
|
|
20437
|
-
var
|
|
20596
|
+
var _this2 = this,
|
|
20438
20597
|
$$ = this,
|
|
20439
20598
|
config = $$.config,
|
|
20440
20599
|
lineConnectNull = config.line_connectNull,
|
|
@@ -20442,25 +20601,25 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
20442
20601
|
getPoints = $$.generateGetAreaPoints(areaIndices, isSub),
|
|
20443
20602
|
yScale = $$.getYScaleById.bind($$),
|
|
20444
20603
|
xValue = function (d) {
|
|
20445
|
-
_newArrowCheck(this,
|
|
20604
|
+
_newArrowCheck(this, _this2);
|
|
20446
20605
|
|
|
20447
20606
|
return (isSub ? $$.subxx : $$.xx).call($$, d);
|
|
20448
20607
|
}.bind(this),
|
|
20449
20608
|
value0 = function (d, i) {
|
|
20450
|
-
_newArrowCheck(this,
|
|
20609
|
+
_newArrowCheck(this, _this2);
|
|
20451
20610
|
|
|
20452
20611
|
return $$.isGrouped(d.id) ? getPoints(d, i)[0][1] : yScale(d.id, isSub)($$.isAreaRangeType(d) ? $$.getRangedData(d, "high") : $$.getShapeYMin(d.id));
|
|
20453
20612
|
}.bind(this),
|
|
20454
20613
|
value1 = function (d, i) {
|
|
20455
|
-
_newArrowCheck(this,
|
|
20614
|
+
_newArrowCheck(this, _this2);
|
|
20456
20615
|
|
|
20457
20616
|
return $$.isGrouped(d.id) ? getPoints(d, i)[1][1] : yScale(d.id, isSub)($$.isAreaRangeType(d) ? $$.getRangedData(d, "low") : d.value);
|
|
20458
20617
|
}.bind(this);
|
|
20459
20618
|
|
|
20460
20619
|
return function (d) {
|
|
20461
|
-
var
|
|
20620
|
+
var _this3 = this;
|
|
20462
20621
|
|
|
20463
|
-
_newArrowCheck(this,
|
|
20622
|
+
_newArrowCheck(this, _this2);
|
|
20464
20623
|
|
|
20465
20624
|
var values = lineConnectNull ? $$.filterRemoveNull(d.values) : d.values,
|
|
20466
20625
|
x0 = 0,
|
|
@@ -20473,7 +20632,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
20473
20632
|
|
|
20474
20633
|
if (!lineConnectNull) {
|
|
20475
20634
|
area = area.defined(function (d) {
|
|
20476
|
-
_newArrowCheck(this,
|
|
20635
|
+
_newArrowCheck(this, _this3);
|
|
20477
20636
|
|
|
20478
20637
|
return $$.getBaseValue(d) !== null;
|
|
20479
20638
|
}.bind(this));
|
|
@@ -20596,14 +20755,28 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
20596
20755
|
}
|
|
20597
20756
|
|
|
20598
20757
|
var $$ = this,
|
|
20758
|
+
config = $$.config,
|
|
20599
20759
|
$el = $$.$el,
|
|
20600
20760
|
$T = $$.$T,
|
|
20601
20761
|
$root = isSub ? $el.subchart : $el,
|
|
20602
20762
|
classBar = $$.getClass("bar", !0),
|
|
20603
|
-
initialOpacity = $$.initialOpacity.bind($$)
|
|
20604
|
-
|
|
20763
|
+
initialOpacity = $$.initialOpacity.bind($$);
|
|
20764
|
+
config.bar_linearGradient && $$.updateLinearGradient();
|
|
20765
|
+
var bar = $root.main.selectAll("." + $BAR.bars).selectAll("." + $BAR.bar).data($$.labelishData.bind($$));
|
|
20605
20766
|
$T(bar.exit(), withTransition).style("opacity", "0").remove();
|
|
20606
|
-
$root.bar = bar.enter().append("path").attr("class", classBar).style("fill", $$.
|
|
20767
|
+
$root.bar = bar.enter().append("path").attr("class", classBar).style("fill", $$.updateBarColor.bind($$)).merge(bar).style("opacity", initialOpacity);
|
|
20768
|
+
},
|
|
20769
|
+
|
|
20770
|
+
/**
|
|
20771
|
+
* Update bar color
|
|
20772
|
+
* @param {object} d Data object
|
|
20773
|
+
* @returns {string} Color string
|
|
20774
|
+
* @private
|
|
20775
|
+
*/
|
|
20776
|
+
updateBarColor: function updateBarColor(d) {
|
|
20777
|
+
var $$ = this,
|
|
20778
|
+
fn = $$.getStylePropValue($$.color);
|
|
20779
|
+
return $$.config.bar_linearGradient ? $$.getGradienColortUrl(d.id) : fn ? fn(d) : null;
|
|
20607
20780
|
},
|
|
20608
20781
|
|
|
20609
20782
|
/**
|
|
@@ -20612,6 +20785,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
20612
20785
|
* @param {boolean} withTransition With or without transition
|
|
20613
20786
|
* @param {boolean} isSub Subchart draw
|
|
20614
20787
|
* @returns {Array}
|
|
20788
|
+
* @private
|
|
20615
20789
|
*/
|
|
20616
20790
|
redrawBar: function redrawBar(drawFn, withTransition, isSub) {
|
|
20617
20791
|
var _this3 = this;
|
|
@@ -20628,7 +20802,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
20628
20802
|
_newArrowCheck(this, _this3);
|
|
20629
20803
|
|
|
20630
20804
|
return (isNumber(d.value) || $$.isBarRangeType(d)) && drawFn(d);
|
|
20631
|
-
}.bind(this)).style("fill", $$.
|
|
20805
|
+
}.bind(this)).style("fill", $$.updateBarColor.bind($$)).style("opacity", null)];
|
|
20632
20806
|
},
|
|
20633
20807
|
|
|
20634
20808
|
/**
|
|
@@ -22917,6 +23091,12 @@ var cacheKey = KEY.radarPoints;
|
|
|
22917
23091
|
* @property {object} bar Bar object
|
|
22918
23092
|
* @property {number} [bar.indices.removeNull=false] Remove nullish data on bar indices positions.
|
|
22919
23093
|
* @property {number} [bar.label.threshold=0] Set threshold ratio to show/hide labels.
|
|
23094
|
+
* @property {boolean|object} [bar.linearGradient=false] Set the linear gradient on bar.<br><br>
|
|
23095
|
+
* Or customize by giving below object value:
|
|
23096
|
+
* - x {Array}: `x1`, `x2` value
|
|
23097
|
+
* - y {Array}: `y1`, `y2` value
|
|
23098
|
+
* - stops {Array}: Each item should be having `[offset, stop-color, stop-opacity]` values.
|
|
23099
|
+
* @property {boolean} [bar.overlap=false] Bars will be rendered at same position, which will be overlapped each other. (for non-grouped bars only)
|
|
22920
23100
|
* @property {number} [bar.padding=0] The padding pixel value between each bar.
|
|
22921
23101
|
* @property {number} [bar.radius] Set the radius of bar edge in pixel.
|
|
22922
23102
|
* @property {number} [bar.radius.ratio] Set the radius ratio of bar edge in relative the bar's width.
|
|
@@ -22932,6 +23112,7 @@ var cacheKey = KEY.radarPoints;
|
|
|
22932
23112
|
* @property {number} [bar.width.dataname.max] The maximum width value for ratio.
|
|
22933
23113
|
* @property {boolean} [bar.zerobased=true] Set if min or max value will be 0 on bar chart.
|
|
22934
23114
|
* @see [Demo: bar indices](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarIndices)
|
|
23115
|
+
* @see [Demo: bar overlap](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarOverlap)
|
|
22935
23116
|
* @see [Demo: bar padding](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarPadding)
|
|
22936
23117
|
* @see [Demo: bar radius](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarRadius)
|
|
22937
23118
|
* @see [Demo: bar width](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarWidth)
|
|
@@ -22943,6 +23124,33 @@ var cacheKey = KEY.radarPoints;
|
|
|
22943
23124
|
* removeNull: true
|
|
22944
23125
|
* },
|
|
22945
23126
|
*
|
|
23127
|
+
* // will generate follwing linearGradient:
|
|
23128
|
+
* // <linearGradient x1="0" x2="0" y1="0" y2="1">
|
|
23129
|
+
* // <stop offset="0" stop-color="$DATA_COLOR" stop-opacity="1"></stop>
|
|
23130
|
+
* // <stop offset="1" stop-color="$DATA_COLOR" stop-opacity="0"></stop>
|
|
23131
|
+
* // </linearGradient>
|
|
23132
|
+
* linearGradient: true,
|
|
23133
|
+
*
|
|
23134
|
+
* // Or customized gradient
|
|
23135
|
+
* linearGradient: {
|
|
23136
|
+
* x: [0, 0], // x1, x2 attributes
|
|
23137
|
+
* y: [0, 0], // y1, y2 attributes
|
|
23138
|
+
* stops: [
|
|
23139
|
+
* // offset, stop-color, stop-opacity
|
|
23140
|
+
* [0, "#7cb5ec", 1],
|
|
23141
|
+
*
|
|
23142
|
+
* // setting 'null' for stop-color, will set its original data color
|
|
23143
|
+
* [0.5, null, 0],
|
|
23144
|
+
*
|
|
23145
|
+
* // setting 'function' for stop-color, will pass data id as argument.
|
|
23146
|
+
* // It should return color string or null value
|
|
23147
|
+
* [1, function(id) { return id === "data1" ? "red" : "blue"; }, 0],
|
|
23148
|
+
* ]
|
|
23149
|
+
* },
|
|
23150
|
+
*
|
|
23151
|
+
* // remove nullish da
|
|
23152
|
+
* overlap: true,
|
|
23153
|
+
*
|
|
22946
23154
|
* padding: 1,
|
|
22947
23155
|
*
|
|
22948
23156
|
* // bar radius
|
|
@@ -22982,7 +23190,9 @@ var cacheKey = KEY.radarPoints;
|
|
|
22982
23190
|
* }
|
|
22983
23191
|
*/
|
|
22984
23192
|
bar_label_threshold: 0,
|
|
23193
|
+
bar_linearGradient: !1,
|
|
22985
23194
|
bar_indices_removeNull: !1,
|
|
23195
|
+
bar_overlap: !1,
|
|
22986
23196
|
bar_padding: 0,
|
|
22987
23197
|
bar_radius: undefined,
|
|
22988
23198
|
bar_radius_ratio: undefined,
|
|
@@ -25965,7 +26175,7 @@ var _defaults = {},
|
|
|
25965
26175
|
* bb.version; // "1.0.0"
|
|
25966
26176
|
* @memberof bb
|
|
25967
26177
|
*/
|
|
25968
|
-
version: "3.6.0
|
|
26178
|
+
version: "3.6.0",
|
|
25969
26179
|
|
|
25970
26180
|
/**
|
|
25971
26181
|
* Generate chart
|
|
@@ -26100,7 +26310,7 @@ var _defaults = {},
|
|
|
26100
26310
|
};
|
|
26101
26311
|
/**
|
|
26102
26312
|
* @namespace bb
|
|
26103
|
-
* @version 3.6.0
|
|
26313
|
+
* @version 3.6.0
|
|
26104
26314
|
*/
|
|
26105
26315
|
;// CONCATENATED MODULE: ./src/index.ts
|
|
26106
26316
|
|