@splunk/charting-bundle 25.10.0 → 25.11.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/index.js +61 -56
- package/index.js.map +1 -1
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -16583,6 +16583,7 @@ _jquery2.default.extend(Chart.prototype, {
|
|
|
16583
16583
|
if (this.showLabels === 'all' || this.showLabels === 'minmax') {
|
|
16584
16584
|
this.initializeDataLabels();
|
|
16585
16585
|
}
|
|
16586
|
+
|
|
16586
16587
|
this.initializeFields();
|
|
16587
16588
|
this.isiOS = !!_bowser2.default.ios;
|
|
16588
16589
|
var isEmpty = this.isEmpty();
|
|
@@ -17157,19 +17158,19 @@ _jquery2.default.extend(Chart.prototype, {
|
|
|
17157
17158
|
this.xFields = baseFields.xFields;
|
|
17158
17159
|
this.yFields = baseFields.yFields;
|
|
17159
17160
|
|
|
17160
|
-
var
|
|
17161
|
-
var
|
|
17162
|
-
var intersection = _underscore2.default.intersection(
|
|
17161
|
+
var fieldAllowList = _jquery2.default.extend([], this.fieldShowList);
|
|
17162
|
+
var fieldBlockList = _jquery2.default.extend([], this.fieldHideList);
|
|
17163
|
+
var intersection = _underscore2.default.intersection(fieldAllowList, fieldBlockList);
|
|
17163
17164
|
|
|
17164
17165
|
if (this.showHideMode) {
|
|
17165
|
-
|
|
17166
|
+
fieldBlockList = _underscore2.default.difference(fieldBlockList, intersection);
|
|
17166
17167
|
} else {
|
|
17167
|
-
|
|
17168
|
+
fieldAllowList = _underscore2.default.difference(fieldAllowList, intersection);
|
|
17168
17169
|
}
|
|
17169
17170
|
|
|
17170
|
-
this.yFields = _underscore2.default.difference(this.yFields,
|
|
17171
|
-
if (
|
|
17172
|
-
this.yFields = _underscore2.default.intersection(this.yFields,
|
|
17171
|
+
this.yFields = _underscore2.default.difference(this.yFields, fieldBlockList);
|
|
17172
|
+
if (fieldAllowList.length > 0) {
|
|
17173
|
+
this.yFields = _underscore2.default.intersection(this.yFields, fieldAllowList);
|
|
17173
17174
|
}
|
|
17174
17175
|
// handle the user-specified legend labels
|
|
17175
17176
|
if (this.yFields.length > 0 && this.legendLabels.length > 0) {
|
|
@@ -24442,14 +24443,14 @@ var disableAccessibilityModuleAutoLoad = exports.disableAccessibilityModuleAutoL
|
|
|
24442
24443
|
// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
24443
24444
|
// namespace-level methods
|
|
24444
24445
|
|
|
24445
|
-
var extractChartReadyData = exports.extractChartReadyData = function extractChartReadyData(rawData) {
|
|
24446
|
+
var extractChartReadyData = exports.extractChartReadyData = function extractChartReadyData(rawData, chartDataOptions) {
|
|
24446
24447
|
if (!rawData || !rawData.fields || !rawData.columns) {
|
|
24447
24448
|
throw new Error('The data object passed to extractChartReadyData did not contain fields and columns');
|
|
24448
24449
|
}
|
|
24449
24450
|
if (rawData.fields.length !== rawData.columns.length) {
|
|
24450
24451
|
throw new Error('The data object passed to extractChartReadyData must have the same number of fields and columns');
|
|
24451
24452
|
}
|
|
24452
|
-
return new _DataSet2.default(rawData);
|
|
24453
|
+
return new _DataSet2.default(rawData, chartDataOptions);
|
|
24453
24454
|
};
|
|
24454
24455
|
|
|
24455
24456
|
var createChart = exports.createChart = function createChart(container, properties) {
|
|
@@ -27216,6 +27217,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
27216
27217
|
function DataSet(data) {
|
|
27217
27218
|
var _this = this;
|
|
27218
27219
|
|
|
27220
|
+
var chartDataOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
27221
|
+
|
|
27219
27222
|
var fields = data.fields || {};
|
|
27220
27223
|
var series = data.columns || {};
|
|
27221
27224
|
|
|
@@ -27223,6 +27226,7 @@ function DataSet(data) {
|
|
|
27223
27226
|
this.seriesList = [];
|
|
27224
27227
|
this.fieldMetadata = {};
|
|
27225
27228
|
this.annotations = data.annotations || [];
|
|
27229
|
+
this.chartDataOptions = chartDataOptions;
|
|
27226
27230
|
|
|
27227
27231
|
(0, _underscore2.default)(fields).each(function (field, i) {
|
|
27228
27232
|
var fieldName = void 0;
|
|
@@ -27255,6 +27259,12 @@ DataSet.prototype = {
|
|
|
27255
27259
|
return (0, _underscore2.default)(this.fields).filter(this.isDataField, this);
|
|
27256
27260
|
},
|
|
27257
27261
|
isDataField: function isDataField(field) {
|
|
27262
|
+
if (this.chartDataOptions && this.chartDataOptions.allowAllInternalFields) {
|
|
27263
|
+
return true;
|
|
27264
|
+
}
|
|
27265
|
+
if (this.chartDataOptions && this.chartDataOptions.allowInternalFieldsExceptSpan) {
|
|
27266
|
+
return field !== '_span';
|
|
27267
|
+
}
|
|
27258
27268
|
return this.DATA_FIELD_REGEX.test(field);
|
|
27259
27269
|
},
|
|
27260
27270
|
isTotalValue: function isTotalValue(value) {
|
|
@@ -31699,9 +31709,42 @@ _jquery2.default.extend(PieSeries.prototype, {
|
|
|
31699
31709
|
innerSize: this.innerSize
|
|
31700
31710
|
});
|
|
31701
31711
|
},
|
|
31702
|
-
|
|
31712
|
+
collapseData: function collapseData(inputData, nameSeries, sizeSeries, countZero, validNumLessThanThresh, passesThreshold, cardinality, granularity, isTimeBased) {
|
|
31703
31713
|
var _this = this;
|
|
31704
31714
|
|
|
31715
|
+
var spanSeries = inputData.spans;
|
|
31716
|
+
var collapsedSizeRemovingInvalid = 0;
|
|
31717
|
+
var numCollapsed = countZero === 1 ? 0 : countZero;
|
|
31718
|
+
(0, _underscore2.default)(nameSeries).each(function (name, i) {
|
|
31719
|
+
var sizeValue = sizeSeries[i];
|
|
31720
|
+
// no collapse
|
|
31721
|
+
if (countZero === 1 && sizeValue === 0 && validNumLessThanThresh === 1 || passesThreshold(sizeValue) || validNumLessThanThresh === 1 && !countZero || cardinality <= 10 && !countZero) {
|
|
31722
|
+
if (isTimeBased) {
|
|
31723
|
+
var bdTime = timeUtils.extractBdTime(name);
|
|
31724
|
+
var humanizedName = timeUtils.formatBdTimeAsAxisLabel(bdTime, null, granularity).join(' ');
|
|
31725
|
+
var spanValue = spanSeries[i];
|
|
31726
|
+
_this.data.push([name, sizeValue, spanValue]);
|
|
31727
|
+
_this.prettyData.push([humanizedName, sizeValue, spanValue]);
|
|
31728
|
+
} else {
|
|
31729
|
+
_this.data.push([name, sizeValue]);
|
|
31730
|
+
}
|
|
31731
|
+
} else {
|
|
31732
|
+
// collapse
|
|
31733
|
+
collapsedSizeRemovingInvalid += sizeValue;
|
|
31734
|
+
numCollapsed++;
|
|
31735
|
+
_this.fieldList = (0, _underscore2.default)(_this.fieldList).without(name);
|
|
31736
|
+
}
|
|
31737
|
+
});
|
|
31738
|
+
|
|
31739
|
+
if (numCollapsed > 0) {
|
|
31740
|
+
var collapsedName = this.collapseFieldName + ' (' + numCollapsed + ')';
|
|
31741
|
+
this.data.push([collapsedName, collapsedSizeRemovingInvalid]);
|
|
31742
|
+
// Doesn't make sense to attach a span value to the collapsed section
|
|
31743
|
+
this.prettyData.push([collapsedName, collapsedSizeRemovingInvalid, null]);
|
|
31744
|
+
this.fieldList.push('__other');
|
|
31745
|
+
}
|
|
31746
|
+
},
|
|
31747
|
+
setData: function setData(inputData) {
|
|
31705
31748
|
var oldData = this.data;
|
|
31706
31749
|
this.data = [];
|
|
31707
31750
|
this.prettyData = [];
|
|
@@ -31711,9 +31754,11 @@ _jquery2.default.extend(PieSeries.prototype, {
|
|
|
31711
31754
|
var minPositiveSize = Number.MAX_VALUE;
|
|
31712
31755
|
// negative values are omitted from the pie chart. Fix for SPL-210816
|
|
31713
31756
|
var cardinality = 0;
|
|
31714
|
-
var countZero =
|
|
31757
|
+
var countZero = inputData.sizes.filter(function (s) {
|
|
31758
|
+
return s === 0;
|
|
31759
|
+
}).length;
|
|
31715
31760
|
(0, _underscore2.default)(inputData.sizes).each(function (size, i) {
|
|
31716
|
-
if (size > 0) {
|
|
31761
|
+
if (size > 0 || countZero === 1 && size === 0) {
|
|
31717
31762
|
nameSeries.push(inputData.names[i]);
|
|
31718
31763
|
sizeSeries.push(size);
|
|
31719
31764
|
cardinality += 1; // only count valid values for cardinality
|
|
@@ -31722,28 +31767,14 @@ _jquery2.default.extend(PieSeries.prototype, {
|
|
|
31722
31767
|
minPositiveSize = size;
|
|
31723
31768
|
}
|
|
31724
31769
|
}
|
|
31725
|
-
if (size === 0) {
|
|
31726
|
-
countZero += 1;
|
|
31727
|
-
}
|
|
31728
31770
|
});
|
|
31729
|
-
var spanSeries = inputData.spans;
|
|
31730
31771
|
var isTimeBased = inputData.isTimeBased;
|
|
31731
31772
|
var totalSize = (0, _underscore2.default)(sizeSeries).reduce(function (sum, value) {
|
|
31732
31773
|
return sum + value;
|
|
31733
31774
|
}, 0);
|
|
31734
|
-
var collapsedSizeRemovingInvalid = 0;
|
|
31735
|
-
var numCollapsed = countZero;
|
|
31736
31775
|
var validNumLessThanThresh = 0;
|
|
31737
31776
|
var granularity = null;
|
|
31738
31777
|
|
|
31739
|
-
// for collapsing all zero values, calculate the value to replace zero
|
|
31740
|
-
// "valueReplaceZero" is a number < 1 and smaller than any value in the input array
|
|
31741
|
-
// small enough to show "count: 0" and "count% 0%" in the tooltip for zeros
|
|
31742
|
-
var maxDigits = Math.abs(Math.ceil(Math.log(minPositiveSize) * Math.LOG10E));
|
|
31743
|
-
var valueReplaceZero = 1 / 10 ** (maxDigits + 3);
|
|
31744
|
-
// if the value is not small enough to collapse, recalculate
|
|
31745
|
-
valueReplaceZero = valueReplaceZero / totalSize < that.collapsePercent ? valueReplaceZero : totalSize * that.collapsePercent * 0.0001;
|
|
31746
|
-
|
|
31747
31778
|
var passesThreshold = function passesThreshold(value) {
|
|
31748
31779
|
return value > 0 && value / totalSize > that.collapsePercent;
|
|
31749
31780
|
};
|
|
@@ -31756,41 +31787,15 @@ _jquery2.default.extend(PieSeries.prototype, {
|
|
|
31756
31787
|
this.fieldList = (0, _underscore2.default)(nameSeries).map(parsingUtils.escapeSVG, parsingUtils);
|
|
31757
31788
|
(0, _underscore2.default)(sizeSeries).each(function (size, i) {
|
|
31758
31789
|
// replace zero with the calculated small value
|
|
31759
|
-
if (size === 0) {
|
|
31760
|
-
sizeSeries[i] =
|
|
31790
|
+
if (countZero > 1 && size === 0) {
|
|
31791
|
+
sizeSeries[i] = size;
|
|
31761
31792
|
countZero += 1;
|
|
31762
31793
|
} else if (!passesThreshold(size)) {
|
|
31763
31794
|
validNumLessThanThresh++;
|
|
31764
31795
|
}
|
|
31765
31796
|
}, this);
|
|
31766
31797
|
|
|
31767
|
-
(
|
|
31768
|
-
var sizeValue = sizeSeries[i];
|
|
31769
|
-
// no collapse
|
|
31770
|
-
if (passesThreshold(sizeValue) || validNumLessThanThresh === 1 && !countZero || cardinality <= 10 && !countZero) {
|
|
31771
|
-
if (isTimeBased) {
|
|
31772
|
-
var bdTime = timeUtils.extractBdTime(name);
|
|
31773
|
-
var humanizedName = timeUtils.formatBdTimeAsAxisLabel(bdTime, null, granularity).join(' ');
|
|
31774
|
-
var spanValue = spanSeries[i];
|
|
31775
|
-
_this.data.push([name, sizeValue, spanValue]);
|
|
31776
|
-
_this.prettyData.push([humanizedName, sizeValue, spanValue]);
|
|
31777
|
-
} else {
|
|
31778
|
-
_this.data.push([name, sizeValue]);
|
|
31779
|
-
}
|
|
31780
|
-
} else {
|
|
31781
|
-
// collapse
|
|
31782
|
-
collapsedSizeRemovingInvalid += sizeValue === valueReplaceZero ? 0 : sizeValue;
|
|
31783
|
-
numCollapsed++;
|
|
31784
|
-
_this.fieldList = (0, _underscore2.default)(_this.fieldList).without(name);
|
|
31785
|
-
}
|
|
31786
|
-
});
|
|
31787
|
-
if (numCollapsed > 0) {
|
|
31788
|
-
var collapsedName = this.collapseFieldName + ' (' + numCollapsed + ')';
|
|
31789
|
-
this.data.push([collapsedName, collapsedSizeRemovingInvalid]);
|
|
31790
|
-
// Doesn't make sense to attach a span value to the collapsed section
|
|
31791
|
-
this.prettyData.push([collapsedName, collapsedSizeRemovingInvalid, null]);
|
|
31792
|
-
this.fieldList.push('__other');
|
|
31793
|
-
}
|
|
31798
|
+
this.collapseData(inputData, nameSeries, sizeSeries, countZero, validNumLessThanThresh, passesThreshold, cardinality, granularity, isTimeBased);
|
|
31794
31799
|
|
|
31795
31800
|
if (!_underscore2.default.isEqual(this.data, oldData)) {
|
|
31796
31801
|
this._dataIsDirty = true;
|