@carbon/charts-vue 0.43.0 → 0.45.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +32 -0
- package/README.md +4 -4
- package/charts-vue.common.js +91 -43
- package/charts-vue.common.js.map +1 -1
- package/charts-vue.umd.js +91 -43
- package/charts-vue.umd.js.map +1 -1
- package/charts-vue.umd.min.js +1 -1
- package/charts-vue.umd.min.js.map +1 -1
- package/package.json +2 -2
package/charts-vue.umd.js
CHANGED
|
@@ -8042,11 +8042,12 @@ var tools_Tools;
|
|
|
8042
8042
|
* @export
|
|
8043
8043
|
* @param {any} item
|
|
8044
8044
|
* @param {any} fullData
|
|
8045
|
+
* @param {string} key
|
|
8045
8046
|
* @returns The percentage in the form of a number (1 significant digit if necessary)
|
|
8046
8047
|
*/
|
|
8047
|
-
function convertValueToPercentage(item, fullData) {
|
|
8048
|
-
|
|
8049
|
-
|
|
8048
|
+
function convertValueToPercentage(item, fullData, key) {
|
|
8049
|
+
if (key === void 0) { key = 'value'; }
|
|
8050
|
+
var percentage = (item / fullData.reduce(function (accum, val) { return accum + val[key]; }, 0)) * 100;
|
|
8050
8051
|
// if the value has any significant figures, keep 1
|
|
8051
8052
|
return percentage % 1 !== 0
|
|
8052
8053
|
? parseFloat(percentage.toFixed(1))
|
|
@@ -8589,6 +8590,7 @@ var pieChart = tools_Tools.merge({}, chart, {
|
|
|
8589
8590
|
},
|
|
8590
8591
|
alignment: Alignments.LEFT,
|
|
8591
8592
|
sortFunction: null,
|
|
8593
|
+
valueMapsTo: 'value',
|
|
8592
8594
|
},
|
|
8593
8595
|
});
|
|
8594
8596
|
/**
|
|
@@ -8949,6 +8951,22 @@ function stackSeries(key) {
|
|
|
8949
8951
|
return stack;
|
|
8950
8952
|
});
|
|
8951
8953
|
|
|
8954
|
+
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-shape/src/offset/diverging.js
|
|
8955
|
+
/* harmony default export */ var diverging = (function(series, order) {
|
|
8956
|
+
if (!((n = series.length) > 0)) return;
|
|
8957
|
+
for (var i, j = 0, d, dy, yp, yn, n, m = series[order[0]].length; j < m; ++j) {
|
|
8958
|
+
for (yp = yn = 0, i = 0; i < n; ++i) {
|
|
8959
|
+
if ((dy = (d = series[order[i]][j])[1] - d[0]) > 0) {
|
|
8960
|
+
d[0] = yp, d[1] = yp += dy;
|
|
8961
|
+
} else if (dy < 0) {
|
|
8962
|
+
d[1] = yn, d[0] = yn += dy;
|
|
8963
|
+
} else {
|
|
8964
|
+
d[0] = 0, d[1] = dy;
|
|
8965
|
+
}
|
|
8966
|
+
}
|
|
8967
|
+
}
|
|
8968
|
+
});
|
|
8969
|
+
|
|
8952
8970
|
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-array/src/array.js
|
|
8953
8971
|
var array_array = Array.prototype;
|
|
8954
8972
|
|
|
@@ -9607,7 +9625,7 @@ var model_ChartModel = /** @class */ (function () {
|
|
|
9607
9625
|
});
|
|
9608
9626
|
};
|
|
9609
9627
|
ChartModel.prototype.getStackedData = function (_a) {
|
|
9610
|
-
var _b = _a.percentage, percentage = _b === void 0 ? false : _b, _c = _a.groups, groups = _c === void 0 ? null : _c;
|
|
9628
|
+
var _b = _a.percentage, percentage = _b === void 0 ? false : _b, _c = _a.groups, groups = _c === void 0 ? null : _c, _d = _a.divergent, divergent = _d === void 0 ? false : _d;
|
|
9611
9629
|
var options = this.getOptions();
|
|
9612
9630
|
var groupMapsTo = options.data.groupMapsTo;
|
|
9613
9631
|
var dataGroupNames = this.getDataGroupNames(groups);
|
|
@@ -9633,7 +9651,10 @@ var model_ChartModel = /** @class */ (function () {
|
|
|
9633
9651
|
});
|
|
9634
9652
|
});
|
|
9635
9653
|
}
|
|
9636
|
-
|
|
9654
|
+
var stackToUse = divergent
|
|
9655
|
+
? src_stack().offset(diverging)
|
|
9656
|
+
: src_stack();
|
|
9657
|
+
return stackToUse
|
|
9637
9658
|
.keys(dataGroupNames)(dataValuesGroupedByKeys)
|
|
9638
9659
|
.map(function (series, i) {
|
|
9639
9660
|
// Add data group names to each series
|
|
@@ -15916,26 +15937,6 @@ function max_max(values, valueof) {
|
|
|
15916
15937
|
return max;
|
|
15917
15938
|
}
|
|
15918
15939
|
|
|
15919
|
-
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-array/src/sum.js
|
|
15920
|
-
function sum_sum(values, valueof) {
|
|
15921
|
-
let sum = 0;
|
|
15922
|
-
if (valueof === undefined) {
|
|
15923
|
-
for (let value of values) {
|
|
15924
|
-
if (value = +value) {
|
|
15925
|
-
sum += value;
|
|
15926
|
-
}
|
|
15927
|
-
}
|
|
15928
|
-
} else {
|
|
15929
|
-
let index = -1;
|
|
15930
|
-
for (let value of values) {
|
|
15931
|
-
if (value = +valueof(value, ++index, values)) {
|
|
15932
|
-
sum += value;
|
|
15933
|
-
}
|
|
15934
|
-
}
|
|
15935
|
-
}
|
|
15936
|
-
return sum;
|
|
15937
|
-
}
|
|
15938
|
-
|
|
15939
15940
|
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/date-fns/esm/toDate/index.js
|
|
15940
15941
|
/**
|
|
15941
15942
|
* @name toDate
|
|
@@ -17487,11 +17488,21 @@ var scales_cartesian_CartesianScales = /** @class */ (function (_super) {
|
|
|
17487
17488
|
groups: dataGroupNames,
|
|
17488
17489
|
});
|
|
17489
17490
|
var nonStackedGroupsData = displayData.filter(function (datum) { return !dataGroupNames.includes(datum[groupMapsTo_1]); });
|
|
17490
|
-
var
|
|
17491
|
+
var stackedValues_1 = [];
|
|
17492
|
+
dataValuesGroupedByKeys.forEach(function (dataValues) {
|
|
17491
17493
|
var sharedStackKey = dataValues.sharedStackKey, numericalValues = __rest(dataValues, ["sharedStackKey"]);
|
|
17492
|
-
|
|
17494
|
+
var positiveSum = 0, negativeSum = 0;
|
|
17495
|
+
Object.values(numericalValues).forEach(function (value) {
|
|
17496
|
+
if (value < 0) {
|
|
17497
|
+
negativeSum += value;
|
|
17498
|
+
}
|
|
17499
|
+
else {
|
|
17500
|
+
positiveSum += value;
|
|
17501
|
+
}
|
|
17502
|
+
});
|
|
17503
|
+
stackedValues_1.push([negativeSum, positiveSum]);
|
|
17493
17504
|
});
|
|
17494
|
-
allDataValues = scales_cartesian_spreadArrays(
|
|
17505
|
+
allDataValues = scales_cartesian_spreadArrays(tools_Tools.flatten(stackedValues_1), nonStackedGroupsData.map(function (datum) { return datum[mapsTo]; }));
|
|
17495
17506
|
}
|
|
17496
17507
|
else {
|
|
17497
17508
|
allDataValues = [];
|
|
@@ -26469,7 +26480,9 @@ var bar_stacked_StackedBar = /** @class */ (function (_super) {
|
|
|
26469
26480
|
// Create the data and keys that'll be used by the stack layout
|
|
26470
26481
|
var stackData = this.model.getStackedData({
|
|
26471
26482
|
groups: this.configs.groups,
|
|
26483
|
+
divergent: true
|
|
26472
26484
|
});
|
|
26485
|
+
var activeDataGroupNames = this.model.getActiveDataGroupNames();
|
|
26473
26486
|
// Update data on all bar groups
|
|
26474
26487
|
var barGroups = svg
|
|
26475
26488
|
.selectAll('g.bars')
|
|
@@ -26534,12 +26547,24 @@ var bar_stacked_StackedBar = /** @class */ (function (_super) {
|
|
|
26534
26547
|
// Add the divider gap
|
|
26535
26548
|
if (Math.abs(y1 - y0) > 0 &&
|
|
26536
26549
|
Math.abs(y1 - y0) > options.bars.dividerSize) {
|
|
26537
|
-
|
|
26538
|
-
|
|
26539
|
-
|
|
26550
|
+
var barIsNegative = d[0] < 0 && d[1] <= 0;
|
|
26551
|
+
if (barIsNegative && activeDataGroupNames.length > 1) {
|
|
26552
|
+
if (_this.services.cartesianScales.getOrientation() ===
|
|
26553
|
+
CartesianOrientations.VERTICAL) {
|
|
26554
|
+
y1 += d[1] === 0 ? 2 : 1;
|
|
26555
|
+
}
|
|
26556
|
+
else {
|
|
26557
|
+
y1 -= d[1] === 0 ? 1 : 1;
|
|
26558
|
+
}
|
|
26540
26559
|
}
|
|
26541
|
-
else {
|
|
26542
|
-
|
|
26560
|
+
else if (!barIsNegative) {
|
|
26561
|
+
if (_this.services.cartesianScales.getOrientation() ===
|
|
26562
|
+
CartesianOrientations.VERTICAL) {
|
|
26563
|
+
y1 += 1;
|
|
26564
|
+
}
|
|
26565
|
+
else {
|
|
26566
|
+
y1 -= 1;
|
|
26567
|
+
}
|
|
26543
26568
|
}
|
|
26544
26569
|
}
|
|
26545
26570
|
return tools_Tools.generateSVGPathString({ x0: x0, x1: x1, y0: y0, y1: y1 }, _this.services.cartesianScales.getOrientation());
|
|
@@ -29073,12 +29098,13 @@ var pie_Pie = /** @class */ (function (_super) {
|
|
|
29073
29098
|
if (animate === void 0) { animate = true; }
|
|
29074
29099
|
var self = this;
|
|
29075
29100
|
var svg = this.getComponentContainer();
|
|
29101
|
+
var options = this.getOptions();
|
|
29102
|
+
var groupMapsTo = options.data.groupMapsTo;
|
|
29103
|
+
var valueMapsTo = options.pie.valueMapsTo;
|
|
29076
29104
|
// remove any slices that are valued at 0 because they dont need to be rendered and will create extra padding
|
|
29077
29105
|
var displayData = this.model
|
|
29078
29106
|
.getDisplayData()
|
|
29079
|
-
.filter(function (data) { return data
|
|
29080
|
-
var options = this.getOptions();
|
|
29081
|
-
var groupMapsTo = options.data.groupMapsTo;
|
|
29107
|
+
.filter(function (data) { return data[valueMapsTo] > 0; });
|
|
29082
29108
|
// Compute the outer radius needed
|
|
29083
29109
|
var radius = this.computeRadius();
|
|
29084
29110
|
this.arc = src_arc().innerRadius(this.getInnerRadius()).outerRadius(radius);
|
|
@@ -29088,7 +29114,7 @@ var pie_Pie = /** @class */ (function (_super) {
|
|
|
29088
29114
|
.outerRadius(radius + configuration_non_customizable_pie.hoverArc.outerRadiusOffset);
|
|
29089
29115
|
// Setup the pie layout
|
|
29090
29116
|
var pieLayout = src_pie()
|
|
29091
|
-
.value(function (d) { return d
|
|
29117
|
+
.value(function (d) { return d[valueMapsTo]; })
|
|
29092
29118
|
.sort(tools_Tools.getProperty(options, 'pie', 'sortFunction'))
|
|
29093
29119
|
.padAngle(configuration_non_customizable_pie.padAngle);
|
|
29094
29120
|
// Add data to pie layout
|
|
@@ -29134,7 +29160,7 @@ var pie_Pie = /** @class */ (function (_super) {
|
|
|
29134
29160
|
.attr('role', Roles.GRAPHICS_SYMBOL)
|
|
29135
29161
|
.attr('aria-roledescription', 'slice')
|
|
29136
29162
|
.attr('aria-label', function (d) {
|
|
29137
|
-
return d
|
|
29163
|
+
return d[valueMapsTo] + ", " + (tools_Tools.convertValueToPercentage(d.data[valueMapsTo], displayData, valueMapsTo) + '%');
|
|
29138
29164
|
})
|
|
29139
29165
|
// Tween
|
|
29140
29166
|
.attrTween('d', function (a) {
|
|
@@ -29143,7 +29169,7 @@ var pie_Pie = /** @class */ (function (_super) {
|
|
|
29143
29169
|
// Draw the slice labels
|
|
29144
29170
|
var renderLabels = options.pie.labels.enabled;
|
|
29145
29171
|
var labelData = renderLabels
|
|
29146
|
-
? pieLayoutData.filter(function (x) { return x.
|
|
29172
|
+
? pieLayoutData.filter(function (x) { return x.data[valueMapsTo] > 0; })
|
|
29147
29173
|
: [];
|
|
29148
29174
|
var labelsGroup = dom_utils_DOMUtils.appendOrSelect(svg, 'g.labels')
|
|
29149
29175
|
.attr('role', Roles.GROUP)
|
|
@@ -29167,8 +29193,7 @@ var pie_Pie = /** @class */ (function (_super) {
|
|
|
29167
29193
|
if (options.pie.labels.formatter) {
|
|
29168
29194
|
return options.pie.labels.formatter(d);
|
|
29169
29195
|
}
|
|
29170
|
-
return (tools_Tools.convertValueToPercentage(d.data
|
|
29171
|
-
'%');
|
|
29196
|
+
return (tools_Tools.convertValueToPercentage(d.data[valueMapsTo], displayData, valueMapsTo) + '%');
|
|
29172
29197
|
})
|
|
29173
29198
|
// Calculate dimensions in order to transform
|
|
29174
29199
|
.datum(function (d) {
|
|
@@ -29348,6 +29373,7 @@ var pie_Pie = /** @class */ (function (_super) {
|
|
|
29348
29373
|
datum: datum,
|
|
29349
29374
|
});
|
|
29350
29375
|
var groupMapsTo = self.getOptions().data.groupMapsTo;
|
|
29376
|
+
var valueMapsTo = self.getOptions().pie.valueMapsTo;
|
|
29351
29377
|
// Show tooltip
|
|
29352
29378
|
self.services.events.dispatchEvent(Events.Tooltip.SHOW, {
|
|
29353
29379
|
event: event,
|
|
@@ -29355,7 +29381,7 @@ var pie_Pie = /** @class */ (function (_super) {
|
|
|
29355
29381
|
items: [
|
|
29356
29382
|
{
|
|
29357
29383
|
label: datum.data[groupMapsTo],
|
|
29358
|
-
value: datum.data
|
|
29384
|
+
value: datum.data[valueMapsTo],
|
|
29359
29385
|
},
|
|
29360
29386
|
],
|
|
29361
29387
|
});
|
|
@@ -29839,7 +29865,7 @@ var donut_Donut = /** @class */ (function (_super) {
|
|
|
29839
29865
|
donutCenterFigure = this.model
|
|
29840
29866
|
.getDisplayData()
|
|
29841
29867
|
.reduce(function (accumulator, d) {
|
|
29842
|
-
return accumulator + d.
|
|
29868
|
+
return accumulator + d[options.pie.valueMapsTo];
|
|
29843
29869
|
}, 0);
|
|
29844
29870
|
}
|
|
29845
29871
|
// Remove commas from the current value string, and convert to an int
|
|
@@ -30686,6 +30712,26 @@ function constantZero() {
|
|
|
30686
30712
|
return treemap;
|
|
30687
30713
|
});
|
|
30688
30714
|
|
|
30715
|
+
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/d3-array/src/sum.js
|
|
30716
|
+
function sum_sum(values, valueof) {
|
|
30717
|
+
let sum = 0;
|
|
30718
|
+
if (valueof === undefined) {
|
|
30719
|
+
for (let value of values) {
|
|
30720
|
+
if (value = +value) {
|
|
30721
|
+
sum += value;
|
|
30722
|
+
}
|
|
30723
|
+
}
|
|
30724
|
+
} else {
|
|
30725
|
+
let index = -1;
|
|
30726
|
+
for (let value of values) {
|
|
30727
|
+
if (value = +valueof(value, ++index, values)) {
|
|
30728
|
+
sum += value;
|
|
30729
|
+
}
|
|
30730
|
+
}
|
|
30731
|
+
}
|
|
30732
|
+
return sum;
|
|
30733
|
+
}
|
|
30734
|
+
|
|
30689
30735
|
// CONCATENATED MODULE: /home/runner/work/carbon-charts/carbon-charts/node_modules/@carbon/colors/es/index.js
|
|
30690
30736
|
/**
|
|
30691
30737
|
* Copyright IBM Corp. 2018, 2018
|
|
@@ -37799,6 +37845,7 @@ var bar_stacked_StackedBarChart = /** @class */ (function (_super) {
|
|
|
37799
37845
|
new skeleton_Skeleton(this.model, this.services, {
|
|
37800
37846
|
skeleton: Skeletons.VERT_OR_HORIZ,
|
|
37801
37847
|
}),
|
|
37848
|
+
new zero_line_ZeroLine(this.model, this.services),
|
|
37802
37849
|
];
|
|
37803
37850
|
var components = this.getAxisChartComponents(graphFrameComponents);
|
|
37804
37851
|
return components;
|
|
@@ -38302,6 +38349,7 @@ var line_LineChart = /** @class */ (function (_super) {
|
|
|
38302
38349
|
new line_Line(this.model, this.services),
|
|
38303
38350
|
new scatter_Scatter(this.model, this.services, { handleThresholds: true }),
|
|
38304
38351
|
new skeleton_lines_SkeletonLines(this.model, this.services),
|
|
38352
|
+
new zero_line_ZeroLine(this.model, this.services),
|
|
38305
38353
|
];
|
|
38306
38354
|
var components = this.getAxisChartComponents(graphFrameComponents);
|
|
38307
38355
|
return components;
|