@oliasoft-open-source/charts-library 4.1.5 → 4.1.6
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/index.js +260 -277
- package/dist/index.js.map +1 -1
- package/dist/src/components/bar-chart/bar-chart.interface.d.ts +1 -1
- package/dist/src/components/common/common.interface.d.ts +1 -0
- package/dist/src/components/common/helpers/chart-utils.d.ts +1 -6
- package/dist/src/components/common/helpers/get-chart-annotation.d.ts +3 -4
- package/dist/src/components/common/hooks/use-legend-state.d.ts +1 -8
- package/dist/src/components/common/legend-component/state/legend-action-types.d.ts +1 -3
- package/dist/src/components/common/legend-component/state/legend-state-reducer.d.ts +13 -16
- package/dist/src/components/line-chart/hooks/use-chart-options.d.ts +16 -0
- package/dist/src/components/line-chart/line-chart.interface.d.ts +2 -2
- package/dist/src/components/line-chart/line-chart.stories.d.ts +2 -0
- package/dist/src/components/line-chart/state/action-types.d.ts +0 -1
- package/dist/src/components/pie-chart/pie-chart.interface.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { produce } from "immer";
|
|
|
11
11
|
import { round as round$2, displayNumber, isCloseTo, roundByMagnitude, toNum } from "@oliasoft-open-source/units";
|
|
12
12
|
import cx from "classnames";
|
|
13
13
|
import { Icon, Tooltip as Tooltip$2, Button, Flex, Text, Menu, Popover, Field, InputGroup, NumberInput, InputGroupAddon, Select, ButtonGroup, Spacer, Portal } from "@oliasoft-open-source/react-ui-library";
|
|
14
|
-
import { isEmpty, isArray as isArray$2, some, has, debounce as debounce$3 } from "lodash";
|
|
14
|
+
import { isEmpty, isArray as isArray$2, some, has, cloneDeep, defaultTo, findIndex, set as set$2, debounce as debounce$3, map as map$3, find, get as get$1, values } from "lodash";
|
|
15
15
|
import { roundNumberToPrecision } from "@oliasoft-open-source/units/dist/rounding/rounding";
|
|
16
16
|
/*!
|
|
17
17
|
* @kurkle/color v0.3.2
|
|
@@ -921,16 +921,16 @@ const _lookupByKey$1 = (table2, key, value, last) => _lookup$1(table2, value, la
|
|
|
921
921
|
return ti < value || ti === value && table2[index2 + 1][key] === value;
|
|
922
922
|
} : (index2) => table2[index2][key] < value);
|
|
923
923
|
const _rlookupByKey$1 = (table2, key, value) => _lookup$1(table2, value, (index2) => table2[index2][key] >= value);
|
|
924
|
-
function _filterBetween$1(
|
|
924
|
+
function _filterBetween$1(values2, min, max) {
|
|
925
925
|
let start = 0;
|
|
926
|
-
let end =
|
|
927
|
-
while (start < end &&
|
|
926
|
+
let end = values2.length;
|
|
927
|
+
while (start < end && values2[start] < min) {
|
|
928
928
|
start++;
|
|
929
929
|
}
|
|
930
|
-
while (end > start &&
|
|
930
|
+
while (end > start && values2[end - 1] > max) {
|
|
931
931
|
end--;
|
|
932
932
|
}
|
|
933
|
-
return start > 0 || end <
|
|
933
|
+
return start > 0 || end < values2.length ? values2.slice(start, end) : values2;
|
|
934
934
|
}
|
|
935
935
|
const arrayEvents$1 = [
|
|
936
936
|
"push",
|
|
@@ -1404,9 +1404,9 @@ function getScope$1$1(node, key) {
|
|
|
1404
1404
|
}
|
|
1405
1405
|
return node;
|
|
1406
1406
|
}
|
|
1407
|
-
function set$1(root, scope2,
|
|
1407
|
+
function set$1(root, scope2, values2) {
|
|
1408
1408
|
if (typeof scope2 === "string") {
|
|
1409
|
-
return merge$1(getScope$1$1(root, scope2),
|
|
1409
|
+
return merge$1(getScope$1$1(root, scope2), values2);
|
|
1410
1410
|
}
|
|
1411
1411
|
return merge$1(getScope$1$1(root, ""), scope2);
|
|
1412
1412
|
}
|
|
@@ -1456,17 +1456,17 @@ let Defaults$1 = class Defaults {
|
|
|
1456
1456
|
this.describe(_descriptors2);
|
|
1457
1457
|
this.apply(_appliers);
|
|
1458
1458
|
}
|
|
1459
|
-
set(scope2,
|
|
1460
|
-
return set$1(this, scope2,
|
|
1459
|
+
set(scope2, values2) {
|
|
1460
|
+
return set$1(this, scope2, values2);
|
|
1461
1461
|
}
|
|
1462
1462
|
get(scope2) {
|
|
1463
1463
|
return getScope$1$1(this, scope2);
|
|
1464
1464
|
}
|
|
1465
|
-
describe(scope2,
|
|
1466
|
-
return set$1(descriptors$1, scope2,
|
|
1465
|
+
describe(scope2, values2) {
|
|
1466
|
+
return set$1(descriptors$1, scope2, values2);
|
|
1467
1467
|
}
|
|
1468
|
-
override(scope2,
|
|
1469
|
-
return set$1(overrides$1, scope2,
|
|
1468
|
+
override(scope2, values2) {
|
|
1469
|
+
return set$1(overrides$1, scope2, values2);
|
|
1470
1470
|
}
|
|
1471
1471
|
route(scope2, name, targetScope, targetName) {
|
|
1472
1472
|
const scopeObject = getScope$1$1(this, scope2);
|
|
@@ -3175,8 +3175,8 @@ let Animations$1 = class Animations {
|
|
|
3175
3175
|
});
|
|
3176
3176
|
});
|
|
3177
3177
|
}
|
|
3178
|
-
_animateOptions(target,
|
|
3179
|
-
const newOptions =
|
|
3178
|
+
_animateOptions(target, values2) {
|
|
3179
|
+
const newOptions = values2.options;
|
|
3180
3180
|
const options = resolveTargetOptions$1(target, newOptions);
|
|
3181
3181
|
if (!options) {
|
|
3182
3182
|
return [];
|
|
@@ -3190,11 +3190,11 @@ let Animations$1 = class Animations {
|
|
|
3190
3190
|
}
|
|
3191
3191
|
return animations;
|
|
3192
3192
|
}
|
|
3193
|
-
_createAnimations(target,
|
|
3193
|
+
_createAnimations(target, values2) {
|
|
3194
3194
|
const animatedProps = this._properties;
|
|
3195
3195
|
const animations = [];
|
|
3196
3196
|
const running = target.$animations || (target.$animations = {});
|
|
3197
|
-
const props = Object.keys(
|
|
3197
|
+
const props = Object.keys(values2);
|
|
3198
3198
|
const date = Date.now();
|
|
3199
3199
|
let i2;
|
|
3200
3200
|
for (i2 = props.length - 1; i2 >= 0; --i2) {
|
|
@@ -3203,10 +3203,10 @@ let Animations$1 = class Animations {
|
|
|
3203
3203
|
continue;
|
|
3204
3204
|
}
|
|
3205
3205
|
if (prop === "options") {
|
|
3206
|
-
animations.push(...this._animateOptions(target,
|
|
3206
|
+
animations.push(...this._animateOptions(target, values2));
|
|
3207
3207
|
continue;
|
|
3208
3208
|
}
|
|
3209
|
-
const value =
|
|
3209
|
+
const value = values2[prop];
|
|
3210
3210
|
let animation = running[prop];
|
|
3211
3211
|
const cfg = animatedProps.get(prop);
|
|
3212
3212
|
if (animation) {
|
|
@@ -3226,12 +3226,12 @@ let Animations$1 = class Animations {
|
|
|
3226
3226
|
}
|
|
3227
3227
|
return animations;
|
|
3228
3228
|
}
|
|
3229
|
-
update(target,
|
|
3229
|
+
update(target, values2) {
|
|
3230
3230
|
if (this._properties.size === 0) {
|
|
3231
|
-
Object.assign(target,
|
|
3231
|
+
Object.assign(target, values2);
|
|
3232
3232
|
return;
|
|
3233
3233
|
}
|
|
3234
|
-
const animations = this._createAnimations(target,
|
|
3234
|
+
const animations = this._createAnimations(target, values2);
|
|
3235
3235
|
if (animations.length) {
|
|
3236
3236
|
animator$1.add(this._chart, animations);
|
|
3237
3237
|
return true;
|
|
@@ -3684,9 +3684,9 @@ let DatasetController$1 = (_a = class {
|
|
|
3684
3684
|
updateRangeFromParsed(range, scale, parsed, stack) {
|
|
3685
3685
|
const parsedValue = parsed[scale.axis];
|
|
3686
3686
|
let value = parsedValue === null ? NaN : parsedValue;
|
|
3687
|
-
const
|
|
3688
|
-
if (stack &&
|
|
3689
|
-
stack.values =
|
|
3687
|
+
const values2 = stack && parsed._stacks[scale.axis];
|
|
3688
|
+
if (stack && values2) {
|
|
3689
|
+
stack.values = values2;
|
|
3690
3690
|
value = applyStack$1(stack, parsedValue, this._cachedMeta.index);
|
|
3691
3691
|
}
|
|
3692
3692
|
range.min = Math.min(range.min, value);
|
|
@@ -3732,15 +3732,15 @@ let DatasetController$1 = (_a = class {
|
|
|
3732
3732
|
}
|
|
3733
3733
|
getAllParsedValues(scale) {
|
|
3734
3734
|
const parsed = this._cachedMeta._parsed;
|
|
3735
|
-
const
|
|
3735
|
+
const values2 = [];
|
|
3736
3736
|
let i2, ilen, value;
|
|
3737
3737
|
for (i2 = 0, ilen = parsed.length; i2 < ilen; ++i2) {
|
|
3738
3738
|
value = parsed[i2][scale.axis];
|
|
3739
3739
|
if (isNumberFinite$1(value)) {
|
|
3740
|
-
|
|
3740
|
+
values2.push(value);
|
|
3741
3741
|
}
|
|
3742
3742
|
}
|
|
3743
|
-
return
|
|
3743
|
+
return values2;
|
|
3744
3744
|
}
|
|
3745
3745
|
getMaxOverflow() {
|
|
3746
3746
|
return false;
|
|
@@ -3842,12 +3842,12 @@ let DatasetController$1 = (_a = class {
|
|
|
3842
3842
|
const scopes = config2.getOptionScopes(this.getDataset(), scopeKeys);
|
|
3843
3843
|
const names2 = Object.keys(defaults$2.elements[elementType]);
|
|
3844
3844
|
const context = () => this.getContext(index2, active, mode);
|
|
3845
|
-
const
|
|
3846
|
-
if (
|
|
3847
|
-
|
|
3848
|
-
cache2[cacheKey] = Object.freeze(cloneIfNotShared$1(
|
|
3845
|
+
const values2 = config2.resolveNamedOptions(scopes, names2, context, prefixes);
|
|
3846
|
+
if (values2.$shared) {
|
|
3847
|
+
values2.$shared = sharing;
|
|
3848
|
+
cache2[cacheKey] = Object.freeze(cloneIfNotShared$1(values2, sharing));
|
|
3849
3849
|
}
|
|
3850
|
-
return
|
|
3850
|
+
return values2;
|
|
3851
3851
|
}
|
|
3852
3852
|
_resolveAnimations(index2, transition, active) {
|
|
3853
3853
|
const chart2 = this.chart;
|
|
@@ -4043,17 +4043,17 @@ let DatasetController$1 = (_a = class {
|
|
|
4043
4043
|
function getAllScaleValues$1(scale, type) {
|
|
4044
4044
|
if (!scale._cache.$bar) {
|
|
4045
4045
|
const visibleMetas = scale.getMatchingVisibleMetas(type);
|
|
4046
|
-
let
|
|
4046
|
+
let values2 = [];
|
|
4047
4047
|
for (let i2 = 0, ilen = visibleMetas.length; i2 < ilen; i2++) {
|
|
4048
|
-
|
|
4048
|
+
values2 = values2.concat(visibleMetas[i2].controller.getAllParsedValues(scale));
|
|
4049
4049
|
}
|
|
4050
|
-
scale._cache.$bar = _arrayUnique$1(
|
|
4050
|
+
scale._cache.$bar = _arrayUnique$1(values2.sort((a2, b2) => a2 - b2));
|
|
4051
4051
|
}
|
|
4052
4052
|
return scale._cache.$bar;
|
|
4053
4053
|
}
|
|
4054
4054
|
function computeMinSampleSize$1(meta) {
|
|
4055
4055
|
const scale = meta.iScale;
|
|
4056
|
-
const
|
|
4056
|
+
const values2 = getAllScaleValues$1(scale, meta.type);
|
|
4057
4057
|
let min = scale._length;
|
|
4058
4058
|
let i2, ilen, curr, prev;
|
|
4059
4059
|
const updateMinAndPrev = () => {
|
|
@@ -4065,8 +4065,8 @@ function computeMinSampleSize$1(meta) {
|
|
|
4065
4065
|
}
|
|
4066
4066
|
prev = curr;
|
|
4067
4067
|
};
|
|
4068
|
-
for (i2 = 0, ilen =
|
|
4069
|
-
curr = scale.getPixelForValue(
|
|
4068
|
+
for (i2 = 0, ilen = values2.length; i2 < ilen; ++i2) {
|
|
4069
|
+
curr = scale.getPixelForValue(values2[i2]);
|
|
4070
4070
|
updateMinAndPrev();
|
|
4071
4071
|
}
|
|
4072
4072
|
prev = void 0;
|
|
@@ -12438,13 +12438,13 @@ function setMajorTicks$1(scale, ticks, map2, majorUnit) {
|
|
|
12438
12438
|
}
|
|
12439
12439
|
return ticks;
|
|
12440
12440
|
}
|
|
12441
|
-
function ticksFromTimestamps$1(scale,
|
|
12441
|
+
function ticksFromTimestamps$1(scale, values2, majorUnit) {
|
|
12442
12442
|
const ticks = [];
|
|
12443
12443
|
const map2 = {};
|
|
12444
|
-
const ilen =
|
|
12444
|
+
const ilen = values2.length;
|
|
12445
12445
|
let i2, value;
|
|
12446
12446
|
for (i2 = 0; i2 < ilen; ++i2) {
|
|
12447
|
-
value =
|
|
12447
|
+
value = values2[i2];
|
|
12448
12448
|
map2[value] = i2;
|
|
12449
12449
|
ticks.push({
|
|
12450
12450
|
value,
|
|
@@ -12716,8 +12716,8 @@ let TimeScale$1 = (_p = class extends Scale$1 {
|
|
|
12716
12716
|
}
|
|
12717
12717
|
return this._cache.labels = this._normalized ? timestamps : this.normalize(timestamps);
|
|
12718
12718
|
}
|
|
12719
|
-
normalize(
|
|
12720
|
-
return _arrayUnique$1(
|
|
12719
|
+
normalize(values2) {
|
|
12720
|
+
return _arrayUnique$1(values2.sort(sorter$1));
|
|
12721
12721
|
}
|
|
12722
12722
|
}, __publicField(_p, "id", "time"), __publicField(_p, "defaults", {
|
|
12723
12723
|
bounds: "data",
|
|
@@ -13116,19 +13116,19 @@ var hammer = { exports: {} };
|
|
|
13116
13116
|
}
|
|
13117
13117
|
return false;
|
|
13118
13118
|
}
|
|
13119
|
-
function inStr(str,
|
|
13120
|
-
return str.indexOf(
|
|
13119
|
+
function inStr(str, find2) {
|
|
13120
|
+
return str.indexOf(find2) > -1;
|
|
13121
13121
|
}
|
|
13122
13122
|
function splitStr(str) {
|
|
13123
13123
|
return str.trim().split(/\s+/g);
|
|
13124
13124
|
}
|
|
13125
|
-
function inArray(src,
|
|
13125
|
+
function inArray(src, find2, findByKey) {
|
|
13126
13126
|
if (src.indexOf && !findByKey) {
|
|
13127
|
-
return src.indexOf(
|
|
13127
|
+
return src.indexOf(find2);
|
|
13128
13128
|
} else {
|
|
13129
13129
|
var i2 = 0;
|
|
13130
13130
|
while (i2 < src.length) {
|
|
13131
|
-
if (findByKey && src[i2][findByKey] ==
|
|
13131
|
+
if (findByKey && src[i2][findByKey] == find2 || !findByKey && src[i2] === find2) {
|
|
13132
13132
|
return i2;
|
|
13133
13133
|
}
|
|
13134
13134
|
i2++;
|
|
@@ -13141,14 +13141,14 @@ var hammer = { exports: {} };
|
|
|
13141
13141
|
}
|
|
13142
13142
|
function uniqueArray(src, key, sort) {
|
|
13143
13143
|
var results = [];
|
|
13144
|
-
var
|
|
13144
|
+
var values2 = [];
|
|
13145
13145
|
var i2 = 0;
|
|
13146
13146
|
while (i2 < src.length) {
|
|
13147
13147
|
var val = key ? src[i2][key] : src[i2];
|
|
13148
|
-
if (inArray(
|
|
13148
|
+
if (inArray(values2, val) < 0) {
|
|
13149
13149
|
results.push(src[i2]);
|
|
13150
13150
|
}
|
|
13151
|
-
|
|
13151
|
+
values2[i2] = val;
|
|
13152
13152
|
i2++;
|
|
13153
13153
|
}
|
|
13154
13154
|
if (sort) {
|
|
@@ -22075,7 +22075,6 @@ const TOGGLE_PAN = "TOGGLE_PAN";
|
|
|
22075
22075
|
const TOGGLE_POINTS = "TOGGLE_POINTS";
|
|
22076
22076
|
const TOGGLE_LINE = "TOGGLE_LINE";
|
|
22077
22077
|
const TOGGLE_LEGEND = "TOGGLE_LEGEND";
|
|
22078
|
-
const TOGGLE_ANNOTATION = "TOGGLE_ANNOTATION";
|
|
22079
22078
|
const TOGGLE_TABLE = "TOGGLE_TABLE";
|
|
22080
22079
|
const SAVE_INITIAL_AXES_RANGES = "SAVE_INITIAL_AXES_RANGES";
|
|
22081
22080
|
const RESET_AXES_RANGES = "RESET_AXES_RANGES";
|
|
@@ -22084,7 +22083,6 @@ const TOGGLE_DRAG_POINTS = "TOGGLE_DRAG_POINTS";
|
|
|
22084
22083
|
const DISABLE_DRAG_OPTIONS = "DISABLE_DRAG_OPTIONS";
|
|
22085
22084
|
const reducer$1 = (state, action) => {
|
|
22086
22085
|
return produce(state, (draft) => {
|
|
22087
|
-
var _a2;
|
|
22088
22086
|
switch (action.type) {
|
|
22089
22087
|
case TOGGLE_ZOOM: {
|
|
22090
22088
|
draft.zoomEnabled = !draft.zoomEnabled;
|
|
@@ -22140,16 +22138,6 @@ const reducer$1 = (state, action) => {
|
|
|
22140
22138
|
}));
|
|
22141
22139
|
break;
|
|
22142
22140
|
}
|
|
22143
|
-
case TOGGLE_ANNOTATION: {
|
|
22144
|
-
const { annotationIndex } = action.payload;
|
|
22145
|
-
const updatedIndexes = ((_a2 = draft == null ? void 0 : draft.showAnnotationLineIndex) == null ? void 0 : _a2.includes(
|
|
22146
|
-
annotationIndex
|
|
22147
|
-
)) ? draft.showAnnotationLineIndex.filter(
|
|
22148
|
-
(v2) => v2 !== annotationIndex
|
|
22149
|
-
) : [...(draft == null ? void 0 : draft.showAnnotationLineIndex) ?? [], annotationIndex];
|
|
22150
|
-
draft.showAnnotationLineIndex = updatedIndexes;
|
|
22151
|
-
break;
|
|
22152
|
-
}
|
|
22153
22141
|
case TOGGLE_DRAG_POINTS: {
|
|
22154
22142
|
draft.enableDragPoints = !draft.enableDragPoints;
|
|
22155
22143
|
if (draft.panEnabled) {
|
|
@@ -22418,9 +22406,6 @@ const generateRandomColor = (colors2) => {
|
|
|
22418
22406
|
return colors2;
|
|
22419
22407
|
}
|
|
22420
22408
|
};
|
|
22421
|
-
const setAnnotations = (annotationsData) => {
|
|
22422
|
-
return (annotationsData == null ? void 0 : annotationsData.length) ? annotationsData.map((_2, i2) => i2) : [];
|
|
22423
|
-
};
|
|
22424
22409
|
const getTitle = (options) => {
|
|
22425
22410
|
return options.title !== "" ? {
|
|
22426
22411
|
display: true,
|
|
@@ -22523,8 +22508,8 @@ const getAxisTypeFromKey = (string) => {
|
|
|
22523
22508
|
var _a2;
|
|
22524
22509
|
return ((_a2 = string == null ? void 0 : string.match(/[^0-9/]+/gi)) == null ? void 0 : _a2[0]) ?? "";
|
|
22525
22510
|
};
|
|
22526
|
-
const generateKey = (
|
|
22527
|
-
const key =
|
|
22511
|
+
const generateKey = (values2) => {
|
|
22512
|
+
const key = values2.join("");
|
|
22528
22513
|
return key;
|
|
22529
22514
|
};
|
|
22530
22515
|
const isPrimitiveValue = (value) => typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value === null;
|
|
@@ -22579,7 +22564,6 @@ const storeChartStateInStorage = (state, persistenceId) => {
|
|
|
22579
22564
|
const initialState = ({ options, persistenceId }) => {
|
|
22580
22565
|
const {
|
|
22581
22566
|
additionalAxesOptions: { range: customAxesRange = {} },
|
|
22582
|
-
annotations: { annotationsData = [] },
|
|
22583
22567
|
axes,
|
|
22584
22568
|
chartOptions: { enableZoom, enablePan, showPoints, showLine },
|
|
22585
22569
|
legend: { display },
|
|
@@ -22639,7 +22623,6 @@ const initialState = ({ options, persistenceId }) => {
|
|
|
22639
22623
|
lineEnabled: lineEnabled ?? showLine,
|
|
22640
22624
|
legendEnabled: legendEnabled ?? display,
|
|
22641
22625
|
axes: stateAxes,
|
|
22642
|
-
showAnnotationLineIndex: setAnnotations(annotationsData),
|
|
22643
22626
|
showTable: false,
|
|
22644
22627
|
enableDragPoints: (dragData == null ? void 0 : dragData.enableDragData) && enableDragPoints,
|
|
22645
22628
|
initialAxesRanges: []
|
|
@@ -24486,6 +24469,9 @@ const defaultGraph$2 = (graph) => ({
|
|
|
24486
24469
|
showDataLabels: (graph == null ? void 0 : graph.showDataLabels) ?? false,
|
|
24487
24470
|
showMinorGridlines: (graph == null ? void 0 : graph.showMinorGridlines) ?? false
|
|
24488
24471
|
});
|
|
24472
|
+
const defaultAnnotationsData$1 = (annotationsData) => {
|
|
24473
|
+
return annotationsData ? annotationsData.map((ann) => ({ ...ann, display: (ann == null ? void 0 : ann.display) ?? true })) : [];
|
|
24474
|
+
};
|
|
24489
24475
|
const defaultAnnotations$1 = (annotations) => {
|
|
24490
24476
|
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
|
|
24491
24477
|
return {
|
|
@@ -24501,7 +24487,7 @@ const defaultAnnotations$1 = (annotations) => {
|
|
|
24501
24487
|
},
|
|
24502
24488
|
showAnnotations: (annotations == null ? void 0 : annotations.showAnnotations) ?? false,
|
|
24503
24489
|
controlAnnotation: (annotations == null ? void 0 : annotations.controlAnnotation) ?? false,
|
|
24504
|
-
annotationsData: (annotations == null ? void 0 : annotations.annotationsData)
|
|
24490
|
+
annotationsData: defaultAnnotationsData$1(annotations == null ? void 0 : annotations.annotationsData)
|
|
24505
24491
|
};
|
|
24506
24492
|
};
|
|
24507
24493
|
const defaultLegend$2 = (legend2) => ({
|
|
@@ -25097,46 +25083,51 @@ const getDraggableData = (options) => {
|
|
|
25097
25083
|
}
|
|
25098
25084
|
} : {};
|
|
25099
25085
|
};
|
|
25100
|
-
const
|
|
25101
|
-
const TOGGLE_ANNOTATION_VISIBILITY = "TOGGLE_ANNOTATION_VISIBILITY";
|
|
25086
|
+
const TOGGLE_DATA_VISIBILITY = "TOGGLE_DATA_VISIBILITY";
|
|
25102
25087
|
const RESET_STATE = "RESET_STATE";
|
|
25103
25088
|
const legendInitialState = {
|
|
25104
|
-
|
|
25105
|
-
annotation: [],
|
|
25106
|
-
visibleAnnotationsIndexes: []
|
|
25089
|
+
annotation: []
|
|
25107
25090
|
};
|
|
25108
25091
|
const legendReducer = (state, action) => {
|
|
25092
|
+
var _a2;
|
|
25109
25093
|
switch (action.type) {
|
|
25110
25094
|
case RESET_STATE: {
|
|
25111
25095
|
return action.payload;
|
|
25112
25096
|
}
|
|
25113
|
-
case
|
|
25114
|
-
const {
|
|
25115
|
-
const
|
|
25116
|
-
|
|
25097
|
+
case TOGGLE_DATA_VISIBILITY: {
|
|
25098
|
+
const { chartInstance, dsConfig, annotationConfig } = action.payload;
|
|
25099
|
+
const { datasetIndex, datasets, dataset } = dsConfig;
|
|
25100
|
+
const { annotationIndex } = annotationConfig;
|
|
25101
|
+
const updatedState = cloneDeep(state);
|
|
25102
|
+
const isDatasetVisible = defaultTo(
|
|
25103
|
+
chartInstance == null ? void 0 : chartInstance.isDatasetVisible(datasetIndex),
|
|
25104
|
+
true
|
|
25117
25105
|
);
|
|
25118
|
-
|
|
25119
|
-
|
|
25120
|
-
|
|
25121
|
-
|
|
25122
|
-
|
|
25106
|
+
if (datasetIndex >= 0) {
|
|
25107
|
+
chartInstance == null ? void 0 : chartInstance.setDatasetVisibility(datasetIndex, !isDatasetVisible);
|
|
25108
|
+
if (dataset == null ? void 0 : dataset.displayGroup) {
|
|
25109
|
+
const group = dataset.displayGroup;
|
|
25110
|
+
datasets.forEach((ds, ix) => {
|
|
25111
|
+
if (ds.displayGroup === group) {
|
|
25112
|
+
chartInstance == null ? void 0 : chartInstance.setDatasetVisibility(
|
|
25113
|
+
Number(ix),
|
|
25114
|
+
!isDatasetVisible
|
|
25115
|
+
);
|
|
25116
|
+
}
|
|
25117
|
+
});
|
|
25118
|
+
}
|
|
25123
25119
|
}
|
|
25124
|
-
|
|
25125
|
-
|
|
25126
|
-
|
|
25127
|
-
|
|
25128
|
-
|
|
25129
|
-
|
|
25130
|
-
|
|
25131
|
-
|
|
25132
|
-
|
|
25133
|
-
|
|
25134
|
-
|
|
25135
|
-
return {
|
|
25136
|
-
...state,
|
|
25137
|
-
annotation: annotation2,
|
|
25138
|
-
visibleAnnotationsIndexes: newVisibleIndexes
|
|
25139
|
-
};
|
|
25120
|
+
if (annotationIndex >= 0) {
|
|
25121
|
+
const idx = findIndex(updatedState.annotation, { annotationIndex });
|
|
25122
|
+
if (idx >= 0) {
|
|
25123
|
+
const currentDisplay = defaultTo(
|
|
25124
|
+
(_a2 = updatedState.annotation[idx]) == null ? void 0 : _a2.display,
|
|
25125
|
+
false
|
|
25126
|
+
);
|
|
25127
|
+
set$2(updatedState, ["annotation", idx, "display"], !currentDisplay);
|
|
25128
|
+
}
|
|
25129
|
+
}
|
|
25130
|
+
return updatedState;
|
|
25140
25131
|
}
|
|
25141
25132
|
default:
|
|
25142
25133
|
return state;
|
|
@@ -25168,70 +25159,67 @@ const annotationLeave = (element, chart2) => {
|
|
|
25168
25159
|
chart2.canvas.style.cursor = CursorStyle.Initial;
|
|
25169
25160
|
return true;
|
|
25170
25161
|
};
|
|
25171
|
-
const generateAnnotations = (annotationsData
|
|
25162
|
+
const generateAnnotations = (annotationsData) => {
|
|
25172
25163
|
return annotationsData == null ? void 0 : annotationsData.map((ann, idx) => {
|
|
25173
|
-
|
|
25174
|
-
|
|
25175
|
-
|
|
25176
|
-
|
|
25177
|
-
|
|
25178
|
-
|
|
25179
|
-
|
|
25180
|
-
|
|
25181
|
-
|
|
25182
|
-
|
|
25183
|
-
|
|
25184
|
-
|
|
25185
|
-
|
|
25186
|
-
|
|
25187
|
-
|
|
25188
|
-
|
|
25189
|
-
|
|
25190
|
-
|
|
25191
|
-
|
|
25192
|
-
|
|
25193
|
-
|
|
25194
|
-
|
|
25195
|
-
|
|
25196
|
-
|
|
25197
|
-
|
|
25198
|
-
|
|
25199
|
-
|
|
25200
|
-
|
|
25201
|
-
|
|
25202
|
-
|
|
25203
|
-
|
|
25204
|
-
|
|
25205
|
-
|
|
25206
|
-
|
|
25207
|
-
|
|
25208
|
-
|
|
25209
|
-
|
|
25210
|
-
|
|
25211
|
-
|
|
25212
|
-
|
|
25213
|
-
|
|
25214
|
-
|
|
25215
|
-
|
|
25216
|
-
|
|
25217
|
-
|
|
25218
|
-
|
|
25219
|
-
|
|
25220
|
-
|
|
25221
|
-
|
|
25222
|
-
|
|
25223
|
-
|
|
25224
|
-
};
|
|
25225
|
-
}
|
|
25164
|
+
const scaleID = (ann == null ? void 0 : ann.annotationAxis) ?? void 0;
|
|
25165
|
+
const color2 = (ann == null ? void 0 : ann.color) || COLORS[idx];
|
|
25166
|
+
const type = (ann == null ? void 0 : ann.type) || "line";
|
|
25167
|
+
const adjustScaleRange2 = ann == null ? void 0 : ann.adjustScaleRange;
|
|
25168
|
+
const borderColor = type === "line" ? color2 : "transparent";
|
|
25169
|
+
const borderWidth = type === "line" ? BORDER_WIDTH.INITIAL : 0;
|
|
25170
|
+
const borderDash = ANNOTATION_DASH;
|
|
25171
|
+
const label = type === "line" ? {
|
|
25172
|
+
backgroundColor: color2,
|
|
25173
|
+
content: ann == null ? void 0 : ann.label,
|
|
25174
|
+
display: false,
|
|
25175
|
+
position: Position.Top
|
|
25176
|
+
} : {
|
|
25177
|
+
content: ann == null ? void 0 : ann.label,
|
|
25178
|
+
display: true,
|
|
25179
|
+
font: { weight: "normal" }
|
|
25180
|
+
};
|
|
25181
|
+
const enter = ({
|
|
25182
|
+
element
|
|
25183
|
+
}, {
|
|
25184
|
+
chart: chart2
|
|
25185
|
+
}) => {
|
|
25186
|
+
if (type !== "line")
|
|
25187
|
+
return;
|
|
25188
|
+
annotationEnter(element, chart2);
|
|
25189
|
+
};
|
|
25190
|
+
const leave = ({
|
|
25191
|
+
element
|
|
25192
|
+
}, {
|
|
25193
|
+
chart: chart2
|
|
25194
|
+
}) => {
|
|
25195
|
+
if (type !== "line")
|
|
25196
|
+
return;
|
|
25197
|
+
annotationLeave(element, chart2);
|
|
25198
|
+
};
|
|
25199
|
+
return {
|
|
25200
|
+
...ann,
|
|
25201
|
+
display: ann == null ? void 0 : ann.display,
|
|
25202
|
+
annotationIndex: idx,
|
|
25203
|
+
id: `${ann == null ? void 0 : ann.label}-${ann == null ? void 0 : ann.value}-${idx}`,
|
|
25204
|
+
scaleID,
|
|
25205
|
+
label,
|
|
25206
|
+
backgroundColor: color2,
|
|
25207
|
+
borderColor,
|
|
25208
|
+
borderWidth,
|
|
25209
|
+
borderDash,
|
|
25210
|
+
type,
|
|
25211
|
+
adjustScaleRange: adjustScaleRange2,
|
|
25212
|
+
enter,
|
|
25213
|
+
leave
|
|
25214
|
+
};
|
|
25226
25215
|
});
|
|
25227
25216
|
};
|
|
25228
25217
|
const getAnnotation = ({
|
|
25229
25218
|
showAnnotations,
|
|
25230
|
-
annotationsData
|
|
25231
|
-
visibleAnnotationsIndexes
|
|
25219
|
+
annotationsData
|
|
25232
25220
|
}) => {
|
|
25233
25221
|
const shouldGenerateAnnotations = showAnnotations && annotationsData && (annotationsData == null ? void 0 : annotationsData.length);
|
|
25234
|
-
return shouldGenerateAnnotations ? generateAnnotations(annotationsData
|
|
25222
|
+
return shouldGenerateAnnotations ? generateAnnotations(annotationsData) ?? [] : [];
|
|
25235
25223
|
};
|
|
25236
25224
|
const useReset = (state, dispatch, dependencies) => {
|
|
25237
25225
|
const prevState = useRef(state);
|
|
@@ -25245,16 +25233,13 @@ const useReset = (state, dispatch, dependencies) => {
|
|
|
25245
25233
|
const LegendContext = createContext$2(void 0);
|
|
25246
25234
|
const LegendProvider = ({ children, options }) => {
|
|
25247
25235
|
const { showAnnotations = true, annotationsData = [] } = (options == null ? void 0 : options.annotations) ?? {};
|
|
25248
|
-
const visibleAnnotationsIndexes = setAnnotations(annotationsData);
|
|
25249
25236
|
const annotation2 = getAnnotation({
|
|
25250
25237
|
showAnnotations,
|
|
25251
|
-
annotationsData
|
|
25252
|
-
visibleAnnotationsIndexes
|
|
25238
|
+
annotationsData
|
|
25253
25239
|
});
|
|
25254
25240
|
const initialState2 = {
|
|
25255
25241
|
...legendInitialState,
|
|
25256
|
-
annotation: annotation2
|
|
25257
|
-
visibleAnnotationsIndexes
|
|
25242
|
+
annotation: annotation2
|
|
25258
25243
|
};
|
|
25259
25244
|
const [state, dispatch] = useReducer(
|
|
25260
25245
|
legendReducer,
|
|
@@ -25275,71 +25260,44 @@ const useLegend = () => {
|
|
|
25275
25260
|
return context;
|
|
25276
25261
|
};
|
|
25277
25262
|
const useLegendState = ({ chartRef, options }) => {
|
|
25278
|
-
const [hiddenStatesLocal, setHiddenStatesLocal] = useState(
|
|
25279
|
-
[]
|
|
25280
|
-
);
|
|
25281
25263
|
const { state, dispatch } = useLegend();
|
|
25282
25264
|
const {
|
|
25283
25265
|
annotations,
|
|
25284
25266
|
interactions: { onLegendClick },
|
|
25285
25267
|
legend: { customLegend }
|
|
25286
25268
|
} = options ?? {};
|
|
25287
|
-
const upsertHiddenState = useCallback(
|
|
25288
|
-
({ label, datasetIndex, hidden }) => {
|
|
25289
|
-
setHiddenStatesLocal((prevStates) => {
|
|
25290
|
-
const existingIndex = prevStates.findIndex(
|
|
25291
|
-
(state2) => state2.label === label
|
|
25292
|
-
);
|
|
25293
|
-
const newStates = [...prevStates];
|
|
25294
|
-
const newState = { label, datasetIndex, hidden };
|
|
25295
|
-
if (existingIndex !== -1) {
|
|
25296
|
-
newStates[existingIndex] = newState;
|
|
25297
|
-
} else {
|
|
25298
|
-
newStates.push(newState);
|
|
25299
|
-
}
|
|
25300
|
-
return newStates;
|
|
25301
|
-
});
|
|
25302
|
-
dispatch({ type: UPSERT_HIDDEN_STATE, payload: hiddenStatesLocal });
|
|
25303
|
-
},
|
|
25304
|
-
[dispatch]
|
|
25305
|
-
);
|
|
25306
25269
|
const legendClick = useCallback(
|
|
25307
25270
|
(_2, legendItem2) => {
|
|
25308
|
-
|
|
25271
|
+
var _a2;
|
|
25272
|
+
const { datasetIndex = -1 } = legendItem2;
|
|
25273
|
+
let annotationIndex = null;
|
|
25309
25274
|
const chartInstance = chartRef == null ? void 0 : chartRef.current;
|
|
25310
|
-
const
|
|
25311
|
-
const dataset =
|
|
25312
|
-
const meta = chartInstance == null ? void 0 : chartInstance.getDatasetMeta(datasetIndex);
|
|
25313
|
-
const isDatasetVisible = (chartInstance == null ? void 0 : chartInstance.isDatasetVisible(datasetIndex)) ?? true;
|
|
25314
|
-
upsertHiddenState({
|
|
25315
|
-
label: dataset.label ?? "",
|
|
25316
|
-
datasetIndex,
|
|
25317
|
-
hidden: isDatasetVisible
|
|
25318
|
-
});
|
|
25319
|
-
chartInstance == null ? void 0 : chartInstance.setDatasetVisibility(datasetIndex, !isDatasetVisible);
|
|
25275
|
+
const datasets = ((_a2 = chartInstance == null ? void 0 : chartInstance.data) == null ? void 0 : _a2.datasets) ?? [];
|
|
25276
|
+
const dataset = datasets[datasetIndex] ?? {};
|
|
25320
25277
|
if ((annotations == null ? void 0 : annotations.controlAnnotation) && (dataset == null ? void 0 : dataset.isAnnotation)) {
|
|
25321
|
-
|
|
25322
|
-
dispatch({
|
|
25323
|
-
type: TOGGLE_ANNOTATION_VISIBILITY,
|
|
25324
|
-
payload: annotationIndex
|
|
25325
|
-
});
|
|
25326
|
-
}
|
|
25327
|
-
if (dataset == null ? void 0 : dataset.displayGroup) {
|
|
25328
|
-
datasets == null ? void 0 : datasets.forEach((ds, ix) => {
|
|
25329
|
-
if (ds.displayGroup !== dataset.displayGroup)
|
|
25330
|
-
return;
|
|
25331
|
-
if (chartInstance && meta) {
|
|
25332
|
-
chartInstance.getDatasetMeta(ix).hidden = meta.hidden;
|
|
25333
|
-
}
|
|
25334
|
-
});
|
|
25278
|
+
annotationIndex = dataset.annotationIndex ?? null;
|
|
25335
25279
|
}
|
|
25336
25280
|
if (onLegendClick) {
|
|
25337
25281
|
const legendState = legendItem2.hidden ?? false;
|
|
25338
25282
|
onLegendClick(legendItem2 == null ? void 0 : legendItem2.text, legendState);
|
|
25339
25283
|
}
|
|
25284
|
+
dispatch({
|
|
25285
|
+
type: TOGGLE_DATA_VISIBILITY,
|
|
25286
|
+
payload: {
|
|
25287
|
+
chartInstance,
|
|
25288
|
+
dsConfig: {
|
|
25289
|
+
datasetIndex,
|
|
25290
|
+
datasets,
|
|
25291
|
+
dataset
|
|
25292
|
+
},
|
|
25293
|
+
annotationConfig: {
|
|
25294
|
+
annotationIndex
|
|
25295
|
+
}
|
|
25296
|
+
}
|
|
25297
|
+
});
|
|
25340
25298
|
chartInstance == null ? void 0 : chartInstance.update();
|
|
25341
25299
|
},
|
|
25342
|
-
[chartRef, annotations,
|
|
25300
|
+
[chartRef, annotations, dispatch]
|
|
25343
25301
|
);
|
|
25344
25302
|
const legend2 = useMemo(
|
|
25345
25303
|
() => getLegend(options, legendClick),
|
|
@@ -25355,11 +25313,9 @@ const useLegendState = ({ chartRef, options }) => {
|
|
|
25355
25313
|
);
|
|
25356
25314
|
return {
|
|
25357
25315
|
legendClick,
|
|
25358
|
-
|
|
25316
|
+
annotation: state.annotation,
|
|
25359
25317
|
legend: legend2,
|
|
25360
|
-
customLegendPlugin
|
|
25361
|
-
upsertHiddenState,
|
|
25362
|
-
visibleAnnotationsIndexes: state.visibleAnnotationsIndexes
|
|
25318
|
+
customLegendPlugin
|
|
25363
25319
|
};
|
|
25364
25320
|
};
|
|
25365
25321
|
const toAnnotationObject = (annotationArr = []) => {
|
|
@@ -26046,9 +26002,37 @@ const LegendItem = ({
|
|
|
26046
26002
|
}
|
|
26047
26003
|
);
|
|
26048
26004
|
};
|
|
26049
|
-
const
|
|
26005
|
+
const generateAnnotationLabels = (chart2) => {
|
|
26006
|
+
const annotations = cloneDeep(
|
|
26007
|
+
get$1(chart2, "options.plugins.annotation.annotations", {})
|
|
26008
|
+
);
|
|
26009
|
+
if (!annotations || !Object.keys(annotations).length) {
|
|
26010
|
+
return [];
|
|
26011
|
+
}
|
|
26012
|
+
return values(annotations);
|
|
26013
|
+
};
|
|
26014
|
+
const generatedLabels = (chart2) => {
|
|
26050
26015
|
var _a2, _b2, _c2, _d2, _e2;
|
|
26051
|
-
return (
|
|
26016
|
+
return cloneDeep(
|
|
26017
|
+
(_e2 = (_d2 = (_c2 = (_b2 = (_a2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a2.plugins) == null ? void 0 : _b2.legend) == null ? void 0 : _c2.labels) == null ? void 0 : _d2.generateLabels) == null ? void 0 : _e2.call(_d2, chart2)
|
|
26018
|
+
) ?? [];
|
|
26019
|
+
};
|
|
26020
|
+
const getGeneratedLabels = (chart2) => {
|
|
26021
|
+
const datasetLabels = generatedLabels(chart2);
|
|
26022
|
+
const annotationLabels = generateAnnotationLabels(chart2);
|
|
26023
|
+
return map$3(datasetLabels, (el) => {
|
|
26024
|
+
const annotation2 = find(
|
|
26025
|
+
annotationLabels,
|
|
26026
|
+
(item) => {
|
|
26027
|
+
var _a2;
|
|
26028
|
+
return el.text === ((_a2 = item == null ? void 0 : item.label) == null ? void 0 : _a2.content);
|
|
26029
|
+
}
|
|
26030
|
+
);
|
|
26031
|
+
return annotation2 ? {
|
|
26032
|
+
...el,
|
|
26033
|
+
hidden: !(annotation2 == null ? void 0 : annotation2.display)
|
|
26034
|
+
} : el;
|
|
26035
|
+
});
|
|
26052
26036
|
};
|
|
26053
26037
|
const useGeneratedLabels = (chartRef, generatedDatasets) => {
|
|
26054
26038
|
const [items, setItems] = useState([]);
|
|
@@ -26077,20 +26061,17 @@ const createLegendStyle = (legendPosition, chart2) => {
|
|
|
26077
26061
|
};
|
|
26078
26062
|
const LegendItems = ({
|
|
26079
26063
|
items,
|
|
26080
|
-
hiddenStates,
|
|
26081
26064
|
datasets,
|
|
26082
26065
|
legendClick,
|
|
26083
26066
|
chartType
|
|
26084
26067
|
}) => /* @__PURE__ */ jsx("div", { className: styles$2.legendItems, children: items.map((item) => {
|
|
26085
|
-
var _a2;
|
|
26086
26068
|
if (datasets[item.datasetIndex].hideLegend) {
|
|
26087
26069
|
return null;
|
|
26088
26070
|
}
|
|
26089
|
-
const hiddenState = ((_a2 = hiddenStates.find((state) => state.label === item.text)) == null ? void 0 : _a2.hidden) ?? false;
|
|
26090
26071
|
return /* @__PURE__ */ jsx(
|
|
26091
26072
|
LegendItem,
|
|
26092
26073
|
{
|
|
26093
|
-
hidden:
|
|
26074
|
+
hidden: item.hidden,
|
|
26094
26075
|
dataset: datasets[item.datasetIndex],
|
|
26095
26076
|
handleClick: (_2) => legendClick(_2, item),
|
|
26096
26077
|
chartType
|
|
@@ -26104,7 +26085,7 @@ const LegendPanel = forwardRef(
|
|
|
26104
26085
|
const chart2 = chartRef == null ? void 0 : chartRef.current;
|
|
26105
26086
|
const { options, generatedDatasets, chartType } = legendConfig;
|
|
26106
26087
|
const datasets = (_a2 = chart2 == null ? void 0 : chart2.data) == null ? void 0 : _a2.datasets;
|
|
26107
|
-
const { legend: legend2, legendClick
|
|
26088
|
+
const { legend: legend2, legendClick } = useLegendState({
|
|
26108
26089
|
chartRef,
|
|
26109
26090
|
options
|
|
26110
26091
|
});
|
|
@@ -26135,7 +26116,6 @@ const LegendPanel = forwardRef(
|
|
|
26135
26116
|
LegendItems,
|
|
26136
26117
|
{
|
|
26137
26118
|
items,
|
|
26138
|
-
hiddenStates,
|
|
26139
26119
|
datasets,
|
|
26140
26120
|
legendClick,
|
|
26141
26121
|
chartType
|
|
@@ -27046,16 +27026,16 @@ function _lookup(table2, value, cmp) {
|
|
|
27046
27026
|
}
|
|
27047
27027
|
const _lookupByKey = (table2, key, value, last) => _lookup(table2, value, last ? (index2) => table2[index2][key] <= value : (index2) => table2[index2][key] < value);
|
|
27048
27028
|
const _rlookupByKey = (table2, key, value) => _lookup(table2, value, (index2) => table2[index2][key] >= value);
|
|
27049
|
-
function _filterBetween(
|
|
27029
|
+
function _filterBetween(values2, min, max) {
|
|
27050
27030
|
let start = 0;
|
|
27051
|
-
let end =
|
|
27052
|
-
while (start < end &&
|
|
27031
|
+
let end = values2.length;
|
|
27032
|
+
while (start < end && values2[start] < min) {
|
|
27053
27033
|
start++;
|
|
27054
27034
|
}
|
|
27055
|
-
while (end > start &&
|
|
27035
|
+
while (end > start && values2[end - 1] > max) {
|
|
27056
27036
|
end--;
|
|
27057
27037
|
}
|
|
27058
|
-
return start > 0 || end <
|
|
27038
|
+
return start > 0 || end < values2.length ? values2.slice(start, end) : values2;
|
|
27059
27039
|
}
|
|
27060
27040
|
const arrayEvents = ["push", "pop", "shift", "splice", "unshift"];
|
|
27061
27041
|
function listenArrayEvents(array, listener) {
|
|
@@ -27858,9 +27838,9 @@ function getScope$1(node, key) {
|
|
|
27858
27838
|
}
|
|
27859
27839
|
return node;
|
|
27860
27840
|
}
|
|
27861
|
-
function set(root, scope2,
|
|
27841
|
+
function set(root, scope2, values2) {
|
|
27862
27842
|
if (typeof scope2 === "string") {
|
|
27863
|
-
return merge(getScope$1(root, scope2),
|
|
27843
|
+
return merge(getScope$1(root, scope2), values2);
|
|
27864
27844
|
}
|
|
27865
27845
|
return merge(getScope$1(root, ""), scope2);
|
|
27866
27846
|
}
|
|
@@ -27909,17 +27889,17 @@ class Defaults2 {
|
|
|
27909
27889
|
this.drawActiveElementsOnTop = true;
|
|
27910
27890
|
this.describe(_descriptors2);
|
|
27911
27891
|
}
|
|
27912
|
-
set(scope2,
|
|
27913
|
-
return set(this, scope2,
|
|
27892
|
+
set(scope2, values2) {
|
|
27893
|
+
return set(this, scope2, values2);
|
|
27914
27894
|
}
|
|
27915
27895
|
get(scope2) {
|
|
27916
27896
|
return getScope$1(this, scope2);
|
|
27917
27897
|
}
|
|
27918
|
-
describe(scope2,
|
|
27919
|
-
return set(descriptors, scope2,
|
|
27898
|
+
describe(scope2, values2) {
|
|
27899
|
+
return set(descriptors, scope2, values2);
|
|
27920
27900
|
}
|
|
27921
|
-
override(scope2,
|
|
27922
|
-
return set(overrides, scope2,
|
|
27901
|
+
override(scope2, values2) {
|
|
27902
|
+
return set(overrides, scope2, values2);
|
|
27923
27903
|
}
|
|
27924
27904
|
route(scope2, name, targetScope, targetName) {
|
|
27925
27905
|
const scopeObject = getScope$1(this, scope2);
|
|
@@ -29584,8 +29564,8 @@ class Animations2 {
|
|
|
29584
29564
|
});
|
|
29585
29565
|
});
|
|
29586
29566
|
}
|
|
29587
|
-
_animateOptions(target,
|
|
29588
|
-
const newOptions =
|
|
29567
|
+
_animateOptions(target, values2) {
|
|
29568
|
+
const newOptions = values2.options;
|
|
29589
29569
|
const options = resolveTargetOptions(target, newOptions);
|
|
29590
29570
|
if (!options) {
|
|
29591
29571
|
return [];
|
|
@@ -29599,11 +29579,11 @@ class Animations2 {
|
|
|
29599
29579
|
}
|
|
29600
29580
|
return animations;
|
|
29601
29581
|
}
|
|
29602
|
-
_createAnimations(target,
|
|
29582
|
+
_createAnimations(target, values2) {
|
|
29603
29583
|
const animatedProps = this._properties;
|
|
29604
29584
|
const animations = [];
|
|
29605
29585
|
const running = target.$animations || (target.$animations = {});
|
|
29606
|
-
const props = Object.keys(
|
|
29586
|
+
const props = Object.keys(values2);
|
|
29607
29587
|
const date = Date.now();
|
|
29608
29588
|
let i2;
|
|
29609
29589
|
for (i2 = props.length - 1; i2 >= 0; --i2) {
|
|
@@ -29612,10 +29592,10 @@ class Animations2 {
|
|
|
29612
29592
|
continue;
|
|
29613
29593
|
}
|
|
29614
29594
|
if (prop === "options") {
|
|
29615
|
-
animations.push(...this._animateOptions(target,
|
|
29595
|
+
animations.push(...this._animateOptions(target, values2));
|
|
29616
29596
|
continue;
|
|
29617
29597
|
}
|
|
29618
|
-
const value =
|
|
29598
|
+
const value = values2[prop];
|
|
29619
29599
|
let animation = running[prop];
|
|
29620
29600
|
const cfg = animatedProps.get(prop);
|
|
29621
29601
|
if (animation) {
|
|
@@ -29635,12 +29615,12 @@ class Animations2 {
|
|
|
29635
29615
|
}
|
|
29636
29616
|
return animations;
|
|
29637
29617
|
}
|
|
29638
|
-
update(target,
|
|
29618
|
+
update(target, values2) {
|
|
29639
29619
|
if (this._properties.size === 0) {
|
|
29640
|
-
Object.assign(target,
|
|
29620
|
+
Object.assign(target, values2);
|
|
29641
29621
|
return;
|
|
29642
29622
|
}
|
|
29643
|
-
const animations = this._createAnimations(target,
|
|
29623
|
+
const animations = this._createAnimations(target, values2);
|
|
29644
29624
|
if (animations.length) {
|
|
29645
29625
|
animator.add(this._chart, animations);
|
|
29646
29626
|
return true;
|
|
@@ -30078,9 +30058,9 @@ class DatasetController {
|
|
|
30078
30058
|
updateRangeFromParsed(range, scale, parsed, stack) {
|
|
30079
30059
|
const parsedValue = parsed[scale.axis];
|
|
30080
30060
|
let value = parsedValue === null ? NaN : parsedValue;
|
|
30081
|
-
const
|
|
30082
|
-
if (stack &&
|
|
30083
|
-
stack.values =
|
|
30061
|
+
const values2 = stack && parsed._stacks[scale.axis];
|
|
30062
|
+
if (stack && values2) {
|
|
30063
|
+
stack.values = values2;
|
|
30084
30064
|
value = applyStack(stack, parsedValue, this._cachedMeta.index);
|
|
30085
30065
|
}
|
|
30086
30066
|
range.min = Math.min(range.min, value);
|
|
@@ -30123,15 +30103,15 @@ class DatasetController {
|
|
|
30123
30103
|
}
|
|
30124
30104
|
getAllParsedValues(scale) {
|
|
30125
30105
|
const parsed = this._cachedMeta._parsed;
|
|
30126
|
-
const
|
|
30106
|
+
const values2 = [];
|
|
30127
30107
|
let i2, ilen, value;
|
|
30128
30108
|
for (i2 = 0, ilen = parsed.length; i2 < ilen; ++i2) {
|
|
30129
30109
|
value = parsed[i2][scale.axis];
|
|
30130
30110
|
if (isNumberFinite(value)) {
|
|
30131
|
-
|
|
30111
|
+
values2.push(value);
|
|
30132
30112
|
}
|
|
30133
30113
|
}
|
|
30134
|
-
return
|
|
30114
|
+
return values2;
|
|
30135
30115
|
}
|
|
30136
30116
|
getMaxOverflow() {
|
|
30137
30117
|
return false;
|
|
@@ -30225,12 +30205,12 @@ class DatasetController {
|
|
|
30225
30205
|
const scopes = config2.getOptionScopes(this.getDataset(), scopeKeys);
|
|
30226
30206
|
const names2 = Object.keys(defaults.elements[elementType]);
|
|
30227
30207
|
const context = () => this.getContext(index2, active);
|
|
30228
|
-
const
|
|
30229
|
-
if (
|
|
30230
|
-
|
|
30231
|
-
cache2[cacheKey] = Object.freeze(cloneIfNotShared(
|
|
30208
|
+
const values2 = config2.resolveNamedOptions(scopes, names2, context, prefixes);
|
|
30209
|
+
if (values2.$shared) {
|
|
30210
|
+
values2.$shared = sharing;
|
|
30211
|
+
cache2[cacheKey] = Object.freeze(cloneIfNotShared(values2, sharing));
|
|
30232
30212
|
}
|
|
30233
|
-
return
|
|
30213
|
+
return values2;
|
|
30234
30214
|
}
|
|
30235
30215
|
_resolveAnimations(index2, transition, active) {
|
|
30236
30216
|
const chart2 = this.chart;
|
|
@@ -30399,17 +30379,17 @@ DatasetController.prototype.dataElementType = null;
|
|
|
30399
30379
|
function getAllScaleValues(scale, type) {
|
|
30400
30380
|
if (!scale._cache.$bar) {
|
|
30401
30381
|
const visibleMetas = scale.getMatchingVisibleMetas(type);
|
|
30402
|
-
let
|
|
30382
|
+
let values2 = [];
|
|
30403
30383
|
for (let i2 = 0, ilen = visibleMetas.length; i2 < ilen; i2++) {
|
|
30404
|
-
|
|
30384
|
+
values2 = values2.concat(visibleMetas[i2].controller.getAllParsedValues(scale));
|
|
30405
30385
|
}
|
|
30406
|
-
scale._cache.$bar = _arrayUnique(
|
|
30386
|
+
scale._cache.$bar = _arrayUnique(values2.sort((a2, b2) => a2 - b2));
|
|
30407
30387
|
}
|
|
30408
30388
|
return scale._cache.$bar;
|
|
30409
30389
|
}
|
|
30410
30390
|
function computeMinSampleSize(meta) {
|
|
30411
30391
|
const scale = meta.iScale;
|
|
30412
|
-
const
|
|
30392
|
+
const values2 = getAllScaleValues(scale, meta.type);
|
|
30413
30393
|
let min = scale._length;
|
|
30414
30394
|
let i2, ilen, curr, prev;
|
|
30415
30395
|
const updateMinAndPrev = () => {
|
|
@@ -30421,8 +30401,8 @@ function computeMinSampleSize(meta) {
|
|
|
30421
30401
|
}
|
|
30422
30402
|
prev = curr;
|
|
30423
30403
|
};
|
|
30424
|
-
for (i2 = 0, ilen =
|
|
30425
|
-
curr = scale.getPixelForValue(
|
|
30404
|
+
for (i2 = 0, ilen = values2.length; i2 < ilen; ++i2) {
|
|
30405
|
+
curr = scale.getPixelForValue(values2[i2]);
|
|
30426
30406
|
updateMinAndPrev();
|
|
30427
30407
|
}
|
|
30428
30408
|
prev = void 0;
|
|
@@ -30922,16 +30902,16 @@ class BubbleController extends DatasetController {
|
|
|
30922
30902
|
}
|
|
30923
30903
|
resolveDataElementOptions(index2, mode) {
|
|
30924
30904
|
const parsed = this.getParsed(index2);
|
|
30925
|
-
let
|
|
30926
|
-
if (
|
|
30927
|
-
|
|
30905
|
+
let values2 = super.resolveDataElementOptions(index2, mode);
|
|
30906
|
+
if (values2.$shared) {
|
|
30907
|
+
values2 = Object.assign({}, values2, { $shared: false });
|
|
30928
30908
|
}
|
|
30929
|
-
const radius =
|
|
30909
|
+
const radius = values2.radius;
|
|
30930
30910
|
if (mode !== "active") {
|
|
30931
|
-
|
|
30911
|
+
values2.radius = 0;
|
|
30932
30912
|
}
|
|
30933
|
-
|
|
30934
|
-
return
|
|
30913
|
+
values2.radius += valueOrDefault(parsed && parsed._custom, radius);
|
|
30914
|
+
return values2;
|
|
30935
30915
|
}
|
|
30936
30916
|
}
|
|
30937
30917
|
BubbleController.id = "bubble";
|
|
@@ -37954,13 +37934,13 @@ function setMajorTicks(scale, ticks, map2, majorUnit) {
|
|
|
37954
37934
|
}
|
|
37955
37935
|
return ticks;
|
|
37956
37936
|
}
|
|
37957
|
-
function ticksFromTimestamps(scale,
|
|
37937
|
+
function ticksFromTimestamps(scale, values2, majorUnit) {
|
|
37958
37938
|
const ticks = [];
|
|
37959
37939
|
const map2 = {};
|
|
37960
|
-
const ilen =
|
|
37940
|
+
const ilen = values2.length;
|
|
37961
37941
|
let i2, value;
|
|
37962
37942
|
for (i2 = 0; i2 < ilen; ++i2) {
|
|
37963
|
-
value =
|
|
37943
|
+
value = values2[i2];
|
|
37964
37944
|
map2[value] = i2;
|
|
37965
37945
|
ticks.push({
|
|
37966
37946
|
value,
|
|
@@ -38210,8 +38190,8 @@ class TimeScale extends Scale2 {
|
|
|
38210
38190
|
}
|
|
38211
38191
|
return this._cache.labels = this._normalized ? timestamps : this.normalize(timestamps);
|
|
38212
38192
|
}
|
|
38213
|
-
normalize(
|
|
38214
|
-
return _arrayUnique(
|
|
38193
|
+
normalize(values2) {
|
|
38194
|
+
return _arrayUnique(values2.sort(sorter));
|
|
38215
38195
|
}
|
|
38216
38196
|
}
|
|
38217
38197
|
TimeScale.id = "time";
|
|
@@ -39457,10 +39437,13 @@ const defaultGraph = (graph) => ({
|
|
|
39457
39437
|
showDataLabels: (graph == null ? void 0 : graph.showDataLabels) || false,
|
|
39458
39438
|
showMinorGridlines: (graph == null ? void 0 : graph.showMinorGridlines) || false
|
|
39459
39439
|
});
|
|
39440
|
+
const defaultAnnotationsData = (annotationsData) => {
|
|
39441
|
+
return annotationsData ? annotationsData.map((ann) => ({ ...ann, display: (ann == null ? void 0 : ann.display) ?? true })) : [];
|
|
39442
|
+
};
|
|
39460
39443
|
const defaultAnnotations = (annotations) => ({
|
|
39461
39444
|
showAnnotations: (annotations == null ? void 0 : annotations.showAnnotations) ?? true,
|
|
39462
39445
|
controlAnnotation: (annotations == null ? void 0 : annotations.controlAnnotation) || false,
|
|
39463
|
-
annotationsData: (annotations == null ? void 0 : annotations.annotationsData)
|
|
39446
|
+
annotationsData: defaultAnnotationsData(annotations == null ? void 0 : annotations.annotationsData)
|
|
39464
39447
|
});
|
|
39465
39448
|
const defaultLegend = (legend2) => ({
|
|
39466
39449
|
display: (legend2 == null ? void 0 : legend2.display) ?? true,
|