billboard.js 3.6.0-next.2 → 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 +424 -237
- package/dist/billboard.min.css +1 -1
- package/dist/billboard.min.js +2 -2
- package/dist/billboard.pkgd.js +538 -351
- package/dist/billboard.pkgd.min.js +2 -2
- 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 +2 -2
- package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.js +2 -2
- package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
- package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +116 -116
- package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +116 -116
- package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +116 -116
- package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +116 -116
- package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +116 -116
- 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 +342 -168
- package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
- package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
- package/package.json +5 -5
- 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 +23 -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')
|
|
@@ -3319,9 +3319,15 @@ var data_this = undefined;
|
|
|
3319
3319
|
* @property {Function} [legend.item.onclick=undefined] Set click event handler to the legend item.
|
|
3320
3320
|
* @property {Function} [legend.item.onover=undefined] Set mouse/touch over event handler to the legend item.
|
|
3321
3321
|
* @property {Function} [legend.item.onout=undefined] Set mouse/touch out event handler to the legend item.
|
|
3322
|
-
* @property {number} [legend.item.tile.width=10] Set width
|
|
3323
|
-
* @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
|
|
3324
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)
|
|
3325
3331
|
* @see [Demo: position](https://naver.github.io/billboard.js/demo/#Legend.LegendPosition)
|
|
3326
3332
|
* @see [Demo: contents.template](https://naver.github.io/billboard.js/demo/#Legend.LegendTemplate1)
|
|
3327
3333
|
* @see [Demo: usePoint](https://naver.github.io/billboard.js/demo/#Legend.usePoint)
|
|
@@ -3361,8 +3367,15 @@ var data_this = undefined;
|
|
|
3361
3367
|
*
|
|
3362
3368
|
* // set tile's size
|
|
3363
3369
|
* tile: {
|
|
3364
|
-
*
|
|
3370
|
+
* // set tile type
|
|
3371
|
+
* type: "circle" // or "rectangle" (default)
|
|
3372
|
+
*
|
|
3373
|
+
* // width & height, are only applicable for 'rectangle' legend type
|
|
3374
|
+
* width: 15,
|
|
3365
3375
|
* height: 15
|
|
3376
|
+
*
|
|
3377
|
+
* // radis is only applicable for 'circle' legend type
|
|
3378
|
+
* r: 10
|
|
3366
3379
|
* }
|
|
3367
3380
|
* },
|
|
3368
3381
|
* usePoint: true
|
|
@@ -3384,6 +3397,8 @@ var data_this = undefined;
|
|
|
3384
3397
|
legend_padding: 0,
|
|
3385
3398
|
legend_item_tile_width: 10,
|
|
3386
3399
|
legend_item_tile_height: 10,
|
|
3400
|
+
legend_item_tile_r: 5,
|
|
3401
|
+
legend_item_tile_type: "rectangle",
|
|
3387
3402
|
legend_usePoint: !1
|
|
3388
3403
|
});
|
|
3389
3404
|
;// CONCATENATED MODULE: ./src/config/Options/common/title.ts
|
|
@@ -6505,6 +6520,57 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6505
6520
|
}
|
|
6506
6521
|
},
|
|
6507
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
|
+
|
|
6508
6574
|
/**
|
|
6509
6575
|
* Set the data over color.
|
|
6510
6576
|
* When is out, will restate in its previous color value
|
|
@@ -6513,7 +6579,7 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6513
6579
|
* @private
|
|
6514
6580
|
*/
|
|
6515
6581
|
setOverColor: function setOverColor(isOver, d) {
|
|
6516
|
-
var
|
|
6582
|
+
var _this7 = this,
|
|
6517
6583
|
$$ = this,
|
|
6518
6584
|
config = $$.config,
|
|
6519
6585
|
main = $$.$el.main,
|
|
@@ -6524,13 +6590,13 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
|
|
|
6524
6590
|
color = function (_ref) {
|
|
6525
6591
|
var id = _ref.id;
|
|
6526
6592
|
|
|
6527
|
-
_newArrowCheck(this,
|
|
6593
|
+
_newArrowCheck(this, _this7);
|
|
6528
6594
|
|
|
6529
6595
|
return id in onover ? onover[id] : $$.color(id);
|
|
6530
6596
|
}.bind(this);
|
|
6531
6597
|
} else if (isString(color)) {
|
|
6532
6598
|
color = function () {
|
|
6533
|
-
_newArrowCheck(this,
|
|
6599
|
+
_newArrowCheck(this, _this7);
|
|
6534
6600
|
|
|
6535
6601
|
return onover;
|
|
6536
6602
|
}.bind(this);
|
|
@@ -7098,6 +7164,20 @@ function getFormat($$, typeValue, v) {
|
|
|
7098
7164
|
|
|
7099
7165
|
|
|
7100
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
|
+
|
|
7101
7181
|
/* harmony default export */ var internals_legend = ({
|
|
7102
7182
|
/**
|
|
7103
7183
|
* Initialize the legend.
|
|
@@ -7517,96 +7597,248 @@ function getFormat($$, typeValue, v) {
|
|
|
7517
7597
|
state = $$.state,
|
|
7518
7598
|
legend = $$.$el.legend,
|
|
7519
7599
|
$T = $$.$T,
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
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
|
+
},
|
|
7523
7628
|
xForLegend,
|
|
7524
7629
|
yForLegend,
|
|
7525
|
-
totalLength = 0,
|
|
7526
|
-
offsets = {},
|
|
7527
|
-
widths = {},
|
|
7528
|
-
heights = {},
|
|
7529
|
-
margins = [0],
|
|
7530
|
-
steps = {},
|
|
7531
|
-
step = 0,
|
|
7532
7630
|
background,
|
|
7533
|
-
isLegendRightOrInset = state.isLegendRight || state.isLegendInset,
|
|
7534
7631
|
targetIdz = targetIds.filter(function (id) {
|
|
7535
7632
|
_newArrowCheck(this, _this4);
|
|
7536
7633
|
|
|
7537
7634
|
return !isDefined(config.data_names[id]) || config.data_names[id] !== null;
|
|
7538
7635
|
}.bind(this)),
|
|
7539
7636
|
withTransition = options.withTransition,
|
|
7540
|
-
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) {
|
|
7541
7773
|
var _this5 = this,
|
|
7542
7774
|
isLast = index === targetIdz.length - 1,
|
|
7543
7775
|
box = $$.getLegendItemTextBox(id, textElement),
|
|
7544
|
-
itemWidth = box.width + tileWidth + (isLast && !isLegendRightOrInset ? 0 :
|
|
7545
|
-
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,
|
|
7546
7778
|
itemLength = isLegendRightOrInset ? itemHeight : itemWidth,
|
|
7547
7779
|
areaLength = isLegendRightOrInset ? $$.getLegendHeight() : $$.getLegendWidth(),
|
|
7548
7780
|
margin,
|
|
7549
7781
|
updateValues = function (id2, withoutStep) {
|
|
7550
7782
|
if (!withoutStep) {
|
|
7551
|
-
margin = (areaLength - totalLength - itemLength) / 2;
|
|
7783
|
+
margin = (areaLength - dimension.totalLength - itemLength) / 2;
|
|
7552
7784
|
|
|
7553
|
-
if (margin <
|
|
7785
|
+
if (margin < dimension.posMin) {
|
|
7554
7786
|
margin = (areaLength - itemLength) / 2;
|
|
7555
|
-
totalLength = 0;
|
|
7556
|
-
step++;
|
|
7787
|
+
dimension.totalLength = 0;
|
|
7788
|
+
dimension.step++;
|
|
7557
7789
|
}
|
|
7558
7790
|
}
|
|
7559
7791
|
|
|
7560
|
-
steps[id2] = step;
|
|
7561
|
-
margins[step] = state.isLegendInset ? 10 : margin;
|
|
7562
|
-
offsets[id2] = totalLength;
|
|
7563
|
-
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;
|
|
7564
7796
|
};
|
|
7565
7797
|
|
|
7566
7798
|
if (index === 0) {
|
|
7567
|
-
totalLength = 0;
|
|
7568
|
-
step = 0;
|
|
7569
|
-
|
|
7570
|
-
|
|
7799
|
+
dimension.totalLength = 0;
|
|
7800
|
+
dimension.step = 0;
|
|
7801
|
+
dimension.max.width = 0;
|
|
7802
|
+
dimension.max.height = 0;
|
|
7571
7803
|
}
|
|
7572
7804
|
|
|
7573
7805
|
if (config.legend_show && !$$.isLegendToShow(id)) {
|
|
7574
|
-
widths[id] = 0;
|
|
7575
|
-
heights[id] = 0;
|
|
7576
|
-
steps[id] = 0;
|
|
7577
|
-
offsets[id] = 0;
|
|
7806
|
+
sizes.widths[id] = 0;
|
|
7807
|
+
sizes.heights[id] = 0;
|
|
7808
|
+
sizes.steps[id] = 0;
|
|
7809
|
+
sizes.offsets[id] = 0;
|
|
7578
7810
|
return;
|
|
7579
7811
|
}
|
|
7580
7812
|
|
|
7581
|
-
widths[id] = itemWidth;
|
|
7582
|
-
heights[id] = itemHeight;
|
|
7813
|
+
sizes.widths[id] = itemWidth;
|
|
7814
|
+
sizes.heights[id] = itemHeight;
|
|
7583
7815
|
|
|
7584
|
-
if (!
|
|
7585
|
-
|
|
7816
|
+
if (!dimension.max.width || itemWidth >= dimension.max.width) {
|
|
7817
|
+
dimension.max.width = itemWidth;
|
|
7586
7818
|
}
|
|
7587
7819
|
|
|
7588
|
-
if (!
|
|
7589
|
-
|
|
7820
|
+
if (!dimension.max.height || itemHeight >= dimension.max.height) {
|
|
7821
|
+
dimension.max.height = itemHeight;
|
|
7590
7822
|
}
|
|
7591
7823
|
|
|
7592
|
-
var maxLength = isLegendRightOrInset ?
|
|
7824
|
+
var maxLength = isLegendRightOrInset ? dimension.max.height : dimension.max.width;
|
|
7593
7825
|
|
|
7594
7826
|
if (config.legend_equally) {
|
|
7595
|
-
Object.keys(widths).forEach(function (id2) {
|
|
7827
|
+
Object.keys(sizes.widths).forEach(function (id2) {
|
|
7596
7828
|
_newArrowCheck(this, _this5);
|
|
7597
7829
|
|
|
7598
|
-
return widths[id2] =
|
|
7830
|
+
return sizes.widths[id2] = dimension.max.width;
|
|
7599
7831
|
}.bind(this));
|
|
7600
|
-
Object.keys(heights).forEach(function (id2) {
|
|
7832
|
+
Object.keys(sizes.heights).forEach(function (id2) {
|
|
7601
7833
|
_newArrowCheck(this, _this5);
|
|
7602
7834
|
|
|
7603
|
-
return heights[id2] =
|
|
7835
|
+
return sizes.heights[id2] = dimension.max.height;
|
|
7604
7836
|
}.bind(this));
|
|
7605
7837
|
margin = (areaLength - maxLength * targetIdz.length) / 2;
|
|
7606
7838
|
|
|
7607
|
-
if (margin <
|
|
7608
|
-
totalLength = 0;
|
|
7609
|
-
step = 0;
|
|
7839
|
+
if (margin < dimension.posMin) {
|
|
7840
|
+
dimension.totalLength = 0;
|
|
7841
|
+
dimension.step = 0;
|
|
7610
7842
|
targetIdz.forEach(function (id2) {
|
|
7611
7843
|
_newArrowCheck(this, _this5);
|
|
7612
7844
|
|
|
@@ -7619,111 +7851,43 @@ function getFormat($$, typeValue, v) {
|
|
|
7619
7851
|
updateValues(id);
|
|
7620
7852
|
}
|
|
7621
7853
|
};
|
|
7854
|
+
},
|
|
7622
7855
|
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
_newArrowCheck(this, _this4);
|
|
7643
|
-
|
|
7644
|
-
return maxWidth * steps[id] + 10;
|
|
7645
|
-
}.bind(this);
|
|
7646
|
-
|
|
7647
|
-
yForLegend = function (id) {
|
|
7648
|
-
_newArrowCheck(this, _this4);
|
|
7649
|
-
|
|
7650
|
-
return margins[steps[id]] + offsets[id];
|
|
7651
|
-
}.bind(this);
|
|
7652
|
-
} else {
|
|
7653
|
-
xForLegend = function (id) {
|
|
7654
|
-
_newArrowCheck(this, _this4);
|
|
7655
|
-
|
|
7656
|
-
return margins[steps[id]] + offsets[id];
|
|
7657
|
-
}.bind(this);
|
|
7658
|
-
|
|
7659
|
-
yForLegend = function (id) {
|
|
7660
|
-
_newArrowCheck(this, _this4);
|
|
7661
|
-
|
|
7662
|
-
return maxHeight * steps[id];
|
|
7663
|
-
}.bind(this);
|
|
7664
|
-
}
|
|
7665
|
-
|
|
7666
|
-
var xForLegendText = function (id, i) {
|
|
7667
|
-
_newArrowCheck(this, _this4);
|
|
7668
|
-
|
|
7669
|
-
return xForLegend(id, i) + 4 + config.legend_item_tile_width;
|
|
7670
|
-
}.bind(this),
|
|
7671
|
-
xForLegendRect = function (id, i) {
|
|
7672
|
-
_newArrowCheck(this, _this4);
|
|
7673
|
-
|
|
7674
|
-
return xForLegend(id, i);
|
|
7675
|
-
}.bind(this),
|
|
7676
|
-
x1ForLegendTile = function (id, i) {
|
|
7677
|
-
_newArrowCheck(this, _this4);
|
|
7678
|
-
|
|
7679
|
-
return xForLegend(id, i) - 2;
|
|
7680
|
-
}.bind(this),
|
|
7681
|
-
x2ForLegendTile = function (id, i) {
|
|
7682
|
-
_newArrowCheck(this, _this4);
|
|
7683
|
-
|
|
7684
|
-
return xForLegend(id, i) - 2 + config.legend_item_tile_width;
|
|
7685
|
-
}.bind(this),
|
|
7686
|
-
yForLegendText = function (id, i) {
|
|
7687
|
-
_newArrowCheck(this, _this4);
|
|
7688
|
-
|
|
7689
|
-
return yForLegend(id, i) + 9;
|
|
7690
|
-
}.bind(this),
|
|
7691
|
-
yForLegendRect = function (id, i) {
|
|
7692
|
-
_newArrowCheck(this, _this4);
|
|
7693
|
-
|
|
7694
|
-
return yForLegend(id, i) - 5;
|
|
7695
|
-
}.bind(this),
|
|
7696
|
-
yForLegendTile = function (id, i) {
|
|
7697
|
-
_newArrowCheck(this, _this4);
|
|
7698
|
-
|
|
7699
|
-
return yForLegend(id, i) + 4;
|
|
7700
|
-
}.bind(this),
|
|
7701
|
-
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,
|
|
7702
7875
|
l = legend.selectAll("." + $LEGEND.legendItem).data(targetIdz).enter().append("g");
|
|
7703
7876
|
|
|
7704
7877
|
$$.setLegendItem(l);
|
|
7705
7878
|
l.append("text").text(function (id) {
|
|
7706
|
-
_newArrowCheck(this,
|
|
7879
|
+
_newArrowCheck(this, _this6);
|
|
7707
7880
|
|
|
7708
7881
|
return isDefined(config.data_names[id]) ? config.data_names[id] : id;
|
|
7709
7882
|
}.bind(this)).each(function (id, i) {
|
|
7710
7883
|
updatePositions(this, id, i);
|
|
7711
|
-
}).style("pointer-events", $$.getStylePropValue("none")).attr("x", isLegendRightOrInset ?
|
|
7712
|
-
l.append("rect").attr("class", $LEGEND.legendItemEvent).style("fill-opacity", $$.getStylePropValue("0")).attr("x", isLegendRightOrInset ?
|
|
7713
|
-
|
|
7714
|
-
var getColor = function (id) {
|
|
7715
|
-
_newArrowCheck(this, _this4);
|
|
7716
|
-
|
|
7717
|
-
var data = $$.getDataById(id),
|
|
7718
|
-
color = $$.levelColor ? $$.levelColor(data.values[0].value) : $$.color(data);
|
|
7719
|
-
return color;
|
|
7720
|
-
}.bind(this),
|
|
7721
|
-
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);
|
|
7722
7886
|
|
|
7723
7887
|
if (usePoint) {
|
|
7724
7888
|
var _ids = [];
|
|
7725
7889
|
l.append(function (d) {
|
|
7726
|
-
_newArrowCheck(this,
|
|
7890
|
+
_newArrowCheck(this, _this6);
|
|
7727
7891
|
|
|
7728
7892
|
var pattern = notEmpty(config.point_pattern) ? config.point_pattern : [config.point_type];
|
|
7729
7893
|
_ids.indexOf(d) === -1 && _ids.push(d);
|
|
@@ -7734,8 +7898,8 @@ function getFormat($$, typeValue, v) {
|
|
|
7734
7898
|
}
|
|
7735
7899
|
|
|
7736
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");
|
|
7737
|
-
}.bind(this)).attr("class", $LEGEND.legendItemPoint).style("fill",
|
|
7738
|
-
_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);
|
|
7739
7903
|
|
|
7740
7904
|
var node = selection[idx],
|
|
7741
7905
|
nodeName = node.nodeName.toLowerCase(),
|
|
@@ -7743,49 +7907,47 @@ function getFormat($$, typeValue, v) {
|
|
|
7743
7907
|
return nodeName === "use" ? "#" + state.datetimeId + "-point" + id : undefined;
|
|
7744
7908
|
}.bind(this));
|
|
7745
7909
|
} else {
|
|
7746
|
-
l.append("line").attr("class", $LEGEND.legendItemTile).style("stroke",
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
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);
|
|
7751
7912
|
|
|
7752
|
-
|
|
7753
|
-
|
|
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));
|
|
7754
7919
|
}
|
|
7920
|
+
},
|
|
7755
7921
|
|
|
7756
|
-
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
|
|
7762
|
-
|
|
7763
|
-
|
|
7764
|
-
|
|
7765
|
-
|
|
7766
|
-
|
|
7767
|
-
|
|
7768
|
-
|
|
7769
|
-
|
|
7770
|
-
|
|
7771
|
-
_newArrowCheck(this, _this4);
|
|
7772
|
-
|
|
7773
|
-
return heights[id];
|
|
7774
|
-
}.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;
|
|
7775
7937
|
|
|
7776
7938
|
if (usePoint) {
|
|
7777
7939
|
var tiles = legend.selectAll("." + $LEGEND.legendItemPoint).data(targetIdz);
|
|
7778
7940
|
$T(tiles, withTransition).each(function () {
|
|
7779
|
-
var
|
|
7941
|
+
var _this7 = this,
|
|
7780
7942
|
nodeName = this.nodeName.toLowerCase(),
|
|
7781
7943
|
pointR = config.point_r,
|
|
7782
7944
|
x = "x",
|
|
7783
7945
|
y = "y",
|
|
7784
7946
|
xOffset = 2,
|
|
7785
7947
|
yOffset = 2.5,
|
|
7786
|
-
radius,
|
|
7787
|
-
width,
|
|
7788
|
-
height;
|
|
7948
|
+
radius = null,
|
|
7949
|
+
width = null,
|
|
7950
|
+
height = null;
|
|
7789
7951
|
|
|
7790
7952
|
if (nodeName === "circle") {
|
|
7791
7953
|
var size = pointR * .2;
|
|
@@ -7803,29 +7965,35 @@ function getFormat($$, typeValue, v) {
|
|
|
7803
7965
|
}
|
|
7804
7966
|
|
|
7805
7967
|
(0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this).attr(x, function (d) {
|
|
7806
|
-
_newArrowCheck(this,
|
|
7968
|
+
_newArrowCheck(this, _this7);
|
|
7807
7969
|
|
|
7808
|
-
return
|
|
7970
|
+
return posFn.x1Tile(d) + xOffset;
|
|
7809
7971
|
}.bind(this)).attr(y, function (d) {
|
|
7810
|
-
_newArrowCheck(this,
|
|
7972
|
+
_newArrowCheck(this, _this7);
|
|
7811
7973
|
|
|
7812
|
-
return
|
|
7974
|
+
return posFn.yTile(d) - yOffset;
|
|
7813
7975
|
}.bind(this)).attr("r", radius).attr("width", width).attr("height", height);
|
|
7814
7976
|
});
|
|
7815
7977
|
} else {
|
|
7816
|
-
var _tiles = legend.selectAll("
|
|
7978
|
+
var _tiles = legend.selectAll("." + $LEGEND.legendItemTile).data(targetIdz);
|
|
7817
7979
|
|
|
7818
|
-
$T(_tiles, withTransition).style("stroke",
|
|
7819
|
-
|
|
7980
|
+
$T(_tiles, withTransition).style("stroke", getLegendColor.bind($$)).call(function (selection) {
|
|
7981
|
+
var _this9 = this;
|
|
7820
7982
|
|
|
7821
|
-
|
|
7822
|
-
$T(background, withTransition).attr("height", $$.getLegendHeight() - 12).attr("width", maxWidth * (step + 1) + 10);
|
|
7823
|
-
} // Update all to reflect change of legend
|
|
7983
|
+
_newArrowCheck(this, _this8);
|
|
7824
7984
|
|
|
7985
|
+
if (legendType === "circle") {
|
|
7986
|
+
selection.attr("cx", function (d) {
|
|
7987
|
+
_newArrowCheck(this, _this9);
|
|
7825
7988
|
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
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
|
+
}
|
|
7829
7997
|
}
|
|
7830
7998
|
});
|
|
7831
7999
|
// EXTERNAL MODULE: external {"commonjs":"d3-transition","commonjs2":"d3-transition","amd":"d3-transition","root":"d3"}
|
|
@@ -20352,42 +20520,16 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
20352
20520
|
config = $$.config;
|
|
20353
20521
|
mainLine.insert("g", "." + (config.area_front ? $CIRCLE.circles : $LINE.lines)).attr("class", $$.getClass("areas", !0));
|
|
20354
20522
|
},
|
|
20355
|
-
updateAreaGradient: function updateAreaGradient() {
|
|
20356
|
-
var _this = this,
|
|
20357
|
-
$$ = this,
|
|
20358
|
-
config = $$.config,
|
|
20359
|
-
datetimeId = $$.state.datetimeId,
|
|
20360
|
-
defs = $$.$el.defs;
|
|
20361
|
-
|
|
20362
|
-
$$.data.targets.forEach(function (d) {
|
|
20363
|
-
var _this2 = this;
|
|
20364
|
-
|
|
20365
|
-
_newArrowCheck(this, _this);
|
|
20366
|
-
|
|
20367
|
-
var id = datetimeId + "-areaGradient" + $$.getTargetSelectorSuffix(d.id);
|
|
20368
|
-
|
|
20369
|
-
if ($$.isAreaType(d) && defs.select("#" + id).empty()) {
|
|
20370
|
-
var color = $$.color(d),
|
|
20371
|
-
_config$area_linearGr = config.area_linearGradient,
|
|
20372
|
-
_config$area_linearGr2 = _config$area_linearGr.x,
|
|
20373
|
-
x = _config$area_linearGr2 === void 0 ? [0, 0] : _config$area_linearGr2,
|
|
20374
|
-
_config$area_linearGr3 = _config$area_linearGr.y,
|
|
20375
|
-
y = _config$area_linearGr3 === void 0 ? [0, 1] : _config$area_linearGr3,
|
|
20376
|
-
_config$area_linearGr4 = _config$area_linearGr.stops,
|
|
20377
|
-
stops = _config$area_linearGr4 === void 0 ? [[0, color, 1], [1, color, 0]] : _config$area_linearGr4,
|
|
20378
|
-
linearGradient = defs.append("linearGradient").attr("id", "" + id).attr("x1", x[0]).attr("x2", x[1]).attr("y1", y[0]).attr("y2", y[1]);
|
|
20379
|
-
stops.forEach(function (v) {
|
|
20380
|
-
_newArrowCheck(this, _this2);
|
|
20381
20523
|
|
|
20382
|
-
|
|
20383
|
-
|
|
20384
|
-
|
|
20385
|
-
|
|
20386
|
-
|
|
20387
|
-
|
|
20524
|
+
/**
|
|
20525
|
+
* Update area color
|
|
20526
|
+
* @param {object} d Data object
|
|
20527
|
+
* @returns {string} Color string
|
|
20528
|
+
* @private
|
|
20529
|
+
*/
|
|
20388
20530
|
updateAreaColor: function updateAreaColor(d) {
|
|
20389
20531
|
var $$ = this;
|
|
20390
|
-
return $$.config.area_linearGradient ?
|
|
20532
|
+
return $$.config.area_linearGradient ? $$.getGradienColortUrl(d.id) : $$.color(d);
|
|
20391
20533
|
},
|
|
20392
20534
|
|
|
20393
20535
|
/**
|
|
@@ -20407,7 +20549,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
20407
20549
|
$el = $$.$el,
|
|
20408
20550
|
$T = $$.$T,
|
|
20409
20551
|
$root = isSub ? $el.subchart : $el;
|
|
20410
|
-
config.area_linearGradient && $$.
|
|
20552
|
+
config.area_linearGradient && $$.updateLinearGradient();
|
|
20411
20553
|
var area = $root.main.selectAll("." + $AREA.areas).selectAll("." + $AREA.area).data($$.lineData.bind($$));
|
|
20412
20554
|
$T(area.exit(), withTransition).style("opacity", "0").remove();
|
|
20413
20555
|
$root.area = area.enter().append("path").attr("class", $$.getClass("area", !0)).style("fill", $$.updateAreaColor.bind($$)).style("opacity", function () {
|
|
@@ -20425,7 +20567,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
20425
20567
|
* @returns {Array}
|
|
20426
20568
|
*/
|
|
20427
20569
|
redrawArea: function redrawArea(drawFn, withTransition, isSub) {
|
|
20428
|
-
var
|
|
20570
|
+
var _this = this;
|
|
20429
20571
|
|
|
20430
20572
|
if (isSub === void 0) {
|
|
20431
20573
|
isSub = !1;
|
|
@@ -20437,7 +20579,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
20437
20579
|
orgAreaOpacity = $$.state.orgAreaOpacity;
|
|
20438
20580
|
|
|
20439
20581
|
return [$$.$T(area, withTransition, getRandom()).attr("d", drawFn).style("fill", $$.updateAreaColor.bind($$)).style("opacity", function (d) {
|
|
20440
|
-
_newArrowCheck(this,
|
|
20582
|
+
_newArrowCheck(this, _this);
|
|
20441
20583
|
|
|
20442
20584
|
return ($$.isAreaRangeType(d) ? orgAreaOpacity / 1.75 : orgAreaOpacity) + "";
|
|
20443
20585
|
}.bind(this))];
|
|
@@ -20451,7 +20593,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
20451
20593
|
* @private
|
|
20452
20594
|
*/
|
|
20453
20595
|
generateDrawArea: function generateDrawArea(areaIndices, isSub) {
|
|
20454
|
-
var
|
|
20596
|
+
var _this2 = this,
|
|
20455
20597
|
$$ = this,
|
|
20456
20598
|
config = $$.config,
|
|
20457
20599
|
lineConnectNull = config.line_connectNull,
|
|
@@ -20459,25 +20601,25 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
20459
20601
|
getPoints = $$.generateGetAreaPoints(areaIndices, isSub),
|
|
20460
20602
|
yScale = $$.getYScaleById.bind($$),
|
|
20461
20603
|
xValue = function (d) {
|
|
20462
|
-
_newArrowCheck(this,
|
|
20604
|
+
_newArrowCheck(this, _this2);
|
|
20463
20605
|
|
|
20464
20606
|
return (isSub ? $$.subxx : $$.xx).call($$, d);
|
|
20465
20607
|
}.bind(this),
|
|
20466
20608
|
value0 = function (d, i) {
|
|
20467
|
-
_newArrowCheck(this,
|
|
20609
|
+
_newArrowCheck(this, _this2);
|
|
20468
20610
|
|
|
20469
20611
|
return $$.isGrouped(d.id) ? getPoints(d, i)[0][1] : yScale(d.id, isSub)($$.isAreaRangeType(d) ? $$.getRangedData(d, "high") : $$.getShapeYMin(d.id));
|
|
20470
20612
|
}.bind(this),
|
|
20471
20613
|
value1 = function (d, i) {
|
|
20472
|
-
_newArrowCheck(this,
|
|
20614
|
+
_newArrowCheck(this, _this2);
|
|
20473
20615
|
|
|
20474
20616
|
return $$.isGrouped(d.id) ? getPoints(d, i)[1][1] : yScale(d.id, isSub)($$.isAreaRangeType(d) ? $$.getRangedData(d, "low") : d.value);
|
|
20475
20617
|
}.bind(this);
|
|
20476
20618
|
|
|
20477
20619
|
return function (d) {
|
|
20478
|
-
var
|
|
20620
|
+
var _this3 = this;
|
|
20479
20621
|
|
|
20480
|
-
_newArrowCheck(this,
|
|
20622
|
+
_newArrowCheck(this, _this2);
|
|
20481
20623
|
|
|
20482
20624
|
var values = lineConnectNull ? $$.filterRemoveNull(d.values) : d.values,
|
|
20483
20625
|
x0 = 0,
|
|
@@ -20490,7 +20632,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
20490
20632
|
|
|
20491
20633
|
if (!lineConnectNull) {
|
|
20492
20634
|
area = area.defined(function (d) {
|
|
20493
|
-
_newArrowCheck(this,
|
|
20635
|
+
_newArrowCheck(this, _this3);
|
|
20494
20636
|
|
|
20495
20637
|
return $$.getBaseValue(d) !== null;
|
|
20496
20638
|
}.bind(this));
|
|
@@ -20613,14 +20755,28 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
20613
20755
|
}
|
|
20614
20756
|
|
|
20615
20757
|
var $$ = this,
|
|
20758
|
+
config = $$.config,
|
|
20616
20759
|
$el = $$.$el,
|
|
20617
20760
|
$T = $$.$T,
|
|
20618
20761
|
$root = isSub ? $el.subchart : $el,
|
|
20619
20762
|
classBar = $$.getClass("bar", !0),
|
|
20620
|
-
initialOpacity = $$.initialOpacity.bind($$)
|
|
20621
|
-
|
|
20763
|
+
initialOpacity = $$.initialOpacity.bind($$);
|
|
20764
|
+
config.bar_linearGradient && $$.updateLinearGradient();
|
|
20765
|
+
var bar = $root.main.selectAll("." + $BAR.bars).selectAll("." + $BAR.bar).data($$.labelishData.bind($$));
|
|
20622
20766
|
$T(bar.exit(), withTransition).style("opacity", "0").remove();
|
|
20623
|
-
$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;
|
|
20624
20780
|
},
|
|
20625
20781
|
|
|
20626
20782
|
/**
|
|
@@ -20629,6 +20785,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
20629
20785
|
* @param {boolean} withTransition With or without transition
|
|
20630
20786
|
* @param {boolean} isSub Subchart draw
|
|
20631
20787
|
* @returns {Array}
|
|
20788
|
+
* @private
|
|
20632
20789
|
*/
|
|
20633
20790
|
redrawBar: function redrawBar(drawFn, withTransition, isSub) {
|
|
20634
20791
|
var _this3 = this;
|
|
@@ -20645,7 +20802,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
|
|
|
20645
20802
|
_newArrowCheck(this, _this3);
|
|
20646
20803
|
|
|
20647
20804
|
return (isNumber(d.value) || $$.isBarRangeType(d)) && drawFn(d);
|
|
20648
|
-
}.bind(this)).style("fill", $$.
|
|
20805
|
+
}.bind(this)).style("fill", $$.updateBarColor.bind($$)).style("opacity", null)];
|
|
20649
20806
|
},
|
|
20650
20807
|
|
|
20651
20808
|
/**
|
|
@@ -22934,6 +23091,11 @@ var cacheKey = KEY.radarPoints;
|
|
|
22934
23091
|
* @property {object} bar Bar object
|
|
22935
23092
|
* @property {number} [bar.indices.removeNull=false] Remove nullish data on bar indices positions.
|
|
22936
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.
|
|
22937
23099
|
* @property {boolean} [bar.overlap=false] Bars will be rendered at same position, which will be overlapped each other. (for non-grouped bars only)
|
|
22938
23100
|
* @property {number} [bar.padding=0] The padding pixel value between each bar.
|
|
22939
23101
|
* @property {number} [bar.radius] Set the radius of bar edge in pixel.
|
|
@@ -22962,6 +23124,30 @@ var cacheKey = KEY.radarPoints;
|
|
|
22962
23124
|
* removeNull: true
|
|
22963
23125
|
* },
|
|
22964
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
|
+
*
|
|
22965
23151
|
* // remove nullish da
|
|
22966
23152
|
* overlap: true,
|
|
22967
23153
|
*
|
|
@@ -23004,6 +23190,7 @@ var cacheKey = KEY.radarPoints;
|
|
|
23004
23190
|
* }
|
|
23005
23191
|
*/
|
|
23006
23192
|
bar_label_threshold: 0,
|
|
23193
|
+
bar_linearGradient: !1,
|
|
23007
23194
|
bar_indices_removeNull: !1,
|
|
23008
23195
|
bar_overlap: !1,
|
|
23009
23196
|
bar_padding: 0,
|
|
@@ -25988,7 +26175,7 @@ var _defaults = {},
|
|
|
25988
26175
|
* bb.version; // "1.0.0"
|
|
25989
26176
|
* @memberof bb
|
|
25990
26177
|
*/
|
|
25991
|
-
version: "3.6.0
|
|
26178
|
+
version: "3.6.0",
|
|
25992
26179
|
|
|
25993
26180
|
/**
|
|
25994
26181
|
* Generate chart
|
|
@@ -26123,7 +26310,7 @@ var _defaults = {},
|
|
|
26123
26310
|
};
|
|
26124
26311
|
/**
|
|
26125
26312
|
* @namespace bb
|
|
26126
|
-
* @version 3.6.0
|
|
26313
|
+
* @version 3.6.0
|
|
26127
26314
|
*/
|
|
26128
26315
|
;// CONCATENATED MODULE: ./src/index.ts
|
|
26129
26316
|
|