@oliasoft-open-source/charts-library 3.7.0-beta-2 → 3.7.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/index.js +706 -683
- package/dist/index.js.map +1 -1
- package/dist/src/components/bar-chart/get-bar-chart-data-labels.d.ts +1 -2
- package/dist/src/components/bar-chart/get-bar-chart-scales.d.ts +1 -2
- package/dist/src/components/common/common.interface.d.ts +2 -1
- package/dist/src/components/common/helpers/chart-border-plugin.d.ts +2 -2
- package/dist/src/components/common/helpers/chart-consts.d.ts +3 -3
- package/dist/src/components/common/helpers/chart-utils.d.ts +91 -0
- package/dist/src/components/common/helpers/get-custom-legend-plugin-example.d.ts +1 -1
- package/dist/src/components/line-chart/controls/axes-options/axes-options-interfaces.d.ts +2 -2
- package/dist/src/components/line-chart/controls/controls-interfaces.d.ts +2 -2
- package/dist/src/components/line-chart/controls/drag-options-interfaces.d.ts +1 -1
- package/dist/src/components/line-chart/controls/line-options.d.ts +2 -1
- package/dist/src/components/line-chart/hooks/use-chart-functions.d.ts +2 -13
- package/dist/src/components/line-chart/hooks/use-chart-plugins.d.ts +7 -0
- package/dist/src/components/line-chart/hooks/use-chart-state.d.ts +2 -3
- package/dist/src/components/line-chart/hooks/use-generated-labels.d.ts +1 -0
- package/dist/src/components/line-chart/hooks/use-legend-state.d.ts +40 -0
- package/dist/src/components/line-chart/legend/create-style-object.d.ts +26 -0
- package/dist/src/components/line-chart/legend/legend-interface.d.ts +1 -1
- package/dist/src/components/line-chart/line-chart-get-default-props.d.ts +2 -99
- package/dist/src/components/line-chart/line-chart.interface.d.ts +3 -3
- package/dist/src/components/line-chart/line-chart.stories.d.ts +72 -0
- package/dist/src/components/line-chart/state/initial-state.d.ts +4 -26
- package/dist/src/components/line-chart/utils/__tests__/get-line-chart-tooltips.test.d.ts +1 -0
- package/dist/src/components/line-chart/utils/axis-formatting/axis-formatting.d.ts +1 -1
- package/dist/src/components/line-chart/utils/check-custom-option/check-custom-option.d.ts +15 -0
- package/dist/src/components/line-chart/utils/check-custom-option/check-custom-option.test.d.ts +1 -0
- package/dist/src/components/line-chart/utils/enums.d.ts +4 -0
- package/dist/src/components/line-chart/utils/get-axis-range-by-type.d.ts +10 -0
- package/dist/src/components/line-chart/utils/get-generated-labels.d.ts +1 -0
- package/package.json +3 -2
- package/dist/declaration.d.ts +0 -17
- package/dist/src/components/scatter-chart/scatter-chart.d.ts +0 -7
- package/dist/src/components/scatter-chart/scatter-chart.intefrace.d.ts +0 -18
- package/dist/src/components/scatter-chart/scatter-chart.stories.d.ts +0 -118
- /package/dist/src/components/line-chart/utils/{get-line-chart-tooltips.test.d.ts → __tests__/get-axis-range-by-type.test.d.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -4,14 +4,14 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q
|
|
7
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
8
8
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
9
9
|
import React, { forwardRef, useRef, useEffect, createContext as createContext$2, memo, useLayoutEffect, useState, useCallback, useMemo, isValidElement, cloneElement, useContext, useReducer } from "react";
|
|
10
|
-
import { round as round$2, toNum, displayNumber, isCloseTo, roundByMagnitude } from "@oliasoft-open-source/units";
|
|
11
|
-
import cx from "classnames";
|
|
12
10
|
import { produce } from "immer";
|
|
11
|
+
import { round as round$2, displayNumber, isCloseTo, roundByMagnitude, toNum } from "@oliasoft-open-source/units";
|
|
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 { debounce as debounce$3, isEqual } from "lodash";
|
|
14
|
+
import { isEmpty, isArray as isArray$2, some, has, debounce as debounce$3, isEqual } from "lodash";
|
|
15
15
|
import { roundNumberToPrecision } from "@oliasoft-open-source/units/dist/rounding/rounding";
|
|
16
16
|
/*!
|
|
17
17
|
* @kurkle/color v0.3.2
|
|
@@ -4914,130 +4914,6 @@ let PieController$1 = (_e = class extends DoughnutController$1 {
|
|
|
4914
4914
|
circumference: 360,
|
|
4915
4915
|
radius: "100%"
|
|
4916
4916
|
}), _e);
|
|
4917
|
-
let ScatterController$1 = (_f = class extends DatasetController$1 {
|
|
4918
|
-
getLabelAndValue(index2) {
|
|
4919
|
-
const meta = this._cachedMeta;
|
|
4920
|
-
const labels = this.chart.data.labels || [];
|
|
4921
|
-
const { xScale, yScale } = meta;
|
|
4922
|
-
const parsed = this.getParsed(index2);
|
|
4923
|
-
const x2 = xScale.getLabelForValue(parsed.x);
|
|
4924
|
-
const y2 = yScale.getLabelForValue(parsed.y);
|
|
4925
|
-
return {
|
|
4926
|
-
label: labels[index2] || "",
|
|
4927
|
-
value: "(" + x2 + ", " + y2 + ")"
|
|
4928
|
-
};
|
|
4929
|
-
}
|
|
4930
|
-
update(mode) {
|
|
4931
|
-
const meta = this._cachedMeta;
|
|
4932
|
-
const { data: points = [] } = meta;
|
|
4933
|
-
const animationsDisabled = this.chart._animationsDisabled;
|
|
4934
|
-
let { start, count } = _getStartAndCountOfVisiblePoints$1(meta, points, animationsDisabled);
|
|
4935
|
-
this._drawStart = start;
|
|
4936
|
-
this._drawCount = count;
|
|
4937
|
-
if (_scaleRangesChanged$1(meta)) {
|
|
4938
|
-
start = 0;
|
|
4939
|
-
count = points.length;
|
|
4940
|
-
}
|
|
4941
|
-
if (this.options.showLine) {
|
|
4942
|
-
if (!this.datasetElementType) {
|
|
4943
|
-
this.addElements();
|
|
4944
|
-
}
|
|
4945
|
-
const { dataset: line, _dataset } = meta;
|
|
4946
|
-
line._chart = this.chart;
|
|
4947
|
-
line._datasetIndex = this.index;
|
|
4948
|
-
line._decimated = !!_dataset._decimated;
|
|
4949
|
-
line.points = points;
|
|
4950
|
-
const options = this.resolveDatasetElementOptions(mode);
|
|
4951
|
-
options.segment = this.options.segment;
|
|
4952
|
-
this.updateElement(line, void 0, {
|
|
4953
|
-
animated: !animationsDisabled,
|
|
4954
|
-
options
|
|
4955
|
-
}, mode);
|
|
4956
|
-
} else if (this.datasetElementType) {
|
|
4957
|
-
delete meta.dataset;
|
|
4958
|
-
this.datasetElementType = false;
|
|
4959
|
-
}
|
|
4960
|
-
this.updateElements(points, start, count, mode);
|
|
4961
|
-
}
|
|
4962
|
-
addElements() {
|
|
4963
|
-
const { showLine } = this.options;
|
|
4964
|
-
if (!this.datasetElementType && showLine) {
|
|
4965
|
-
this.datasetElementType = this.chart.registry.getElement("line");
|
|
4966
|
-
}
|
|
4967
|
-
super.addElements();
|
|
4968
|
-
}
|
|
4969
|
-
updateElements(points, start, count, mode) {
|
|
4970
|
-
const reset = mode === "reset";
|
|
4971
|
-
const { iScale, vScale, _stacked, _dataset } = this._cachedMeta;
|
|
4972
|
-
const firstOpts = this.resolveDataElementOptions(start, mode);
|
|
4973
|
-
const sharedOptions = this.getSharedOptions(firstOpts);
|
|
4974
|
-
const includeOptions = this.includeOptions(mode, sharedOptions);
|
|
4975
|
-
const iAxis = iScale.axis;
|
|
4976
|
-
const vAxis = vScale.axis;
|
|
4977
|
-
const { spanGaps, segment } = this.options;
|
|
4978
|
-
const maxGapLength = isNumber$1(spanGaps) ? spanGaps : Number.POSITIVE_INFINITY;
|
|
4979
|
-
const directUpdate = this.chart._animationsDisabled || reset || mode === "none";
|
|
4980
|
-
let prevParsed = start > 0 && this.getParsed(start - 1);
|
|
4981
|
-
for (let i2 = start; i2 < start + count; ++i2) {
|
|
4982
|
-
const point = points[i2];
|
|
4983
|
-
const parsed = this.getParsed(i2);
|
|
4984
|
-
const properties = directUpdate ? point : {};
|
|
4985
|
-
const nullData = isNullOrUndef$1(parsed[vAxis]);
|
|
4986
|
-
const iPixel = properties[iAxis] = iScale.getPixelForValue(parsed[iAxis], i2);
|
|
4987
|
-
const vPixel = properties[vAxis] = reset || nullData ? vScale.getBasePixel() : vScale.getPixelForValue(_stacked ? this.applyStack(vScale, parsed, _stacked) : parsed[vAxis], i2);
|
|
4988
|
-
properties.skip = isNaN(iPixel) || isNaN(vPixel) || nullData;
|
|
4989
|
-
properties.stop = i2 > 0 && Math.abs(parsed[iAxis] - prevParsed[iAxis]) > maxGapLength;
|
|
4990
|
-
if (segment) {
|
|
4991
|
-
properties.parsed = parsed;
|
|
4992
|
-
properties.raw = _dataset.data[i2];
|
|
4993
|
-
}
|
|
4994
|
-
if (includeOptions) {
|
|
4995
|
-
properties.options = sharedOptions || this.resolveDataElementOptions(i2, point.active ? "active" : mode);
|
|
4996
|
-
}
|
|
4997
|
-
if (!directUpdate) {
|
|
4998
|
-
this.updateElement(point, i2, properties, mode);
|
|
4999
|
-
}
|
|
5000
|
-
prevParsed = parsed;
|
|
5001
|
-
}
|
|
5002
|
-
this.updateSharedOptions(sharedOptions, mode, firstOpts);
|
|
5003
|
-
}
|
|
5004
|
-
getMaxOverflow() {
|
|
5005
|
-
const meta = this._cachedMeta;
|
|
5006
|
-
const data = meta.data || [];
|
|
5007
|
-
if (!this.options.showLine) {
|
|
5008
|
-
let max = 0;
|
|
5009
|
-
for (let i2 = data.length - 1; i2 >= 0; --i2) {
|
|
5010
|
-
max = Math.max(max, data[i2].size(this.resolveDataElementOptions(i2)) / 2);
|
|
5011
|
-
}
|
|
5012
|
-
return max > 0 && max;
|
|
5013
|
-
}
|
|
5014
|
-
const dataset = meta.dataset;
|
|
5015
|
-
const border = dataset.options && dataset.options.borderWidth || 0;
|
|
5016
|
-
if (!data.length) {
|
|
5017
|
-
return border;
|
|
5018
|
-
}
|
|
5019
|
-
const firstPoint = data[0].size(this.resolveDataElementOptions(0));
|
|
5020
|
-
const lastPoint = data[data.length - 1].size(this.resolveDataElementOptions(data.length - 1));
|
|
5021
|
-
return Math.max(border, firstPoint, lastPoint) / 2;
|
|
5022
|
-
}
|
|
5023
|
-
}, __publicField(_f, "id", "scatter"), __publicField(_f, "defaults", {
|
|
5024
|
-
datasetElementType: false,
|
|
5025
|
-
dataElementType: "point",
|
|
5026
|
-
showLine: false,
|
|
5027
|
-
fill: false
|
|
5028
|
-
}), __publicField(_f, "overrides", {
|
|
5029
|
-
interaction: {
|
|
5030
|
-
mode: "point"
|
|
5031
|
-
},
|
|
5032
|
-
scales: {
|
|
5033
|
-
x: {
|
|
5034
|
-
type: "linear"
|
|
5035
|
-
},
|
|
5036
|
-
y: {
|
|
5037
|
-
type: "linear"
|
|
5038
|
-
}
|
|
5039
|
-
}
|
|
5040
|
-
}), _f);
|
|
5041
4917
|
function abstract$1() {
|
|
5042
4918
|
throw new Error("This method is not implemented: Check that a complete date adapter is provided.");
|
|
5043
4919
|
}
|
|
@@ -5927,7 +5803,7 @@ function _detectPlatform$1(canvas2) {
|
|
|
5927
5803
|
}
|
|
5928
5804
|
return DomPlatform$1;
|
|
5929
5805
|
}
|
|
5930
|
-
let Element$2 = (
|
|
5806
|
+
let Element$2 = (_f = class {
|
|
5931
5807
|
constructor() {
|
|
5932
5808
|
__publicField(this, "x");
|
|
5933
5809
|
__publicField(this, "y");
|
|
@@ -5959,7 +5835,7 @@ let Element$2 = (_g = class {
|
|
|
5959
5835
|
});
|
|
5960
5836
|
return ret;
|
|
5961
5837
|
}
|
|
5962
|
-
}, __publicField(
|
|
5838
|
+
}, __publicField(_f, "defaults", {}), __publicField(_f, "defaultRoutes"), _f);
|
|
5963
5839
|
function autoSkip$1(scale, ticks) {
|
|
5964
5840
|
const tickOpts = scale.options.ticks;
|
|
5965
5841
|
const determinedMaxTicks = determineMaxTicks$1(scale);
|
|
@@ -8046,7 +7922,7 @@ function getDatasetArea(meta, chartArea) {
|
|
|
8046
7922
|
}
|
|
8047
7923
|
return chartArea;
|
|
8048
7924
|
}
|
|
8049
|
-
let Chart$2 = (
|
|
7925
|
+
let Chart$2 = (_g = class {
|
|
8050
7926
|
static register(...items) {
|
|
8051
7927
|
registry$1.add(...items);
|
|
8052
7928
|
invalidatePlugins$1();
|
|
@@ -8866,7 +8742,7 @@ let Chart$2 = (_h = class {
|
|
|
8866
8742
|
const hoverOptions = this.options.hover;
|
|
8867
8743
|
return this.getElementsAtEventForMode(e2, hoverOptions.mode, hoverOptions, useFinalPosition);
|
|
8868
8744
|
}
|
|
8869
|
-
}, __publicField(
|
|
8745
|
+
}, __publicField(_g, "defaults", defaults$2), __publicField(_g, "instances", instances$1), __publicField(_g, "overrides", overrides$1), __publicField(_g, "registry", registry$1), __publicField(_g, "version", version$3), __publicField(_g, "getChart", getChart$1), _g);
|
|
8870
8746
|
function invalidatePlugins$1() {
|
|
8871
8747
|
return each$1(Chart$2.instances, (chart2) => chart2._plugins.invalidate());
|
|
8872
8748
|
}
|
|
@@ -9028,7 +8904,7 @@ function drawBorder$1(ctx, element, offset, spacing, circular) {
|
|
|
9028
8904
|
ctx.stroke();
|
|
9029
8905
|
}
|
|
9030
8906
|
}
|
|
9031
|
-
let ArcElement$1 = (
|
|
8907
|
+
let ArcElement$1 = (_h = class extends Element$2 {
|
|
9032
8908
|
constructor(cfg) {
|
|
9033
8909
|
super();
|
|
9034
8910
|
__publicField(this, "circumference");
|
|
@@ -9113,7 +8989,7 @@ let ArcElement$1 = (_i = class extends Element$2 {
|
|
|
9113
8989
|
drawBorder$1(ctx, this, radiusOffset, spacing, circular);
|
|
9114
8990
|
ctx.restore();
|
|
9115
8991
|
}
|
|
9116
|
-
}, __publicField(
|
|
8992
|
+
}, __publicField(_h, "id", "arc"), __publicField(_h, "defaults", {
|
|
9117
8993
|
borderAlign: "center",
|
|
9118
8994
|
borderColor: "#fff",
|
|
9119
8995
|
borderDash: [],
|
|
@@ -9125,12 +9001,12 @@ let ArcElement$1 = (_i = class extends Element$2 {
|
|
|
9125
9001
|
spacing: 0,
|
|
9126
9002
|
angle: void 0,
|
|
9127
9003
|
circular: true
|
|
9128
|
-
}), __publicField(
|
|
9004
|
+
}), __publicField(_h, "defaultRoutes", {
|
|
9129
9005
|
backgroundColor: "backgroundColor"
|
|
9130
|
-
}), __publicField(
|
|
9006
|
+
}), __publicField(_h, "descriptors", {
|
|
9131
9007
|
_scriptable: true,
|
|
9132
9008
|
_indexable: (name) => name !== "borderDash"
|
|
9133
|
-
}),
|
|
9009
|
+
}), _h);
|
|
9134
9010
|
function setStyle$1(ctx, options, style = options) {
|
|
9135
9011
|
ctx.lineCap = valueOrDefault$1(style.borderCapStyle, options.borderCapStyle);
|
|
9136
9012
|
ctx.setLineDash(valueOrDefault$1(style.borderDash, options.borderDash));
|
|
@@ -9283,7 +9159,7 @@ function draw$3(ctx, line, start, count) {
|
|
|
9283
9159
|
strokePathDirect$1(ctx, line, start, count);
|
|
9284
9160
|
}
|
|
9285
9161
|
}
|
|
9286
|
-
let LineElement$1 = (
|
|
9162
|
+
let LineElement$1 = (_i = class extends Element$2 {
|
|
9287
9163
|
constructor(cfg) {
|
|
9288
9164
|
super();
|
|
9289
9165
|
this.animated = true;
|
|
@@ -9393,7 +9269,7 @@ let LineElement$1 = (_j = class extends Element$2 {
|
|
|
9393
9269
|
this._path = void 0;
|
|
9394
9270
|
}
|
|
9395
9271
|
}
|
|
9396
|
-
}, __publicField(
|
|
9272
|
+
}, __publicField(_i, "id", "line"), __publicField(_i, "defaults", {
|
|
9397
9273
|
borderCapStyle: "butt",
|
|
9398
9274
|
borderDash: [],
|
|
9399
9275
|
borderDashOffset: 0,
|
|
@@ -9405,13 +9281,13 @@ let LineElement$1 = (_j = class extends Element$2 {
|
|
|
9405
9281
|
spanGaps: false,
|
|
9406
9282
|
stepped: false,
|
|
9407
9283
|
tension: 0
|
|
9408
|
-
}), __publicField(
|
|
9284
|
+
}), __publicField(_i, "defaultRoutes", {
|
|
9409
9285
|
backgroundColor: "backgroundColor",
|
|
9410
9286
|
borderColor: "borderColor"
|
|
9411
|
-
}), __publicField(
|
|
9287
|
+
}), __publicField(_i, "descriptors", {
|
|
9412
9288
|
_scriptable: true,
|
|
9413
9289
|
_indexable: (name) => name !== "borderDash" && name !== "fill"
|
|
9414
|
-
}),
|
|
9290
|
+
}), _i);
|
|
9415
9291
|
function inRange$1$1(el, pos, axis, useFinalPosition) {
|
|
9416
9292
|
const options = el.options;
|
|
9417
9293
|
const { [axis]: value } = el.getProps([
|
|
@@ -9419,7 +9295,7 @@ function inRange$1$1(el, pos, axis, useFinalPosition) {
|
|
|
9419
9295
|
], useFinalPosition);
|
|
9420
9296
|
return Math.abs(pos - value) < options.radius + options.hitRadius;
|
|
9421
9297
|
}
|
|
9422
|
-
let PointElement$1 = (
|
|
9298
|
+
let PointElement$1 = (_j = class extends Element$2 {
|
|
9423
9299
|
constructor(cfg) {
|
|
9424
9300
|
super();
|
|
9425
9301
|
__publicField(this, "parsed");
|
|
@@ -9478,10 +9354,10 @@ let PointElement$1 = (_k = class extends Element$2 {
|
|
|
9478
9354
|
const options = this.options || {};
|
|
9479
9355
|
return options.radius + options.hitRadius;
|
|
9480
9356
|
}
|
|
9481
|
-
}, __publicField(
|
|
9357
|
+
}, __publicField(_j, "id", "point"), /**
|
|
9482
9358
|
* @type {any}
|
|
9483
9359
|
*/
|
|
9484
|
-
__publicField(
|
|
9360
|
+
__publicField(_j, "defaults", {
|
|
9485
9361
|
borderWidth: 1,
|
|
9486
9362
|
hitRadius: 1,
|
|
9487
9363
|
hoverBorderWidth: 1,
|
|
@@ -9492,10 +9368,10 @@ __publicField(_k, "defaults", {
|
|
|
9492
9368
|
}), /**
|
|
9493
9369
|
* @type {any}
|
|
9494
9370
|
*/
|
|
9495
|
-
__publicField(
|
|
9371
|
+
__publicField(_j, "defaultRoutes", {
|
|
9496
9372
|
backgroundColor: "backgroundColor",
|
|
9497
9373
|
borderColor: "borderColor"
|
|
9498
|
-
}),
|
|
9374
|
+
}), _j);
|
|
9499
9375
|
function getBarBounds$1(bar, useFinalPosition) {
|
|
9500
9376
|
const { x: x2, y: y2, base, width, height } = bar.getProps([
|
|
9501
9377
|
"x",
|
|
@@ -9609,7 +9485,7 @@ function inflateRect$1(rect, amount, refRect = {}) {
|
|
|
9609
9485
|
radius: rect.radius
|
|
9610
9486
|
};
|
|
9611
9487
|
}
|
|
9612
|
-
let BarElement$1 = (
|
|
9488
|
+
let BarElement$1 = (_k = class extends Element$2 {
|
|
9613
9489
|
constructor(cfg) {
|
|
9614
9490
|
super();
|
|
9615
9491
|
this.options = void 0;
|
|
@@ -9665,16 +9541,16 @@ let BarElement$1 = (_l = class extends Element$2 {
|
|
|
9665
9541
|
getRange(axis) {
|
|
9666
9542
|
return axis === "x" ? this.width / 2 : this.height / 2;
|
|
9667
9543
|
}
|
|
9668
|
-
}, __publicField(
|
|
9544
|
+
}, __publicField(_k, "id", "bar"), __publicField(_k, "defaults", {
|
|
9669
9545
|
borderSkipped: "start",
|
|
9670
9546
|
borderWidth: 0,
|
|
9671
9547
|
borderRadius: 0,
|
|
9672
9548
|
inflateAmount: "auto",
|
|
9673
9549
|
pointStyle: void 0
|
|
9674
|
-
}), __publicField(
|
|
9550
|
+
}), __publicField(_k, "defaultRoutes", {
|
|
9675
9551
|
backgroundColor: "backgroundColor",
|
|
9676
9552
|
borderColor: "borderColor"
|
|
9677
|
-
}),
|
|
9553
|
+
}), _k);
|
|
9678
9554
|
function _segments(line, target, property) {
|
|
9679
9555
|
const segments = line.segments;
|
|
9680
9556
|
const points = line.points;
|
|
@@ -11243,7 +11119,7 @@ function invokeCallbackWithFallback(callbacks, name, ctx, arg) {
|
|
|
11243
11119
|
}
|
|
11244
11120
|
return result;
|
|
11245
11121
|
}
|
|
11246
|
-
let Tooltip$1 = (
|
|
11122
|
+
let Tooltip$1 = (_l = class extends Element$2 {
|
|
11247
11123
|
constructor(config2) {
|
|
11248
11124
|
super();
|
|
11249
11125
|
this.opacity = 0;
|
|
@@ -11782,7 +11658,7 @@ let Tooltip$1 = (_m = class extends Element$2 {
|
|
|
11782
11658
|
const position = positioners$2[options.position].call(this, active, e2);
|
|
11783
11659
|
return position !== false && (caretX !== position.x || caretY !== position.y);
|
|
11784
11660
|
}
|
|
11785
|
-
}, __publicField(
|
|
11661
|
+
}, __publicField(_l, "positioners", positioners$2), _l);
|
|
11786
11662
|
var plugin_tooltip = {
|
|
11787
11663
|
id: "tooltip",
|
|
11788
11664
|
_element: Tooltip$1,
|
|
@@ -11937,7 +11813,7 @@ function _getLabelForValue(value) {
|
|
|
11937
11813
|
}
|
|
11938
11814
|
return value;
|
|
11939
11815
|
}
|
|
11940
|
-
let CategoryScale$1 = (
|
|
11816
|
+
let CategoryScale$1 = (_m = class extends Scale$1 {
|
|
11941
11817
|
constructor(cfg) {
|
|
11942
11818
|
super(cfg);
|
|
11943
11819
|
this._startValue = void 0;
|
|
@@ -12023,11 +11899,11 @@ let CategoryScale$1 = (_n = class extends Scale$1 {
|
|
|
12023
11899
|
getBasePixel() {
|
|
12024
11900
|
return this.bottom;
|
|
12025
11901
|
}
|
|
12026
|
-
}, __publicField(
|
|
11902
|
+
}, __publicField(_m, "id", "category"), __publicField(_m, "defaults", {
|
|
12027
11903
|
ticks: {
|
|
12028
11904
|
callback: _getLabelForValue
|
|
12029
11905
|
}
|
|
12030
|
-
}),
|
|
11906
|
+
}), _m);
|
|
12031
11907
|
function generateTicks$1$1(generationOptions, dataRange) {
|
|
12032
11908
|
const ticks = [];
|
|
12033
11909
|
const MIN_SPACING = 1e-14;
|
|
@@ -12250,7 +12126,7 @@ let LinearScaleBase$1 = class LinearScaleBase extends Scale$1 {
|
|
|
12250
12126
|
return formatNumber$1(value, this.chart.options.locale, this.options.ticks.format);
|
|
12251
12127
|
}
|
|
12252
12128
|
};
|
|
12253
|
-
let LinearScale$1 = (
|
|
12129
|
+
let LinearScale$1 = (_n = class extends LinearScaleBase$1 {
|
|
12254
12130
|
determineDataLimits() {
|
|
12255
12131
|
const { min, max } = this.getMinMax(true);
|
|
12256
12132
|
this.min = isNumberFinite$1(min) ? min : 0;
|
|
@@ -12271,11 +12147,11 @@ let LinearScale$1 = (_o = class extends LinearScaleBase$1 {
|
|
|
12271
12147
|
getValueForPixel(pixel) {
|
|
12272
12148
|
return this._startValue + this.getDecimalForPixel(pixel) * this._valueRange;
|
|
12273
12149
|
}
|
|
12274
|
-
}, __publicField(
|
|
12150
|
+
}, __publicField(_n, "id", "linear"), __publicField(_n, "defaults", {
|
|
12275
12151
|
ticks: {
|
|
12276
12152
|
callback: Ticks$1.formatters.numeric
|
|
12277
12153
|
}
|
|
12278
|
-
}),
|
|
12154
|
+
}), _n);
|
|
12279
12155
|
const log10Floor = (v2) => Math.floor(log10$1(v2));
|
|
12280
12156
|
const changeExponent = (v2, m2) => Math.pow(10, log10Floor(v2) + m2);
|
|
12281
12157
|
function isMajor$1(tickVal) {
|
|
@@ -12337,7 +12213,7 @@ function generateTicks$2(generationOptions, { min, max }) {
|
|
|
12337
12213
|
});
|
|
12338
12214
|
return ticks;
|
|
12339
12215
|
}
|
|
12340
|
-
let LogarithmicScale$1 = (
|
|
12216
|
+
let LogarithmicScale$1 = (_o = class extends Scale$1 {
|
|
12341
12217
|
constructor(cfg) {
|
|
12342
12218
|
super(cfg);
|
|
12343
12219
|
this.start = void 0;
|
|
@@ -12434,14 +12310,14 @@ let LogarithmicScale$1 = (_p = class extends Scale$1 {
|
|
|
12434
12310
|
const decimal = this.getDecimalForPixel(pixel);
|
|
12435
12311
|
return Math.pow(10, this._startValue + decimal * this._valueRange);
|
|
12436
12312
|
}
|
|
12437
|
-
}, __publicField(
|
|
12313
|
+
}, __publicField(_o, "id", "logarithmic"), __publicField(_o, "defaults", {
|
|
12438
12314
|
ticks: {
|
|
12439
12315
|
callback: Ticks$1.formatters.logarithmic,
|
|
12440
12316
|
major: {
|
|
12441
12317
|
enabled: true
|
|
12442
12318
|
}
|
|
12443
12319
|
}
|
|
12444
|
-
}),
|
|
12320
|
+
}), _o);
|
|
12445
12321
|
const INTERVALS$1 = {
|
|
12446
12322
|
millisecond: {
|
|
12447
12323
|
common: true,
|
|
@@ -12577,7 +12453,7 @@ function ticksFromTimestamps$1(scale, values, majorUnit) {
|
|
|
12577
12453
|
}
|
|
12578
12454
|
return ilen === 0 || !majorUnit ? ticks : setMajorTicks$1(scale, ticks, map2, majorUnit);
|
|
12579
12455
|
}
|
|
12580
|
-
let TimeScale$1 = (
|
|
12456
|
+
let TimeScale$1 = (_p = class extends Scale$1 {
|
|
12581
12457
|
constructor(props) {
|
|
12582
12458
|
super(props);
|
|
12583
12459
|
this._cache = {
|
|
@@ -12843,7 +12719,7 @@ let TimeScale$1 = (_q = class extends Scale$1 {
|
|
|
12843
12719
|
normalize(values) {
|
|
12844
12720
|
return _arrayUnique$1(values.sort(sorter$1));
|
|
12845
12721
|
}
|
|
12846
|
-
}, __publicField(
|
|
12722
|
+
}, __publicField(_p, "id", "time"), __publicField(_p, "defaults", {
|
|
12847
12723
|
bounds: "data",
|
|
12848
12724
|
adapters: {},
|
|
12849
12725
|
time: {
|
|
@@ -12861,7 +12737,7 @@ let TimeScale$1 = (_q = class extends Scale$1 {
|
|
|
12861
12737
|
enabled: false
|
|
12862
12738
|
}
|
|
12863
12739
|
}
|
|
12864
|
-
}),
|
|
12740
|
+
}), _p);
|
|
12865
12741
|
function interpolate$2(table2, val, reverse) {
|
|
12866
12742
|
let lo = 0;
|
|
12867
12743
|
let hi = table2.length - 1;
|
|
@@ -12882,7 +12758,7 @@ function interpolate$2(table2, val, reverse) {
|
|
|
12882
12758
|
const span = nextSource - prevSource;
|
|
12883
12759
|
return span ? prevTarget + (nextTarget - prevTarget) * (val - prevSource) / span : prevTarget;
|
|
12884
12760
|
}
|
|
12885
|
-
let TimeSeriesScale$1 = (
|
|
12761
|
+
let TimeSeriesScale$1 = (_q = class extends TimeScale$1 {
|
|
12886
12762
|
constructor(props) {
|
|
12887
12763
|
super(props);
|
|
12888
12764
|
this._table = [];
|
|
@@ -12967,7 +12843,7 @@ let TimeSeriesScale$1 = (_r = class extends TimeScale$1 {
|
|
|
12967
12843
|
const decimal = this.getDecimalForPixel(pixel) / offsets.factor - offsets.end;
|
|
12968
12844
|
return interpolate$2(this._table, decimal * this._tableRange + this._minPos, true);
|
|
12969
12845
|
}
|
|
12970
|
-
}, __publicField(
|
|
12846
|
+
}, __publicField(_q, "id", "timeseries"), __publicField(_q, "defaults", TimeScale$1.defaults), _q);
|
|
12971
12847
|
const defaultDatasetIdKey = "label";
|
|
12972
12848
|
function reforwardRef(ref, value) {
|
|
12973
12849
|
if (typeof ref === "function") {
|
|
@@ -13104,343 +12980,6 @@ function createTypedChart(type, registerables) {
|
|
|
13104
12980
|
const Line = /* @__PURE__ */ createTypedChart("line", LineController$1);
|
|
13105
12981
|
const Bar = /* @__PURE__ */ createTypedChart("bar", BarController$1);
|
|
13106
12982
|
const Pie = /* @__PURE__ */ createTypedChart("pie", PieController$1);
|
|
13107
|
-
const Scatter = /* @__PURE__ */ createTypedChart("scatter", ScatterController$1);
|
|
13108
|
-
const MINOR_TICKS_PER_MAJOR = 10;
|
|
13109
|
-
const getLargestMajorTickWidth = (majorTickPositions) => {
|
|
13110
|
-
return majorTickPositions.reduce(
|
|
13111
|
-
(acc, curr, index2) => {
|
|
13112
|
-
if (index2 === 0)
|
|
13113
|
-
return acc;
|
|
13114
|
-
const gap = Math.abs(curr - majorTickPositions[index2 - 1]);
|
|
13115
|
-
return Math.max(gap, acc);
|
|
13116
|
-
},
|
|
13117
|
-
0
|
|
13118
|
-
);
|
|
13119
|
-
};
|
|
13120
|
-
const isValidPosition = (minorTickPosition, majorTickPositions, scale) => {
|
|
13121
|
-
const { axis, left: left2, top: top2, right: right2, bottom: bottom2 } = scale;
|
|
13122
|
-
const isHorizontal = axis === "x";
|
|
13123
|
-
const start = isHorizontal ? left2 : top2;
|
|
13124
|
-
const end = isHorizontal ? right2 : bottom2;
|
|
13125
|
-
const isAfterStart = minorTickPosition > start;
|
|
13126
|
-
const isBeforeEnd = minorTickPosition < end;
|
|
13127
|
-
const isDuplicate = majorTickPositions.indexOf(minorTickPosition) !== -1;
|
|
13128
|
-
return isAfterStart && isBeforeEnd && !isDuplicate;
|
|
13129
|
-
};
|
|
13130
|
-
const getMinorTickPositions = (majorTickPositions, scale) => {
|
|
13131
|
-
const sortedMajorTickPositions = majorTickPositions.sort((a2, b2) => {
|
|
13132
|
-
return a2 - b2;
|
|
13133
|
-
});
|
|
13134
|
-
const minorTickWidth = getLargestMajorTickWidth(majorTickPositions) / 10;
|
|
13135
|
-
const startPosition = majorTickPositions[0];
|
|
13136
|
-
const numMinorTicks = (majorTickPositions.length + 1) * MINOR_TICKS_PER_MAJOR;
|
|
13137
|
-
const positions2 = [...Array(numMinorTicks)].map((_2, index2) => {
|
|
13138
|
-
const minorTickPosition = startPosition + (index2 - MINOR_TICKS_PER_MAJOR + 1) * minorTickWidth;
|
|
13139
|
-
return parseFloat(minorTickPosition.toFixed(1));
|
|
13140
|
-
}).filter(
|
|
13141
|
-
(position) => isValidPosition(position, sortedMajorTickPositions, scale)
|
|
13142
|
-
);
|
|
13143
|
-
return positions2;
|
|
13144
|
-
};
|
|
13145
|
-
const drawMinorTicksForScale = (scale) => {
|
|
13146
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
|
|
13147
|
-
const { chart: chart2, ctx } = scale;
|
|
13148
|
-
const config2 = chart2.config;
|
|
13149
|
-
if (!((_d2 = (_c2 = (_b2 = (_a2 = config2 == null ? void 0 : config2.options) == null ? void 0 : _a2.scales) == null ? void 0 : _b2[scale.id]) == null ? void 0 : _c2.grid) == null ? void 0 : _d2.drawOnChartArea))
|
|
13150
|
-
return;
|
|
13151
|
-
if (config2.options.indexAxis === scale.axis)
|
|
13152
|
-
return;
|
|
13153
|
-
const isHorizontal = scale.axis === "x";
|
|
13154
|
-
const majorTickPositions = scale.ticks.map((_2, index2) => scale.getPixelForTick(index2)).sort((a2, b2) => a2 - b2);
|
|
13155
|
-
const minorTickPositions = getMinorTickPositions(majorTickPositions, scale);
|
|
13156
|
-
ctx.save();
|
|
13157
|
-
ctx.strokeStyle = ((_i2 = (_h2 = (_g2 = (_f2 = (_e2 = config2 == null ? void 0 : config2._config) == null ? void 0 : _e2.options) == null ? void 0 : _f2.scales) == null ? void 0 : _g2[scale.id]) == null ? void 0 : _h2.grid) == null ? void 0 : _i2.color) || "rgba(0,0,0,0.06)";
|
|
13158
|
-
ctx.lineWidth = 0.5;
|
|
13159
|
-
minorTickPositions.forEach((minorTickPosition) => {
|
|
13160
|
-
ctx.beginPath();
|
|
13161
|
-
if (isHorizontal) {
|
|
13162
|
-
const { top: top2, bottom: bottom2 } = chart2.chartArea;
|
|
13163
|
-
ctx.moveTo(minorTickPosition, top2);
|
|
13164
|
-
ctx.lineTo(minorTickPosition, bottom2);
|
|
13165
|
-
} else {
|
|
13166
|
-
const { left: left2, right: right2 } = chart2.chartArea;
|
|
13167
|
-
ctx.moveTo(left2, minorTickPosition);
|
|
13168
|
-
ctx.lineTo(right2, minorTickPosition);
|
|
13169
|
-
}
|
|
13170
|
-
ctx.stroke();
|
|
13171
|
-
});
|
|
13172
|
-
ctx.restore();
|
|
13173
|
-
};
|
|
13174
|
-
const chartMinorGridlinesPlugin = {
|
|
13175
|
-
id: "minorGridlines",
|
|
13176
|
-
beforeDatasetsDraw: (chart2) => {
|
|
13177
|
-
const { scales } = chart2;
|
|
13178
|
-
Object.keys(scales).forEach((id) => drawMinorTicksForScale(scales[id]));
|
|
13179
|
-
}
|
|
13180
|
-
};
|
|
13181
|
-
const BORDER_WIDTH = {
|
|
13182
|
-
INITIAL: 2,
|
|
13183
|
-
HOVERED: 6
|
|
13184
|
-
};
|
|
13185
|
-
const BORDER_COLOR = "rgba(0,0,0,0.1)";
|
|
13186
|
-
const ANNOTATION_DASH = [10, 2];
|
|
13187
|
-
const DEFAULT_FONT_SIZE = 12;
|
|
13188
|
-
const DEFAULT_FONT_FAMILY = '"Roobert", sans-serif';
|
|
13189
|
-
const DEFAULT_COLOR = "hsl(60, 10.34482759%, 12.5%)";
|
|
13190
|
-
const LEGEND_LABEL_BOX_SIZE = 12;
|
|
13191
|
-
const TOOLTIP_PADDING = 8;
|
|
13192
|
-
const TOOLTIP_BOX_PADDING = 4;
|
|
13193
|
-
const LOGARITHMIC_STEPS = [1, 10, 100, 1e3, 1e4];
|
|
13194
|
-
const COLORS = [
|
|
13195
|
-
"#3366cc",
|
|
13196
|
-
"#dc3912",
|
|
13197
|
-
"#ff9900",
|
|
13198
|
-
"#109618",
|
|
13199
|
-
"#990099",
|
|
13200
|
-
"#0099c6",
|
|
13201
|
-
"#dd4477",
|
|
13202
|
-
"#66aa00",
|
|
13203
|
-
"#b82e2e",
|
|
13204
|
-
"#316395",
|
|
13205
|
-
"#994499",
|
|
13206
|
-
"#22aa99",
|
|
13207
|
-
"#aaaa11",
|
|
13208
|
-
"#6633cc",
|
|
13209
|
-
"#e67300",
|
|
13210
|
-
"#8b0707",
|
|
13211
|
-
"#651067",
|
|
13212
|
-
"#329262",
|
|
13213
|
-
"#5574a6",
|
|
13214
|
-
"#3b3eac"
|
|
13215
|
-
];
|
|
13216
|
-
const ALPHA_CHANEL = "99";
|
|
13217
|
-
const WHITE_COLOR_AS_DECIMAL = 16777215;
|
|
13218
|
-
const AUTO = "auto";
|
|
13219
|
-
const ANIMATION_DURATION = {
|
|
13220
|
-
NO: 0,
|
|
13221
|
-
SLOW: 400,
|
|
13222
|
-
FAST: 1e3
|
|
13223
|
-
};
|
|
13224
|
-
const DEFAULT_CHART_NAME = "new_chart";
|
|
13225
|
-
const CUSTOM_LEGEND_PLUGIN_NAME = "htmlLegend";
|
|
13226
|
-
const DECIMAL_POINT_TOLERANCE = 9;
|
|
13227
|
-
const MAX_DECIMAL_DIFF = 1 / 10 ** DECIMAL_POINT_TOLERANCE;
|
|
13228
|
-
var AxisType = /* @__PURE__ */ ((AxisType2) => {
|
|
13229
|
-
AxisType2["X"] = "x";
|
|
13230
|
-
AxisType2["Y"] = "y";
|
|
13231
|
-
return AxisType2;
|
|
13232
|
-
})(AxisType || {});
|
|
13233
|
-
var Position = /* @__PURE__ */ ((Position2) => {
|
|
13234
|
-
Position2["Bottom"] = "bottom";
|
|
13235
|
-
Position2["Top"] = "top";
|
|
13236
|
-
Position2["Left"] = "left";
|
|
13237
|
-
Position2["Right"] = "right";
|
|
13238
|
-
Position2["TopRight"] = "top-right";
|
|
13239
|
-
Position2["TopLeft"] = "top-left";
|
|
13240
|
-
Position2["BottomLeft"] = "bottom-left";
|
|
13241
|
-
Position2["BottomRight"] = "bottom-right";
|
|
13242
|
-
return Position2;
|
|
13243
|
-
})(Position || {});
|
|
13244
|
-
var ChartType = /* @__PURE__ */ ((ChartType2) => {
|
|
13245
|
-
ChartType2["Line"] = "line";
|
|
13246
|
-
ChartType2["Bar"] = "bar";
|
|
13247
|
-
return ChartType2;
|
|
13248
|
-
})(ChartType || {});
|
|
13249
|
-
var CursorStyle = /* @__PURE__ */ ((CursorStyle2) => {
|
|
13250
|
-
CursorStyle2["Pointer"] = "pointer";
|
|
13251
|
-
CursorStyle2["Initial"] = "initial";
|
|
13252
|
-
return CursorStyle2;
|
|
13253
|
-
})(CursorStyle || {});
|
|
13254
|
-
var ScaleType = /* @__PURE__ */ ((ScaleType2) => {
|
|
13255
|
-
ScaleType2["Category"] = "category";
|
|
13256
|
-
ScaleType2["Linear"] = "linear";
|
|
13257
|
-
ScaleType2["Logarithmic"] = "logarithmic";
|
|
13258
|
-
return ScaleType2;
|
|
13259
|
-
})(ScaleType || {});
|
|
13260
|
-
var ChartDirection = /* @__PURE__ */ ((ChartDirection2) => {
|
|
13261
|
-
ChartDirection2["Vertical"] = "vertical";
|
|
13262
|
-
return ChartDirection2;
|
|
13263
|
-
})(ChartDirection || {});
|
|
13264
|
-
var TooltipLabel = /* @__PURE__ */ ((TooltipLabel2) => {
|
|
13265
|
-
TooltipLabel2["Y"] = "yLabel";
|
|
13266
|
-
TooltipLabel2["X"] = "xLabel";
|
|
13267
|
-
return TooltipLabel2;
|
|
13268
|
-
})(TooltipLabel || {});
|
|
13269
|
-
var AlignOptions = /* @__PURE__ */ ((AlignOptions2) => {
|
|
13270
|
-
AlignOptions2["End"] = "end";
|
|
13271
|
-
AlignOptions2["Start"] = "start";
|
|
13272
|
-
AlignOptions2["Center"] = "center";
|
|
13273
|
-
AlignOptions2["Right"] = "right";
|
|
13274
|
-
AlignOptions2["Left"] = "left";
|
|
13275
|
-
return AlignOptions2;
|
|
13276
|
-
})(AlignOptions || {});
|
|
13277
|
-
var AnnotationType = /* @__PURE__ */ ((AnnotationType2) => {
|
|
13278
|
-
AnnotationType2["Box"] = "box";
|
|
13279
|
-
AnnotationType2["Ellipse"] = "ellipse";
|
|
13280
|
-
AnnotationType2["Line"] = "line";
|
|
13281
|
-
AnnotationType2["Text"] = "text";
|
|
13282
|
-
return AnnotationType2;
|
|
13283
|
-
})(AnnotationType || {});
|
|
13284
|
-
var PointStyle = /* @__PURE__ */ ((PointStyle2) => {
|
|
13285
|
-
PointStyle2["Circle"] = "circle";
|
|
13286
|
-
return PointStyle2;
|
|
13287
|
-
})(PointStyle || {});
|
|
13288
|
-
var ChartHoverMode = /* @__PURE__ */ ((ChartHoverMode2) => {
|
|
13289
|
-
ChartHoverMode2["Nearest"] = "nearest";
|
|
13290
|
-
return ChartHoverMode2;
|
|
13291
|
-
})(ChartHoverMode || {});
|
|
13292
|
-
var PanZoomMode = /* @__PURE__ */ ((PanZoomMode2) => {
|
|
13293
|
-
PanZoomMode2["X"] = "x";
|
|
13294
|
-
PanZoomMode2["Y"] = "y";
|
|
13295
|
-
PanZoomMode2["XY"] = "xy";
|
|
13296
|
-
PanZoomMode2["Z"] = "z";
|
|
13297
|
-
return PanZoomMode2;
|
|
13298
|
-
})(PanZoomMode || {});
|
|
13299
|
-
var Key = /* @__PURE__ */ ((Key2) => {
|
|
13300
|
-
Key2["Shift"] = "Shift";
|
|
13301
|
-
return Key2;
|
|
13302
|
-
})(Key || {});
|
|
13303
|
-
var Events = /* @__PURE__ */ ((Events2) => {
|
|
13304
|
-
Events2["Mousemove"] = "mousemove";
|
|
13305
|
-
Events2["Mouseout"] = "mouseout";
|
|
13306
|
-
Events2["Click"] = "click";
|
|
13307
|
-
Events2["Touchstart"] = "touchstart";
|
|
13308
|
-
Events2["Touchmove"] = "touchmove";
|
|
13309
|
-
Events2["Dblclick"] = "dblclick";
|
|
13310
|
-
return Events2;
|
|
13311
|
-
})(Events || {});
|
|
13312
|
-
const chartAreaBorderPlugin = {
|
|
13313
|
-
id: "chartAreaBorder",
|
|
13314
|
-
beforeDraw(chart2, _args, options) {
|
|
13315
|
-
const {
|
|
13316
|
-
ctx,
|
|
13317
|
-
chartArea: { left: left2, top: top2, width, height }
|
|
13318
|
-
} = chart2;
|
|
13319
|
-
ctx.save();
|
|
13320
|
-
ctx.strokeStyle = options.borderColor;
|
|
13321
|
-
ctx.lineWidth = options.borderWidth;
|
|
13322
|
-
ctx.setLineDash(options.borderDash || []);
|
|
13323
|
-
ctx.lineDashOffset = options.borderDashOffset;
|
|
13324
|
-
ctx.strokeRect(left2, top2, width, height);
|
|
13325
|
-
ctx.restore();
|
|
13326
|
-
}
|
|
13327
|
-
};
|
|
13328
|
-
const getPlugins = (graph, legend2) => {
|
|
13329
|
-
var _a2;
|
|
13330
|
-
let plugins = [];
|
|
13331
|
-
if (graph.showMinorGridlines) {
|
|
13332
|
-
plugins.push(chartMinorGridlinesPlugin);
|
|
13333
|
-
}
|
|
13334
|
-
const customLegend = legend2 == null ? void 0 : legend2.customLegend;
|
|
13335
|
-
if ((customLegend == null ? void 0 : customLegend.customLegendPlugin) && (customLegend == null ? void 0 : customLegend.customLegendContainerID)) {
|
|
13336
|
-
plugins.push({
|
|
13337
|
-
id: CUSTOM_LEGEND_PLUGIN_NAME,
|
|
13338
|
-
...(_a2 = legend2 == null ? void 0 : legend2.customLegend) == null ? void 0 : _a2.customLegendPlugin
|
|
13339
|
-
});
|
|
13340
|
-
}
|
|
13341
|
-
plugins.push(chartAreaBorderPlugin);
|
|
13342
|
-
return plugins;
|
|
13343
|
-
};
|
|
13344
|
-
const generateRandomColor = (colors2) => {
|
|
13345
|
-
const color2 = `#${Math.floor(Math.random() * WHITE_COLOR_AS_DECIMAL).toString(
|
|
13346
|
-
16
|
|
13347
|
-
)}`;
|
|
13348
|
-
if (colors2.includes(color2)) {
|
|
13349
|
-
return generateRandomColor(colors2);
|
|
13350
|
-
} else {
|
|
13351
|
-
colors2.push(color2);
|
|
13352
|
-
return colors2;
|
|
13353
|
-
}
|
|
13354
|
-
};
|
|
13355
|
-
const setAnnotations = (annotationsData) => {
|
|
13356
|
-
return (annotationsData == null ? void 0 : annotationsData.length) ? annotationsData.map((_v, i2) => i2) : [];
|
|
13357
|
-
};
|
|
13358
|
-
const getTitle = (options) => {
|
|
13359
|
-
return options.title !== "" ? {
|
|
13360
|
-
display: true,
|
|
13361
|
-
text: options.title
|
|
13362
|
-
} : {};
|
|
13363
|
-
};
|
|
13364
|
-
const isVertical = (direction) => {
|
|
13365
|
-
return direction === ChartDirection.Vertical;
|
|
13366
|
-
};
|
|
13367
|
-
const getAxisPosition = (axisType, i2) => {
|
|
13368
|
-
const [positionA, positionB] = axisType === AxisType.Y ? [Position.Left, Position.Right] : [Position.Top, Position.Bottom];
|
|
13369
|
-
return i2 % 2 === 0 ? positionA : positionB;
|
|
13370
|
-
};
|
|
13371
|
-
const getClassName = (chartStyling, styles2) => {
|
|
13372
|
-
const { width, height, staticChartHeight, squareAspectRatio: squareAspectRatio2 } = chartStyling;
|
|
13373
|
-
const squareAspectRatioStyle = squareAspectRatio2 ? styles2.squareAspectRatio : "";
|
|
13374
|
-
let heightStyles = "";
|
|
13375
|
-
if (width || height) {
|
|
13376
|
-
heightStyles = "";
|
|
13377
|
-
} else {
|
|
13378
|
-
heightStyles = staticChartHeight ? styles2 == null ? void 0 : styles2.fixedHeight : styles2 == null ? void 0 : styles2.stretchHeight;
|
|
13379
|
-
}
|
|
13380
|
-
return cx(styles2.chart, heightStyles, squareAspectRatioStyle);
|
|
13381
|
-
};
|
|
13382
|
-
const getLegend = (options, clickHandler) => {
|
|
13383
|
-
const { legend: legend2 } = options || {};
|
|
13384
|
-
return {
|
|
13385
|
-
position: (legend2 == null ? void 0 : legend2.position) || Position.Top,
|
|
13386
|
-
display: legend2 == null ? void 0 : legend2.display,
|
|
13387
|
-
align: legend2 == null ? void 0 : legend2.align,
|
|
13388
|
-
labels: {
|
|
13389
|
-
boxHeight: LEGEND_LABEL_BOX_SIZE,
|
|
13390
|
-
boxWidth: (legend2 == null ? void 0 : legend2.usePointStyle) ? LEGEND_LABEL_BOX_SIZE : void 0,
|
|
13391
|
-
usePointStyle: legend2 == null ? void 0 : legend2.usePointStyle
|
|
13392
|
-
},
|
|
13393
|
-
onClick: clickHandler
|
|
13394
|
-
};
|
|
13395
|
-
};
|
|
13396
|
-
const afterLabelCallback = (tooltipItem) => {
|
|
13397
|
-
const { error } = tooltipItem.dataset.data[tooltipItem == null ? void 0 : tooltipItem.dataIndex];
|
|
13398
|
-
return error ? `Error: ${round$2(error, 4)}` : "";
|
|
13399
|
-
};
|
|
13400
|
-
const getTooltipLabel = (tooltipItem, showLabelsInTooltips) => {
|
|
13401
|
-
var _a2;
|
|
13402
|
-
const datasetDataLabel = (_a2 = tooltipItem.dataset.data[tooltipItem.dataIndex]) == null ? void 0 : _a2.label;
|
|
13403
|
-
const dataLabel = Array.isArray(datasetDataLabel) ? datasetDataLabel.join(" , ") : datasetDataLabel;
|
|
13404
|
-
return showLabelsInTooltips && (dataLabel == null ? void 0 : dataLabel.length) ? ` (${dataLabel})` : "";
|
|
13405
|
-
};
|
|
13406
|
-
const getChartFileName = (axes) => {
|
|
13407
|
-
if (!axes) {
|
|
13408
|
-
return DEFAULT_CHART_NAME;
|
|
13409
|
-
}
|
|
13410
|
-
const axesLabels = axes.reduce((acc, cur, index2) => {
|
|
13411
|
-
var _a2;
|
|
13412
|
-
const labelWithNoSpace = ((_a2 = cur.label) == null ? void 0 : _a2.replace(/\s/g, "_")) || String(index2);
|
|
13413
|
-
return [...acc, labelWithNoSpace];
|
|
13414
|
-
}, []);
|
|
13415
|
-
return axesLabels.join("_");
|
|
13416
|
-
};
|
|
13417
|
-
const setDefaultTheme = () => {
|
|
13418
|
-
defaults$2.font.size = DEFAULT_FONT_SIZE;
|
|
13419
|
-
defaults$2.font.family = DEFAULT_FONT_FAMILY;
|
|
13420
|
-
defaults$2.color = DEFAULT_COLOR;
|
|
13421
|
-
defaults$2.borderColor = BORDER_COLOR;
|
|
13422
|
-
};
|
|
13423
|
-
const isNilOrEmpty = (value) => {
|
|
13424
|
-
if (value === null || value === void 0 || value === "") {
|
|
13425
|
-
return true;
|
|
13426
|
-
}
|
|
13427
|
-
if (Array.isArray(value) && value.length === 0) {
|
|
13428
|
-
return true;
|
|
13429
|
-
}
|
|
13430
|
-
if (typeof value === "object" && Object.keys(value).length === 0) {
|
|
13431
|
-
return true;
|
|
13432
|
-
}
|
|
13433
|
-
return false;
|
|
13434
|
-
};
|
|
13435
|
-
const chart$3 = "_chart_1v6ps_1";
|
|
13436
|
-
const styles$5 = {
|
|
13437
|
-
chart: chart$3
|
|
13438
|
-
};
|
|
13439
|
-
const ScatterChart = (props) => {
|
|
13440
|
-
setDefaultTheme();
|
|
13441
|
-
const { data = { datasets: [] }, options, testId = null } = props.chart;
|
|
13442
|
-
return /* @__PURE__ */ jsx("div", { className: styles$5.chart, children: /* @__PURE__ */ jsx(Scatter, { options, data, "data-testid": testId }) });
|
|
13443
|
-
};
|
|
13444
12983
|
function getDefaultExportFromCjs(x2) {
|
|
13445
12984
|
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
13446
12985
|
}
|
|
@@ -22632,6 +22171,338 @@ const reducer$1 = (state, action) => {
|
|
|
22632
22171
|
}
|
|
22633
22172
|
});
|
|
22634
22173
|
};
|
|
22174
|
+
var AxisType = /* @__PURE__ */ ((AxisType2) => {
|
|
22175
|
+
AxisType2["X"] = "x";
|
|
22176
|
+
AxisType2["Y"] = "y";
|
|
22177
|
+
return AxisType2;
|
|
22178
|
+
})(AxisType || {});
|
|
22179
|
+
var Position = /* @__PURE__ */ ((Position2) => {
|
|
22180
|
+
Position2["Bottom"] = "bottom";
|
|
22181
|
+
Position2["Top"] = "top";
|
|
22182
|
+
Position2["Left"] = "left";
|
|
22183
|
+
Position2["Right"] = "right";
|
|
22184
|
+
Position2["TopRight"] = "top-right";
|
|
22185
|
+
Position2["TopLeft"] = "top-left";
|
|
22186
|
+
Position2["BottomLeft"] = "bottom-left";
|
|
22187
|
+
Position2["BottomRight"] = "bottom-right";
|
|
22188
|
+
return Position2;
|
|
22189
|
+
})(Position || {});
|
|
22190
|
+
var ChartType = /* @__PURE__ */ ((ChartType2) => {
|
|
22191
|
+
ChartType2["Line"] = "line";
|
|
22192
|
+
ChartType2["Bar"] = "bar";
|
|
22193
|
+
return ChartType2;
|
|
22194
|
+
})(ChartType || {});
|
|
22195
|
+
var CursorStyle = /* @__PURE__ */ ((CursorStyle2) => {
|
|
22196
|
+
CursorStyle2["Pointer"] = "pointer";
|
|
22197
|
+
CursorStyle2["Initial"] = "initial";
|
|
22198
|
+
return CursorStyle2;
|
|
22199
|
+
})(CursorStyle || {});
|
|
22200
|
+
var ScaleType = /* @__PURE__ */ ((ScaleType2) => {
|
|
22201
|
+
ScaleType2["Category"] = "category";
|
|
22202
|
+
ScaleType2["Linear"] = "linear";
|
|
22203
|
+
ScaleType2["Logarithmic"] = "logarithmic";
|
|
22204
|
+
return ScaleType2;
|
|
22205
|
+
})(ScaleType || {});
|
|
22206
|
+
var ChartDirection = /* @__PURE__ */ ((ChartDirection2) => {
|
|
22207
|
+
ChartDirection2["Vertical"] = "vertical";
|
|
22208
|
+
return ChartDirection2;
|
|
22209
|
+
})(ChartDirection || {});
|
|
22210
|
+
var TooltipLabel = /* @__PURE__ */ ((TooltipLabel2) => {
|
|
22211
|
+
TooltipLabel2["Y"] = "yLabel";
|
|
22212
|
+
TooltipLabel2["X"] = "xLabel";
|
|
22213
|
+
return TooltipLabel2;
|
|
22214
|
+
})(TooltipLabel || {});
|
|
22215
|
+
var AlignOptions = /* @__PURE__ */ ((AlignOptions2) => {
|
|
22216
|
+
AlignOptions2["End"] = "end";
|
|
22217
|
+
AlignOptions2["Start"] = "start";
|
|
22218
|
+
AlignOptions2["Center"] = "center";
|
|
22219
|
+
AlignOptions2["Right"] = "right";
|
|
22220
|
+
AlignOptions2["Left"] = "left";
|
|
22221
|
+
return AlignOptions2;
|
|
22222
|
+
})(AlignOptions || {});
|
|
22223
|
+
var AnnotationType = /* @__PURE__ */ ((AnnotationType2) => {
|
|
22224
|
+
AnnotationType2["Box"] = "box";
|
|
22225
|
+
AnnotationType2["Ellipse"] = "ellipse";
|
|
22226
|
+
AnnotationType2["Line"] = "line";
|
|
22227
|
+
AnnotationType2["Text"] = "text";
|
|
22228
|
+
return AnnotationType2;
|
|
22229
|
+
})(AnnotationType || {});
|
|
22230
|
+
var PointStyle = /* @__PURE__ */ ((PointStyle2) => {
|
|
22231
|
+
PointStyle2["Circle"] = "circle";
|
|
22232
|
+
return PointStyle2;
|
|
22233
|
+
})(PointStyle || {});
|
|
22234
|
+
var ChartHoverMode = /* @__PURE__ */ ((ChartHoverMode2) => {
|
|
22235
|
+
ChartHoverMode2["Nearest"] = "nearest";
|
|
22236
|
+
return ChartHoverMode2;
|
|
22237
|
+
})(ChartHoverMode || {});
|
|
22238
|
+
var PanZoomMode = /* @__PURE__ */ ((PanZoomMode2) => {
|
|
22239
|
+
PanZoomMode2["X"] = "x";
|
|
22240
|
+
PanZoomMode2["Y"] = "y";
|
|
22241
|
+
PanZoomMode2["XY"] = "xy";
|
|
22242
|
+
PanZoomMode2["Z"] = "z";
|
|
22243
|
+
return PanZoomMode2;
|
|
22244
|
+
})(PanZoomMode || {});
|
|
22245
|
+
var Key = /* @__PURE__ */ ((Key2) => {
|
|
22246
|
+
Key2["Shift"] = "Shift";
|
|
22247
|
+
return Key2;
|
|
22248
|
+
})(Key || {});
|
|
22249
|
+
var Events = /* @__PURE__ */ ((Events2) => {
|
|
22250
|
+
Events2["Mousemove"] = "mousemove";
|
|
22251
|
+
Events2["Mouseout"] = "mouseout";
|
|
22252
|
+
Events2["Click"] = "click";
|
|
22253
|
+
Events2["Touchstart"] = "touchstart";
|
|
22254
|
+
Events2["Touchmove"] = "touchmove";
|
|
22255
|
+
Events2["Dblclick"] = "dblclick";
|
|
22256
|
+
return Events2;
|
|
22257
|
+
})(Events || {});
|
|
22258
|
+
const MINOR_TICKS_PER_MAJOR = 10;
|
|
22259
|
+
const getLargestMajorTickWidth = (majorTickPositions) => {
|
|
22260
|
+
return majorTickPositions.reduce(
|
|
22261
|
+
(acc, curr, index2) => {
|
|
22262
|
+
if (index2 === 0)
|
|
22263
|
+
return acc;
|
|
22264
|
+
const gap = Math.abs(curr - majorTickPositions[index2 - 1]);
|
|
22265
|
+
return Math.max(gap, acc);
|
|
22266
|
+
},
|
|
22267
|
+
0
|
|
22268
|
+
);
|
|
22269
|
+
};
|
|
22270
|
+
const isValidPosition = (minorTickPosition, majorTickPositions, scale) => {
|
|
22271
|
+
const { axis, left: left2, top: top2, right: right2, bottom: bottom2 } = scale;
|
|
22272
|
+
const isHorizontal = axis === "x";
|
|
22273
|
+
const start = isHorizontal ? left2 : top2;
|
|
22274
|
+
const end = isHorizontal ? right2 : bottom2;
|
|
22275
|
+
const isAfterStart = minorTickPosition > start;
|
|
22276
|
+
const isBeforeEnd = minorTickPosition < end;
|
|
22277
|
+
const isDuplicate = majorTickPositions.indexOf(minorTickPosition) !== -1;
|
|
22278
|
+
return isAfterStart && isBeforeEnd && !isDuplicate;
|
|
22279
|
+
};
|
|
22280
|
+
const getMinorTickPositions = (majorTickPositions, scale) => {
|
|
22281
|
+
const sortedMajorTickPositions = majorTickPositions.sort((a2, b2) => {
|
|
22282
|
+
return a2 - b2;
|
|
22283
|
+
});
|
|
22284
|
+
const minorTickWidth = getLargestMajorTickWidth(majorTickPositions) / 10;
|
|
22285
|
+
const startPosition = majorTickPositions[0];
|
|
22286
|
+
const numMinorTicks = (majorTickPositions.length + 1) * MINOR_TICKS_PER_MAJOR;
|
|
22287
|
+
const positions2 = [...Array(numMinorTicks)].map((_2, index2) => {
|
|
22288
|
+
const minorTickPosition = startPosition + (index2 - MINOR_TICKS_PER_MAJOR + 1) * minorTickWidth;
|
|
22289
|
+
return parseFloat(minorTickPosition.toFixed(1));
|
|
22290
|
+
}).filter(
|
|
22291
|
+
(position) => isValidPosition(position, sortedMajorTickPositions, scale)
|
|
22292
|
+
);
|
|
22293
|
+
return positions2;
|
|
22294
|
+
};
|
|
22295
|
+
const drawMinorTicksForScale = (scale) => {
|
|
22296
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
|
|
22297
|
+
const { chart: chart2, ctx } = scale;
|
|
22298
|
+
const config2 = chart2.config;
|
|
22299
|
+
if (!((_d2 = (_c2 = (_b2 = (_a2 = config2 == null ? void 0 : config2.options) == null ? void 0 : _a2.scales) == null ? void 0 : _b2[scale.id]) == null ? void 0 : _c2.grid) == null ? void 0 : _d2.drawOnChartArea))
|
|
22300
|
+
return;
|
|
22301
|
+
if (config2.options.indexAxis === scale.axis)
|
|
22302
|
+
return;
|
|
22303
|
+
const isHorizontal = scale.axis === "x";
|
|
22304
|
+
const majorTickPositions = scale.ticks.map((_2, index2) => scale.getPixelForTick(index2)).sort((a2, b2) => a2 - b2);
|
|
22305
|
+
const minorTickPositions = getMinorTickPositions(majorTickPositions, scale);
|
|
22306
|
+
ctx.save();
|
|
22307
|
+
ctx.strokeStyle = ((_i2 = (_h2 = (_g2 = (_f2 = (_e2 = config2 == null ? void 0 : config2._config) == null ? void 0 : _e2.options) == null ? void 0 : _f2.scales) == null ? void 0 : _g2[scale.id]) == null ? void 0 : _h2.grid) == null ? void 0 : _i2.color) || "rgba(0,0,0,0.06)";
|
|
22308
|
+
ctx.lineWidth = 0.5;
|
|
22309
|
+
minorTickPositions.forEach((minorTickPosition) => {
|
|
22310
|
+
ctx.beginPath();
|
|
22311
|
+
if (isHorizontal) {
|
|
22312
|
+
const { top: top2, bottom: bottom2 } = chart2.chartArea;
|
|
22313
|
+
ctx.moveTo(minorTickPosition, top2);
|
|
22314
|
+
ctx.lineTo(minorTickPosition, bottom2);
|
|
22315
|
+
} else {
|
|
22316
|
+
const { left: left2, right: right2 } = chart2.chartArea;
|
|
22317
|
+
ctx.moveTo(left2, minorTickPosition);
|
|
22318
|
+
ctx.lineTo(right2, minorTickPosition);
|
|
22319
|
+
}
|
|
22320
|
+
ctx.stroke();
|
|
22321
|
+
});
|
|
22322
|
+
ctx.restore();
|
|
22323
|
+
};
|
|
22324
|
+
const chartMinorGridlinesPlugin = {
|
|
22325
|
+
id: "minorGridlines",
|
|
22326
|
+
beforeDatasetsDraw: (chart2) => {
|
|
22327
|
+
const { scales } = chart2;
|
|
22328
|
+
Object.keys(scales).forEach((id) => drawMinorTicksForScale(scales[id]));
|
|
22329
|
+
}
|
|
22330
|
+
};
|
|
22331
|
+
const BORDER_WIDTH = {
|
|
22332
|
+
INITIAL: 2,
|
|
22333
|
+
HOVERED: 6
|
|
22334
|
+
};
|
|
22335
|
+
const BORDER_COLOR = "rgba(0,0,0,0.1)";
|
|
22336
|
+
const ANNOTATION_DASH = [10, 2];
|
|
22337
|
+
const DEFAULT_FONT_SIZE = 13;
|
|
22338
|
+
const DEFAULT_FONT_FAMILY = '"Lato", sans-serif';
|
|
22339
|
+
const DEFAULT_COLOR = "rgba(0,0,0,.87)";
|
|
22340
|
+
const LEGEND_LABEL_BOX_SIZE = 12;
|
|
22341
|
+
const TOOLTIP_PADDING = 8;
|
|
22342
|
+
const TOOLTIP_BOX_PADDING = 4;
|
|
22343
|
+
const LOGARITHMIC_STEPS = [1, 10, 100, 1e3, 1e4];
|
|
22344
|
+
const COLORS = [
|
|
22345
|
+
"#3366cc",
|
|
22346
|
+
"#dc3912",
|
|
22347
|
+
"#ff9900",
|
|
22348
|
+
"#109618",
|
|
22349
|
+
"#990099",
|
|
22350
|
+
"#0099c6",
|
|
22351
|
+
"#dd4477",
|
|
22352
|
+
"#66aa00",
|
|
22353
|
+
"#b82e2e",
|
|
22354
|
+
"#316395",
|
|
22355
|
+
"#994499",
|
|
22356
|
+
"#22aa99",
|
|
22357
|
+
"#aaaa11",
|
|
22358
|
+
"#6633cc",
|
|
22359
|
+
"#e67300",
|
|
22360
|
+
"#8b0707",
|
|
22361
|
+
"#651067",
|
|
22362
|
+
"#329262",
|
|
22363
|
+
"#5574a6",
|
|
22364
|
+
"#3b3eac"
|
|
22365
|
+
];
|
|
22366
|
+
const ALPHA_CHANEL = "99";
|
|
22367
|
+
const WHITE_COLOR_AS_DECIMAL = 16777215;
|
|
22368
|
+
const AUTO = "auto";
|
|
22369
|
+
const ANIMATION_DURATION = {
|
|
22370
|
+
NO: 0,
|
|
22371
|
+
SLOW: 400,
|
|
22372
|
+
FAST: 1e3
|
|
22373
|
+
};
|
|
22374
|
+
const DEFAULT_CHART_NAME = "new_chart";
|
|
22375
|
+
const CUSTOM_LEGEND_PLUGIN_NAME = "htmlLegend";
|
|
22376
|
+
const DECIMAL_POINT_TOLERANCE = 9;
|
|
22377
|
+
const MAX_DECIMAL_DIFF = 1 / 10 ** DECIMAL_POINT_TOLERANCE;
|
|
22378
|
+
const chartAreaBorderPlugin = {
|
|
22379
|
+
id: "chartAreaBorder",
|
|
22380
|
+
beforeDraw(chart2, _args, options) {
|
|
22381
|
+
const {
|
|
22382
|
+
ctx,
|
|
22383
|
+
chartArea: { left: left2, top: top2, width, height }
|
|
22384
|
+
} = chart2;
|
|
22385
|
+
ctx.save();
|
|
22386
|
+
ctx.strokeStyle = options.borderColor;
|
|
22387
|
+
ctx.lineWidth = options.borderWidth;
|
|
22388
|
+
ctx.setLineDash(options.borderDash || []);
|
|
22389
|
+
ctx.lineDashOffset = options.borderDashOffset;
|
|
22390
|
+
ctx.strokeRect(left2, top2, width, height);
|
|
22391
|
+
ctx.restore();
|
|
22392
|
+
}
|
|
22393
|
+
};
|
|
22394
|
+
const getPlugins = (graph, legend2) => {
|
|
22395
|
+
var _a2;
|
|
22396
|
+
let plugins = [];
|
|
22397
|
+
if (graph.showMinorGridlines) {
|
|
22398
|
+
plugins.push(chartMinorGridlinesPlugin);
|
|
22399
|
+
}
|
|
22400
|
+
const customLegend = legend2 == null ? void 0 : legend2.customLegend;
|
|
22401
|
+
if ((customLegend == null ? void 0 : customLegend.customLegendPlugin) && (customLegend == null ? void 0 : customLegend.customLegendContainerID)) {
|
|
22402
|
+
plugins.push({
|
|
22403
|
+
id: CUSTOM_LEGEND_PLUGIN_NAME,
|
|
22404
|
+
...(_a2 = legend2 == null ? void 0 : legend2.customLegend) == null ? void 0 : _a2.customLegendPlugin
|
|
22405
|
+
});
|
|
22406
|
+
}
|
|
22407
|
+
plugins.push(chartAreaBorderPlugin);
|
|
22408
|
+
return plugins;
|
|
22409
|
+
};
|
|
22410
|
+
const generateRandomColor = (colors2) => {
|
|
22411
|
+
const color2 = `#${Math.floor(Math.random() * WHITE_COLOR_AS_DECIMAL).toString(
|
|
22412
|
+
16
|
|
22413
|
+
)}`;
|
|
22414
|
+
if (colors2.includes(color2)) {
|
|
22415
|
+
return generateRandomColor(colors2);
|
|
22416
|
+
} else {
|
|
22417
|
+
colors2.push(color2);
|
|
22418
|
+
return colors2;
|
|
22419
|
+
}
|
|
22420
|
+
};
|
|
22421
|
+
const setAnnotations = (annotationsData) => {
|
|
22422
|
+
return (annotationsData == null ? void 0 : annotationsData.length) ? annotationsData.map((_v, i2) => i2) : [];
|
|
22423
|
+
};
|
|
22424
|
+
const getTitle = (options) => {
|
|
22425
|
+
return options.title !== "" ? {
|
|
22426
|
+
display: true,
|
|
22427
|
+
text: options.title
|
|
22428
|
+
} : {};
|
|
22429
|
+
};
|
|
22430
|
+
const isVertical = (direction) => {
|
|
22431
|
+
return direction === ChartDirection.Vertical;
|
|
22432
|
+
};
|
|
22433
|
+
const getAxisPosition = (axisType, i2) => {
|
|
22434
|
+
const [positionA, positionB] = axisType === AxisType.Y ? [Position.Left, Position.Right] : [Position.Top, Position.Bottom];
|
|
22435
|
+
return i2 % 2 === 0 ? positionA : positionB;
|
|
22436
|
+
};
|
|
22437
|
+
const getClassName = (chartStyling, styles2) => {
|
|
22438
|
+
const {
|
|
22439
|
+
width,
|
|
22440
|
+
height,
|
|
22441
|
+
staticChartHeight = false,
|
|
22442
|
+
squareAspectRatio: squareAspectRatio2 = 0
|
|
22443
|
+
} = chartStyling;
|
|
22444
|
+
const squareAspectRatioStyle = squareAspectRatio2 ? styles2.squareAspectRatio : "";
|
|
22445
|
+
let heightStyles = "";
|
|
22446
|
+
if (width || height) {
|
|
22447
|
+
heightStyles = "";
|
|
22448
|
+
} else {
|
|
22449
|
+
heightStyles = staticChartHeight ? styles2 == null ? void 0 : styles2.fixedHeight : styles2 == null ? void 0 : styles2.stretchHeight;
|
|
22450
|
+
}
|
|
22451
|
+
return cx(styles2.chart, heightStyles, squareAspectRatioStyle);
|
|
22452
|
+
};
|
|
22453
|
+
const getLegend = (options, clickHandler) => {
|
|
22454
|
+
const { legend: legend2 } = options || {};
|
|
22455
|
+
return {
|
|
22456
|
+
position: (legend2 == null ? void 0 : legend2.position) || Position.Top,
|
|
22457
|
+
display: legend2 == null ? void 0 : legend2.display,
|
|
22458
|
+
align: legend2 == null ? void 0 : legend2.align,
|
|
22459
|
+
labels: {
|
|
22460
|
+
boxHeight: LEGEND_LABEL_BOX_SIZE,
|
|
22461
|
+
boxWidth: (legend2 == null ? void 0 : legend2.usePointStyle) ? LEGEND_LABEL_BOX_SIZE : void 0,
|
|
22462
|
+
usePointStyle: legend2 == null ? void 0 : legend2.usePointStyle
|
|
22463
|
+
},
|
|
22464
|
+
onClick: clickHandler
|
|
22465
|
+
};
|
|
22466
|
+
};
|
|
22467
|
+
const afterLabelCallback = (tooltipItem) => {
|
|
22468
|
+
const { error } = tooltipItem.dataset.data[tooltipItem == null ? void 0 : tooltipItem.dataIndex];
|
|
22469
|
+
return error ? `Error: ${round$2(error, 4)}` : "";
|
|
22470
|
+
};
|
|
22471
|
+
const getTooltipLabel = (tooltipItem, showLabelsInTooltips) => {
|
|
22472
|
+
var _a2;
|
|
22473
|
+
const datasetDataLabel = (_a2 = tooltipItem.dataset.data[tooltipItem.dataIndex]) == null ? void 0 : _a2.label;
|
|
22474
|
+
const dataLabel = Array.isArray(datasetDataLabel) ? datasetDataLabel.join(" , ") : datasetDataLabel;
|
|
22475
|
+
return showLabelsInTooltips && (dataLabel == null ? void 0 : dataLabel.length) ? ` (${dataLabel})` : "";
|
|
22476
|
+
};
|
|
22477
|
+
const getChartFileName = (axes) => {
|
|
22478
|
+
if (!axes) {
|
|
22479
|
+
return DEFAULT_CHART_NAME;
|
|
22480
|
+
}
|
|
22481
|
+
const axesLabels = axes.reduce((acc, cur, index2) => {
|
|
22482
|
+
var _a2;
|
|
22483
|
+
const labelWithNoSpace = ((_a2 = cur.label) == null ? void 0 : _a2.replace(/\s/g, "_")) || String(index2);
|
|
22484
|
+
return [...acc, labelWithNoSpace];
|
|
22485
|
+
}, []);
|
|
22486
|
+
return axesLabels.join("_");
|
|
22487
|
+
};
|
|
22488
|
+
const setDefaultTheme = () => {
|
|
22489
|
+
defaults$2.font.size = DEFAULT_FONT_SIZE;
|
|
22490
|
+
defaults$2.font.family = DEFAULT_FONT_FAMILY;
|
|
22491
|
+
defaults$2.color = DEFAULT_COLOR;
|
|
22492
|
+
defaults$2.borderColor = BORDER_COLOR;
|
|
22493
|
+
};
|
|
22494
|
+
const isNilOrEmpty = (value) => {
|
|
22495
|
+
if (value === null || value === void 0 || value === "") {
|
|
22496
|
+
return true;
|
|
22497
|
+
}
|
|
22498
|
+
if (Array.isArray(value) && value.length === 0) {
|
|
22499
|
+
return true;
|
|
22500
|
+
}
|
|
22501
|
+
if (typeof value === "object" && Object.keys(value).length === 0) {
|
|
22502
|
+
return true;
|
|
22503
|
+
}
|
|
22504
|
+
return false;
|
|
22505
|
+
};
|
|
22635
22506
|
const isLessThanMax = (value, max) => {
|
|
22636
22507
|
return value === void 0 || max === void 0 || Number(value) < Number(max);
|
|
22637
22508
|
};
|
|
@@ -22766,7 +22637,8 @@ const initialState = ({ options, persistenceId }) => {
|
|
|
22766
22637
|
axes: stateAxes,
|
|
22767
22638
|
showAnnotationLineIndex: setAnnotations(annotationsData),
|
|
22768
22639
|
showTable: false,
|
|
22769
|
-
enableDragPoints: dragData.enableDragData && enableDragPoints
|
|
22640
|
+
enableDragPoints: (dragData == null ? void 0 : dragData.enableDragData) && enableDragPoints,
|
|
22641
|
+
initialAxesRanges: []
|
|
22770
22642
|
};
|
|
22771
22643
|
};
|
|
22772
22644
|
var DefaultContext = {
|
|
@@ -22871,7 +22743,8 @@ const LineOptions = ({
|
|
|
22871
22743
|
onToggleLine,
|
|
22872
22744
|
onTogglePoints,
|
|
22873
22745
|
pointsEnabled,
|
|
22874
|
-
translations
|
|
22746
|
+
translations,
|
|
22747
|
+
hasCustomOpt
|
|
22875
22748
|
}) => {
|
|
22876
22749
|
const options = [
|
|
22877
22750
|
{
|
|
@@ -22901,17 +22774,26 @@ const LineOptions = ({
|
|
|
22901
22774
|
}
|
|
22902
22775
|
];
|
|
22903
22776
|
const selectedOption = options.find((option) => option.selected);
|
|
22904
|
-
return /* @__PURE__ */ jsx(
|
|
22905
|
-
|
|
22777
|
+
return /* @__PURE__ */ jsx(
|
|
22778
|
+
Tooltip$2,
|
|
22906
22779
|
{
|
|
22907
|
-
|
|
22908
|
-
|
|
22909
|
-
|
|
22910
|
-
|
|
22911
|
-
|
|
22912
|
-
|
|
22780
|
+
text: selectedOption == null ? void 0 : selectedOption.label,
|
|
22781
|
+
placement: "bottom",
|
|
22782
|
+
enabled: !hasCustomOpt,
|
|
22783
|
+
children: /* @__PURE__ */ jsx(
|
|
22784
|
+
Button,
|
|
22785
|
+
{
|
|
22786
|
+
small: true,
|
|
22787
|
+
basic: true,
|
|
22788
|
+
colored: "muted",
|
|
22789
|
+
round: true,
|
|
22790
|
+
icon: selectedOption == null ? void 0 : selectedOption.icon,
|
|
22791
|
+
onClick: selectedOption == null ? void 0 : selectedOption.onClick,
|
|
22792
|
+
disabled: hasCustomOpt
|
|
22793
|
+
}
|
|
22794
|
+
)
|
|
22913
22795
|
}
|
|
22914
|
-
)
|
|
22796
|
+
);
|
|
22915
22797
|
};
|
|
22916
22798
|
function TbHandStop(props) {
|
|
22917
22799
|
return GenIcon({ "tag": "svg", "attr": { "viewBox": "0 0 24 24", "strokeWidth": "2", "stroke": "currentColor", "fill": "none", "strokeLinecap": "round", "strokeLinejoin": "round" }, "child": [{ "tag": "path", "attr": { "stroke": "none", "d": "M0 0h24v24H0z", "fill": "none" } }, { "tag": "path", "attr": { "d": "M8 13v-7.5a1.5 1.5 0 0 1 3 0v6.5" } }, { "tag": "path", "attr": { "d": "M11 5.5v-2a1.5 1.5 0 1 1 3 0v8.5" } }, { "tag": "path", "attr": { "d": "M14 5.5a1.5 1.5 0 0 1 3 0v6.5" } }, { "tag": "path", "attr": { "d": "M17 7.5a1.5 1.5 0 0 1 3 0v8.5a6 6 0 0 1 -6 6h-2h.208a6 6 0 0 1 -5.012 -2.7a69.74 69.74 0 0 1 -.196 -.3c-.312 -.479 -1.407 -2.388 -3.286 -5.728a1.5 1.5 0 0 1 .536 -2.022a1.867 1.867 0 0 1 2.28 .28l1.47 1.47" } }] })(props);
|
|
@@ -23982,41 +23864,9 @@ const useChartFunctions = ({
|
|
|
23982
23864
|
generatedDatasets
|
|
23983
23865
|
}) => {
|
|
23984
23866
|
const {
|
|
23985
|
-
|
|
23986
|
-
interactions: {
|
|
23987
|
-
onLegendClick,
|
|
23988
|
-
onHover: onPointHover,
|
|
23989
|
-
onUnhover: onPointUnhover
|
|
23990
|
-
},
|
|
23991
|
-
additionalAxesOptions,
|
|
23867
|
+
interactions: { onHover: onPointHover, onUnhover: onPointUnhover },
|
|
23992
23868
|
axes
|
|
23993
23869
|
} = options;
|
|
23994
|
-
const legendClick = useCallback(
|
|
23995
|
-
(_e2, legendItem2) => {
|
|
23996
|
-
const { datasetIndex } = legendItem2;
|
|
23997
|
-
const chartInstance = chartRef == null ? void 0 : chartRef.current;
|
|
23998
|
-
const { datasets } = (chartInstance == null ? void 0 : chartInstance.data) || {};
|
|
23999
|
-
const dataset = datasets[datasetIndex];
|
|
24000
|
-
const meta = chartInstance.getDatasetMeta(datasetIndex);
|
|
24001
|
-
meta.hidden = meta.hidden === null ? !dataset.hidden : null;
|
|
24002
|
-
if (annotations.controlAnnotation && dataset.isAnnotation) {
|
|
24003
|
-
const { annotationIndex } = dataset;
|
|
24004
|
-
dispatch({ type: "TOGGLE_ANNOTATION", payload: { annotationIndex } });
|
|
24005
|
-
}
|
|
24006
|
-
if (dataset.displayGroup) {
|
|
24007
|
-
datasets == null ? void 0 : datasets.forEach((ds, ix) => {
|
|
24008
|
-
if (ds.displayGroup !== dataset.displayGroup)
|
|
24009
|
-
return;
|
|
24010
|
-
chartInstance.getDatasetMeta(ix).hidden = meta.hidden;
|
|
24011
|
-
});
|
|
24012
|
-
}
|
|
24013
|
-
if (onLegendClick) {
|
|
24014
|
-
onLegendClick(legendItem2 == null ? void 0 : legendItem2.text, legendItem2.hidden);
|
|
24015
|
-
}
|
|
24016
|
-
chartInstance == null ? void 0 : chartInstance.update();
|
|
24017
|
-
},
|
|
24018
|
-
[onLegendClick, annotations]
|
|
24019
|
-
);
|
|
24020
23870
|
const resetZoom2 = useCallback(() => {
|
|
24021
23871
|
const chartInstance = chartRef == null ? void 0 : chartRef.current;
|
|
24022
23872
|
chartInstance == null ? void 0 : chartInstance.resetZoom();
|
|
@@ -24087,18 +23937,6 @@ const useChartFunctions = ({
|
|
|
24087
23937
|
},
|
|
24088
23938
|
[chartRef]
|
|
24089
23939
|
);
|
|
24090
|
-
const controlsAxes = state.axes.map((axis, i2) => {
|
|
24091
|
-
var _a2, _b2, _c2, _d2;
|
|
24092
|
-
const axisType = i2 ? AxisType.Y : AxisType.X;
|
|
24093
|
-
const min = axis.min ?? ((_b2 = (_a2 = additionalAxesOptions == null ? void 0 : additionalAxesOptions.range) == null ? void 0 : _a2[axisType]) == null ? void 0 : _b2.min);
|
|
24094
|
-
const max = axis.max ?? ((_d2 = (_c2 = additionalAxesOptions == null ? void 0 : additionalAxesOptions.range) == null ? void 0 : _c2[axisType]) == null ? void 0 : _d2.max);
|
|
24095
|
-
return {
|
|
24096
|
-
...axis,
|
|
24097
|
-
// only add min and max properties if they are defined:
|
|
24098
|
-
...min ? { min } : {},
|
|
24099
|
-
...max ? { max } : {}
|
|
24100
|
-
};
|
|
24101
|
-
});
|
|
24102
23940
|
const getControlsAxesLabels = useCallback(
|
|
24103
23941
|
(propsAxes) => {
|
|
24104
23942
|
var _a2;
|
|
@@ -24150,13 +23988,11 @@ const useChartFunctions = ({
|
|
|
24150
23988
|
dispatch({ type: UPDATE_AXES_RANGES, payload: { axes: axes2 } });
|
|
24151
23989
|
}, []);
|
|
24152
23990
|
return {
|
|
24153
|
-
legendClick,
|
|
24154
23991
|
resetZoom: resetZoom2,
|
|
24155
23992
|
onHover,
|
|
24156
23993
|
handleDownload,
|
|
24157
23994
|
handleKeyDown,
|
|
24158
23995
|
handleKeyUp,
|
|
24159
|
-
controlsAxes,
|
|
24160
23996
|
controlsAxesLabels: getControlsAxesLabels(axes),
|
|
24161
23997
|
updateAxesRangesFromChart,
|
|
24162
23998
|
onResetAxes,
|
|
@@ -24230,10 +24066,11 @@ const reducer = (state, action) => {
|
|
|
24230
24066
|
});
|
|
24231
24067
|
case actionTypes.UnitUpdated:
|
|
24232
24068
|
return produce(state, (draft) => {
|
|
24069
|
+
var _a2;
|
|
24233
24070
|
const { name, value, id } = action.payload;
|
|
24234
|
-
const
|
|
24235
|
-
if (
|
|
24236
|
-
|
|
24071
|
+
const unit = (_a2 = draft.find((a2) => a2.id === id)) == null ? void 0 : _a2.unit;
|
|
24072
|
+
if (unit && name) {
|
|
24073
|
+
unit[name] = value;
|
|
24237
24074
|
}
|
|
24238
24075
|
});
|
|
24239
24076
|
default:
|
|
@@ -24248,9 +24085,9 @@ const AxesOptionsPopover = (optionsPopover) => {
|
|
|
24248
24085
|
controlsAxesLabels,
|
|
24249
24086
|
onUpdateAxes,
|
|
24250
24087
|
onResetAxes,
|
|
24251
|
-
close,
|
|
24252
24088
|
depthType,
|
|
24253
|
-
translations
|
|
24089
|
+
translations,
|
|
24090
|
+
close
|
|
24254
24091
|
} = optionsPopover;
|
|
24255
24092
|
const [depthTypeState, setDepthTypeState] = useState(
|
|
24256
24093
|
depthType == null ? void 0 : depthType.selectedDepthType
|
|
@@ -24281,8 +24118,8 @@ const AxesOptionsPopover = (optionsPopover) => {
|
|
|
24281
24118
|
if (valid) {
|
|
24282
24119
|
const sanitizedFormState = formState.map((axis) => ({
|
|
24283
24120
|
...axis,
|
|
24284
|
-
min:
|
|
24285
|
-
max:
|
|
24121
|
+
min: typeof axis.min === "string" ? Number(axis.min) : axis.min,
|
|
24122
|
+
max: typeof axis.max === "string" ? Number(axis.max) : axis.max
|
|
24286
24123
|
}));
|
|
24287
24124
|
onUpdateAxes({
|
|
24288
24125
|
axes: sanitizedFormState
|
|
@@ -24324,7 +24161,9 @@ const AxesOptionsPopover = (optionsPopover) => {
|
|
|
24324
24161
|
(el) => el.id === axis.id
|
|
24325
24162
|
);
|
|
24326
24163
|
const axisLabel = axisControl == null ? void 0 : axisControl.label;
|
|
24327
|
-
const axisState = formState.find(
|
|
24164
|
+
const axisState = formState.find(
|
|
24165
|
+
(a2) => a2.id === axis.id
|
|
24166
|
+
);
|
|
24328
24167
|
const axisErrors = errors == null ? void 0 : errors.find((a2) => a2.id === axis.id);
|
|
24329
24168
|
const { min, max, unit } = axisState || {};
|
|
24330
24169
|
const minErrorMsg = ((_a3 = axisErrors == null ? void 0 : axisErrors.min) == null ? void 0 : _a3[0]) ? translations[axisErrors.min[0]] : null;
|
|
@@ -24368,7 +24207,7 @@ const AxesOptionsPopover = (optionsPopover) => {
|
|
|
24368
24207
|
{
|
|
24369
24208
|
name: "selectedUnit",
|
|
24370
24209
|
options: (_c2 = axis == null ? void 0 : axis.unit) == null ? void 0 : _c2.options,
|
|
24371
|
-
value: unit == null ? void 0 : unit.selectedUnit,
|
|
24210
|
+
value: typeof unit !== "string" ? unit == null ? void 0 : unit.selectedUnit : void 0,
|
|
24372
24211
|
onChange: (e2) => {
|
|
24373
24212
|
onEditUnit({
|
|
24374
24213
|
name: e2.target.name,
|
|
@@ -24472,6 +24311,27 @@ const ControlsPortal = ({
|
|
|
24472
24311
|
}
|
|
24473
24312
|
return children;
|
|
24474
24313
|
};
|
|
24314
|
+
const checkCustomOption = (data, customOptions) => {
|
|
24315
|
+
if (isEmpty(data) || isEmpty(customOptions))
|
|
24316
|
+
return false;
|
|
24317
|
+
const checkOption = (dataset) => {
|
|
24318
|
+
if (typeof customOptions === "string") {
|
|
24319
|
+
return has(dataset, customOptions);
|
|
24320
|
+
} else if (isArray$2(customOptions)) {
|
|
24321
|
+
return some(customOptions, (option) => has(dataset, option));
|
|
24322
|
+
} else {
|
|
24323
|
+
return some(
|
|
24324
|
+
Object.values(customOptions),
|
|
24325
|
+
(option) => has(dataset, option)
|
|
24326
|
+
);
|
|
24327
|
+
}
|
|
24328
|
+
};
|
|
24329
|
+
if (isArray$2(data)) {
|
|
24330
|
+
return some(data, (dataset) => checkOption(dataset));
|
|
24331
|
+
} else {
|
|
24332
|
+
return checkOption(data);
|
|
24333
|
+
}
|
|
24334
|
+
};
|
|
24475
24335
|
const Controls = ({
|
|
24476
24336
|
headerComponent,
|
|
24477
24337
|
subheaderComponent,
|
|
@@ -24503,19 +24363,14 @@ const Controls = ({
|
|
|
24503
24363
|
onToggleDragPoints,
|
|
24504
24364
|
onDisableDragOptions
|
|
24505
24365
|
} = useToggleHandlers(dispatch);
|
|
24506
|
-
const {
|
|
24507
|
-
handleDownload,
|
|
24508
|
-
controlsAxes,
|
|
24509
|
-
controlsAxesLabels,
|
|
24510
|
-
onResetAxes,
|
|
24511
|
-
onUpdateAxes
|
|
24512
|
-
} = useChartFunctions({
|
|
24366
|
+
const { handleDownload, controlsAxesLabels, onResetAxes, onUpdateAxes } = useChartFunctions({
|
|
24513
24367
|
chartRef,
|
|
24514
24368
|
state,
|
|
24515
24369
|
options,
|
|
24516
24370
|
dispatch,
|
|
24517
24371
|
generatedDatasets
|
|
24518
24372
|
});
|
|
24373
|
+
const hasCustomOpt = checkCustomOption(generatedDatasets, "hasCustomOpt");
|
|
24519
24374
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
24520
24375
|
/* @__PURE__ */ jsxs("div", { className: styles$3.controls, children: [
|
|
24521
24376
|
!!options.title && /* @__PURE__ */ jsx(Text, { bold: true, children: options.title }),
|
|
@@ -24526,7 +24381,7 @@ const Controls = ({
|
|
|
24526
24381
|
AxesOptions,
|
|
24527
24382
|
{
|
|
24528
24383
|
initialAxesRanges,
|
|
24529
|
-
axes:
|
|
24384
|
+
axes: state.axes,
|
|
24530
24385
|
controlsAxesLabels,
|
|
24531
24386
|
onUpdateAxes,
|
|
24532
24387
|
onResetAxes,
|
|
@@ -24541,7 +24396,8 @@ const Controls = ({
|
|
|
24541
24396
|
pointsEnabled,
|
|
24542
24397
|
onToggleLine,
|
|
24543
24398
|
onTogglePoints,
|
|
24544
|
-
translations
|
|
24399
|
+
translations,
|
|
24400
|
+
hasCustomOpt
|
|
24545
24401
|
}
|
|
24546
24402
|
),
|
|
24547
24403
|
/* @__PURE__ */ jsx(
|
|
@@ -24570,7 +24426,7 @@ const Controls = ({
|
|
|
24570
24426
|
onTogglePan,
|
|
24571
24427
|
onToggleZoom,
|
|
24572
24428
|
enableDragPoints,
|
|
24573
|
-
isDragDataAllowed: dragData.enableDragData,
|
|
24429
|
+
isDragDataAllowed: dragData == null ? void 0 : dragData.enableDragData,
|
|
24574
24430
|
onToggleDragPoints,
|
|
24575
24431
|
onDisableDragOptions,
|
|
24576
24432
|
translations
|
|
@@ -24772,9 +24628,143 @@ const LegendItem = ({ hidden, dataset, handleClick }) => {
|
|
|
24772
24628
|
}
|
|
24773
24629
|
);
|
|
24774
24630
|
};
|
|
24631
|
+
const useLegendState = ({
|
|
24632
|
+
chartRef,
|
|
24633
|
+
options,
|
|
24634
|
+
state,
|
|
24635
|
+
dispatch
|
|
24636
|
+
}) => {
|
|
24637
|
+
const {
|
|
24638
|
+
annotations,
|
|
24639
|
+
interactions: { onLegendClick },
|
|
24640
|
+
legend: { customLegend }
|
|
24641
|
+
} = options;
|
|
24642
|
+
const { legendEnabled } = state;
|
|
24643
|
+
const [hiddenStates, setHiddenStates] = useState([]);
|
|
24644
|
+
const upsertHiddenState = ({ label, datasetIndex, hidden }) => {
|
|
24645
|
+
setHiddenStates((prevStates) => {
|
|
24646
|
+
const existingIndex = prevStates.findIndex(
|
|
24647
|
+
(state2) => state2.label === label
|
|
24648
|
+
);
|
|
24649
|
+
const newStates = [...prevStates];
|
|
24650
|
+
const newState = { label, datasetIndex, hidden };
|
|
24651
|
+
if (existingIndex !== -1) {
|
|
24652
|
+
newStates[existingIndex] = newState;
|
|
24653
|
+
} else {
|
|
24654
|
+
newStates.push(newState);
|
|
24655
|
+
}
|
|
24656
|
+
return newStates;
|
|
24657
|
+
});
|
|
24658
|
+
};
|
|
24659
|
+
const clearNonExistentDatasets = (datasets) => {
|
|
24660
|
+
const existingLabels = datasets.map((ds) => ds.label);
|
|
24661
|
+
setHiddenStates(
|
|
24662
|
+
(prevStates) => prevStates.filter((state2) => existingLabels.includes(state2.label))
|
|
24663
|
+
);
|
|
24664
|
+
};
|
|
24665
|
+
const legendClick = useCallback(
|
|
24666
|
+
(_e2, legendItem2) => {
|
|
24667
|
+
const { datasetIndex } = legendItem2;
|
|
24668
|
+
const chartInstance = chartRef == null ? void 0 : chartRef.current;
|
|
24669
|
+
const { datasets } = (chartInstance == null ? void 0 : chartInstance.data) || {};
|
|
24670
|
+
const dataset = datasets == null ? void 0 : datasets[datasetIndex];
|
|
24671
|
+
const meta = chartInstance == null ? void 0 : chartInstance.getDatasetMeta(datasetIndex);
|
|
24672
|
+
const isDatasetVisible = (chartInstance == null ? void 0 : chartInstance.isDatasetVisible(datasetIndex)) ?? true;
|
|
24673
|
+
upsertHiddenState({
|
|
24674
|
+
label: dataset.label,
|
|
24675
|
+
datasetIndex,
|
|
24676
|
+
hidden: isDatasetVisible
|
|
24677
|
+
});
|
|
24678
|
+
chartInstance == null ? void 0 : chartInstance.setDatasetVisibility(datasetIndex, !isDatasetVisible);
|
|
24679
|
+
if (annotations.controlAnnotation && (dataset == null ? void 0 : dataset.isAnnotation)) {
|
|
24680
|
+
const { annotationIndex } = dataset;
|
|
24681
|
+
dispatch({ type: TOGGLE_ANNOTATION, payload: { annotationIndex } });
|
|
24682
|
+
}
|
|
24683
|
+
if (dataset.displayGroup) {
|
|
24684
|
+
datasets == null ? void 0 : datasets.forEach((ds, ix) => {
|
|
24685
|
+
if (ds.displayGroup !== dataset.displayGroup)
|
|
24686
|
+
return;
|
|
24687
|
+
if (chartInstance && meta) {
|
|
24688
|
+
chartInstance.getDatasetMeta(ix).hidden = meta.hidden;
|
|
24689
|
+
}
|
|
24690
|
+
});
|
|
24691
|
+
}
|
|
24692
|
+
if (onLegendClick) {
|
|
24693
|
+
onLegendClick(legendItem2 == null ? void 0 : legendItem2.text, legendItem2.hidden);
|
|
24694
|
+
}
|
|
24695
|
+
chartInstance == null ? void 0 : chartInstance.update();
|
|
24696
|
+
},
|
|
24697
|
+
[chartRef, annotations, onLegendClick, hiddenStates]
|
|
24698
|
+
);
|
|
24699
|
+
const legend2 = useMemo(
|
|
24700
|
+
() => getLegend(options, legendClick),
|
|
24701
|
+
[legendEnabled]
|
|
24702
|
+
);
|
|
24703
|
+
const customLegendPlugin = useMemo(
|
|
24704
|
+
() => ({
|
|
24705
|
+
[CUSTOM_LEGEND_PLUGIN_NAME]: (customLegend == null ? void 0 : customLegend.customLegendPlugin) && {
|
|
24706
|
+
containerID: customLegend == null ? void 0 : customLegend.customLegendContainerID
|
|
24707
|
+
}
|
|
24708
|
+
}),
|
|
24709
|
+
[customLegend]
|
|
24710
|
+
);
|
|
24711
|
+
return {
|
|
24712
|
+
legendClick,
|
|
24713
|
+
hiddenStates,
|
|
24714
|
+
legend: legend2,
|
|
24715
|
+
customLegendPlugin,
|
|
24716
|
+
upsertHiddenState,
|
|
24717
|
+
clearNonExistentDatasets
|
|
24718
|
+
};
|
|
24719
|
+
};
|
|
24775
24720
|
const LEGEND_MARGIN = 4;
|
|
24721
|
+
const createLegendStyle = (legendPosition, chart2) => {
|
|
24722
|
+
const { height = 0, width = 0, chartArea } = chart2;
|
|
24723
|
+
const { top: top2, left: left2, bottom: bottom2, right: right2 } = chartArea;
|
|
24724
|
+
return {
|
|
24725
|
+
left: legendPosition.includes("left") ? left2 : void 0,
|
|
24726
|
+
right: legendPosition.includes("right") ? width - right2 : void 0,
|
|
24727
|
+
top: legendPosition.includes("top") ? top2 : void 0,
|
|
24728
|
+
bottom: legendPosition.includes("bottom") ? height - bottom2 : void 0,
|
|
24729
|
+
maxHeight: 0.5 * (bottom2 - top2 - LEGEND_MARGIN * 2),
|
|
24730
|
+
maxWidth: 0.5 * (right2 - left2 - LEGEND_MARGIN * 2),
|
|
24731
|
+
margin: LEGEND_MARGIN
|
|
24732
|
+
};
|
|
24733
|
+
};
|
|
24734
|
+
const getGeneratedLabels = (chart2) => {
|
|
24735
|
+
var _a2, _b2, _c2, _d2, _e2;
|
|
24736
|
+
return ((_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)) ?? [];
|
|
24737
|
+
};
|
|
24738
|
+
const useGeneratedLabels = (chartRef, generatedDatasets) => {
|
|
24739
|
+
const [items, setItems] = useState([]);
|
|
24740
|
+
useEffect(() => {
|
|
24741
|
+
const chart2 = chartRef.current;
|
|
24742
|
+
if (!chart2)
|
|
24743
|
+
return;
|
|
24744
|
+
const newItems = getGeneratedLabels(chart2);
|
|
24745
|
+
setItems(newItems);
|
|
24746
|
+
}, [generatedDatasets, chartRef]);
|
|
24747
|
+
return items;
|
|
24748
|
+
};
|
|
24749
|
+
const LegendItems = ({
|
|
24750
|
+
items,
|
|
24751
|
+
hiddenStates,
|
|
24752
|
+
datasets,
|
|
24753
|
+
legendClick
|
|
24754
|
+
}) => /* @__PURE__ */ jsx("div", { className: styles$2.legendItems, children: items.map((item) => {
|
|
24755
|
+
var _a2;
|
|
24756
|
+
const hiddenState = ((_a2 = hiddenStates.find((state) => state.label === item.text)) == null ? void 0 : _a2.hidden) ?? false;
|
|
24757
|
+
return /* @__PURE__ */ jsx(
|
|
24758
|
+
LegendItem,
|
|
24759
|
+
{
|
|
24760
|
+
hidden: hiddenState,
|
|
24761
|
+
dataset: datasets[item.datasetIndex],
|
|
24762
|
+
handleClick: (event) => legendClick(event, item)
|
|
24763
|
+
},
|
|
24764
|
+
`${item.datasetIndex}-hidden-${item.hidden}`
|
|
24765
|
+
);
|
|
24766
|
+
}) });
|
|
24776
24767
|
const LegendPanel = forwardRef((props, ref) => {
|
|
24777
|
-
var _a2, _b2, _c2, _d2;
|
|
24778
24768
|
const {
|
|
24779
24769
|
legendPosition,
|
|
24780
24770
|
chartRef,
|
|
@@ -24784,32 +24774,25 @@ const LegendPanel = forwardRef((props, ref) => {
|
|
|
24784
24774
|
generatedDatasets,
|
|
24785
24775
|
isDragging: isDragging2
|
|
24786
24776
|
} = props;
|
|
24787
|
-
const [refresh, setRefresh] = useState(false);
|
|
24788
24777
|
const { legendEnabled } = state;
|
|
24789
|
-
const
|
|
24778
|
+
const chart2 = chartRef == null ? void 0 : chartRef.current;
|
|
24779
|
+
if (!chart2)
|
|
24780
|
+
return null;
|
|
24781
|
+
const {
|
|
24782
|
+
data: { datasets }
|
|
24783
|
+
} = chart2;
|
|
24784
|
+
const { legendClick, hiddenStates, clearNonExistentDatasets } = useLegendState({
|
|
24790
24785
|
chartRef,
|
|
24791
|
-
state,
|
|
24792
24786
|
options,
|
|
24793
|
-
|
|
24794
|
-
|
|
24787
|
+
state,
|
|
24788
|
+
dispatch
|
|
24795
24789
|
});
|
|
24796
24790
|
const { onToggleLegend } = useToggleHandlers(dispatch);
|
|
24797
|
-
const
|
|
24798
|
-
|
|
24799
|
-
|
|
24800
|
-
|
|
24801
|
-
|
|
24802
|
-
const { top: top2, left: left2, bottom: bottom2, right: right2 } = chartArea;
|
|
24803
|
-
const items = ((_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(chart2)) ?? [];
|
|
24804
|
-
const style = {
|
|
24805
|
-
left: legendPosition.includes("left") ? left2 : void 0,
|
|
24806
|
-
right: legendPosition.includes("right") ? width - right2 : void 0,
|
|
24807
|
-
top: legendPosition.includes("top") ? top2 : void 0,
|
|
24808
|
-
bottom: legendPosition.includes("bottom") ? height - bottom2 : void 0,
|
|
24809
|
-
maxHeight: 0.5 * (bottom2 - top2 - LEGEND_MARGIN * 2),
|
|
24810
|
-
maxWidth: 0.5 * (right2 - left2 - LEGEND_MARGIN * 2),
|
|
24811
|
-
margin: LEGEND_MARGIN
|
|
24812
|
-
};
|
|
24791
|
+
const items = useGeneratedLabels(chartRef, generatedDatasets);
|
|
24792
|
+
const style = createLegendStyle(legendPosition, chart2);
|
|
24793
|
+
useEffect(() => {
|
|
24794
|
+
clearNonExistentDatasets(generatedDatasets);
|
|
24795
|
+
}, [generatedDatasets]);
|
|
24813
24796
|
return /* @__PURE__ */ jsxs(
|
|
24814
24797
|
"div",
|
|
24815
24798
|
{
|
|
@@ -24830,18 +24813,15 @@ const LegendPanel = forwardRef((props, ref) => {
|
|
|
24830
24813
|
icon: legendEnabled ? /* @__PURE__ */ jsx(TbX, {}) : /* @__PURE__ */ jsx(TbList, {})
|
|
24831
24814
|
}
|
|
24832
24815
|
) }),
|
|
24833
|
-
/* @__PURE__ */ jsx(
|
|
24834
|
-
|
|
24816
|
+
/* @__PURE__ */ jsx(
|
|
24817
|
+
LegendItems,
|
|
24835
24818
|
{
|
|
24836
|
-
|
|
24837
|
-
|
|
24838
|
-
|
|
24839
|
-
|
|
24840
|
-
|
|
24841
|
-
|
|
24842
|
-
},
|
|
24843
|
-
`${item.datasetIndex}-hidden-${item.hidden}`
|
|
24844
|
-
)) })
|
|
24819
|
+
items,
|
|
24820
|
+
hiddenStates,
|
|
24821
|
+
datasets,
|
|
24822
|
+
legendClick
|
|
24823
|
+
}
|
|
24824
|
+
)
|
|
24845
24825
|
]
|
|
24846
24826
|
}
|
|
24847
24827
|
);
|
|
@@ -24974,9 +24954,20 @@ const TextLabelPosition = {
|
|
|
24974
24954
|
BOTTOM_CENTER: "bottom-center",
|
|
24975
24955
|
BOTTOM_RIGHT: "bottom-right"
|
|
24976
24956
|
};
|
|
24957
|
+
const defaultAxis = (position) => ({
|
|
24958
|
+
label: "",
|
|
24959
|
+
position,
|
|
24960
|
+
color: "",
|
|
24961
|
+
unit: {
|
|
24962
|
+
options: [],
|
|
24963
|
+
selectedUnit: "",
|
|
24964
|
+
setSelectedUnit: () => {
|
|
24965
|
+
}
|
|
24966
|
+
}
|
|
24967
|
+
});
|
|
24977
24968
|
const defaultAxes$1 = (axes) => ({
|
|
24978
|
-
x: (axes == null ? void 0 : axes.x) || [
|
|
24979
|
-
y: (axes == null ? void 0 : axes.y) || [
|
|
24969
|
+
x: (axes == null ? void 0 : axes.x) || [defaultAxis("bottom")],
|
|
24970
|
+
y: (axes == null ? void 0 : axes.y) || [defaultAxis("left")]
|
|
24980
24971
|
});
|
|
24981
24972
|
const defaultAdditionalAxesOptions$1 = (options) => ({
|
|
24982
24973
|
chartScaleType: (options == null ? void 0 : options.chartScaleType) || "linear",
|
|
@@ -25070,7 +25061,7 @@ const getDefaultProps$2 = (props) => {
|
|
|
25070
25061
|
return {
|
|
25071
25062
|
persistenceId: (chart2 == null ? void 0 : chart2.persistenceId) ?? "",
|
|
25072
25063
|
controlsPortalId: (chart2 == null ? void 0 : chart2.controlsPortalId) ?? "",
|
|
25073
|
-
testId: (chart2 == null ? void 0 : chart2.testId) ??
|
|
25064
|
+
testId: (chart2 == null ? void 0 : chart2.testId) ?? void 0,
|
|
25074
25065
|
data: chart2 == null ? void 0 : chart2.data,
|
|
25075
25066
|
options: {
|
|
25076
25067
|
title: (options == null ? void 0 : options.title) ?? "",
|
|
@@ -25104,6 +25095,11 @@ const INIT_KEYS = {
|
|
|
25104
25095
|
};
|
|
25105
25096
|
const LOWER_BOUND = 1e-4;
|
|
25106
25097
|
const UPPER_BOUND = 1e7;
|
|
25098
|
+
var CUSTOM_OPTION = /* @__PURE__ */ ((CUSTOM_OPTION2) => {
|
|
25099
|
+
CUSTOM_OPTION2["showLine"] = "showLine";
|
|
25100
|
+
CUSTOM_OPTION2["showPoints"] = "showPoints";
|
|
25101
|
+
return CUSTOM_OPTION2;
|
|
25102
|
+
})(CUSTOM_OPTION || {});
|
|
25107
25103
|
const generateLineChartDatasets = (datasets, state, options, { label }) => {
|
|
25108
25104
|
const copyDataset = [...datasets];
|
|
25109
25105
|
const { annotations, graph } = options;
|
|
@@ -25145,7 +25141,9 @@ const generateLineChartDatasets = (datasets, state, options, { label }) => {
|
|
|
25145
25141
|
borderColor,
|
|
25146
25142
|
backgroundColor,
|
|
25147
25143
|
pointBackgroundColor,
|
|
25148
|
-
borderDash
|
|
25144
|
+
borderDash,
|
|
25145
|
+
showPoints = true,
|
|
25146
|
+
showLine
|
|
25149
25147
|
} = line ?? {};
|
|
25150
25148
|
const { lineEnabled, pointsEnabled, axes = [] } = state ?? {};
|
|
25151
25149
|
const { lineTension, spanGaps } = graph ?? {};
|
|
@@ -25163,14 +25161,15 @@ const generateLineChartDatasets = (datasets, state, options, { label }) => {
|
|
|
25163
25161
|
const filteredData = data.filter(Boolean) || [];
|
|
25164
25162
|
const isSinglePoint = (filteredData == null ? void 0 : filteredData.length) === 1;
|
|
25165
25163
|
const linePointRadius = parseFloat(pointRadiusProp) || DEFAULT_POINT_RADIUS;
|
|
25166
|
-
const pointRadius = pointsEnabled || isSinglePoint ? linePointRadius : 0;
|
|
25164
|
+
const pointRadius = (pointsEnabled || isSinglePoint) && showPoints ? linePointRadius : 0;
|
|
25167
25165
|
const hoverRadius = parseFloat(pointHoverRadius) || DEFAULT_HOVER_RADIUS;
|
|
25168
25166
|
const indexedColor = COLORS[i2];
|
|
25167
|
+
const hasCustomOpt = checkCustomOption(line, CUSTOM_OPTION);
|
|
25169
25168
|
return {
|
|
25170
25169
|
...line,
|
|
25171
25170
|
label: line.label || `${label} ${i2 + 1}`,
|
|
25172
25171
|
data: filteredData,
|
|
25173
|
-
showLine: lineEnabled,
|
|
25172
|
+
showLine: showLine ?? lineEnabled,
|
|
25174
25173
|
lineTension,
|
|
25175
25174
|
spanGaps,
|
|
25176
25175
|
borderWidth: parseFloat(borderWidth) || DEFAULT_BORDER_WIDTH,
|
|
@@ -25181,7 +25180,8 @@ const generateLineChartDatasets = (datasets, state, options, { label }) => {
|
|
|
25181
25180
|
pointBackgroundColor: pointBackgroundColor ?? indexedColor ?? generateRandomColor(COLORS),
|
|
25182
25181
|
pointRadius,
|
|
25183
25182
|
pointHoverRadius: hoverRadius,
|
|
25184
|
-
pointHitRadius: line.pointHitRadius ?? hoverRadius
|
|
25183
|
+
pointHitRadius: line.pointHitRadius ?? hoverRadius,
|
|
25184
|
+
...hasCustomOpt ? { hasCustomOpt } : {}
|
|
25185
25185
|
};
|
|
25186
25186
|
});
|
|
25187
25187
|
};
|
|
@@ -25192,7 +25192,7 @@ const calculateDelta$1 = (tickValue, ticks) => {
|
|
|
25192
25192
|
}
|
|
25193
25193
|
return delta;
|
|
25194
25194
|
};
|
|
25195
|
-
const formatAxisLabelNumbers = (tickValue, ticks
|
|
25195
|
+
const formatAxisLabelNumbers = (tickValue, ticks) => {
|
|
25196
25196
|
if (tickValue === 0 || tickValue === null) {
|
|
25197
25197
|
return "0";
|
|
25198
25198
|
}
|
|
@@ -25239,7 +25239,7 @@ const getLineChartAxis = (options, axisType, state, currentScales, i2 = 0) => {
|
|
|
25239
25239
|
//OW-10088 disable irregular axis ticks
|
|
25240
25240
|
...ticksConfigFromProps,
|
|
25241
25241
|
font: {
|
|
25242
|
-
size:
|
|
25242
|
+
size: 14
|
|
25243
25243
|
}
|
|
25244
25244
|
};
|
|
25245
25245
|
return ticks;
|
|
@@ -25471,23 +25471,29 @@ const getLineChartDataLabels = (options) => {
|
|
|
25471
25471
|
formatter: (_value, context) => context.dataset.data[context.dataIndex].label || ""
|
|
25472
25472
|
} : { display: false };
|
|
25473
25473
|
};
|
|
25474
|
-
const annotationEnter = (
|
|
25474
|
+
const annotationEnter = (element, chart2) => {
|
|
25475
25475
|
var _a2;
|
|
25476
25476
|
if ((_a2 = element.options.scaleID) == null ? void 0 : _a2.includes(AxisType.X)) {
|
|
25477
25477
|
element.options.label.xAdjust = chart2.chartArea.left;
|
|
25478
25478
|
}
|
|
25479
25479
|
element.options.borderWidth = BORDER_WIDTH.HOVERED;
|
|
25480
|
-
if (element.options.label)
|
|
25480
|
+
if (element.options.label) {
|
|
25481
|
+
element.label.options.display = true;
|
|
25481
25482
|
element.options.label.enabled = true;
|
|
25483
|
+
}
|
|
25482
25484
|
chart2.draw();
|
|
25483
25485
|
chart2.canvas.style.cursor = CursorStyle.Pointer;
|
|
25486
|
+
return true;
|
|
25484
25487
|
};
|
|
25485
|
-
const annotationLeave = (
|
|
25488
|
+
const annotationLeave = (element, chart2) => {
|
|
25486
25489
|
element.options.borderWidth = BORDER_WIDTH.INITIAL;
|
|
25487
|
-
if (element.options.label)
|
|
25490
|
+
if (element.options.label) {
|
|
25491
|
+
element.label.options.display = false;
|
|
25488
25492
|
element.options.label.enabled = false;
|
|
25493
|
+
}
|
|
25489
25494
|
chart2.draw();
|
|
25490
25495
|
chart2.canvas.style.cursor = CursorStyle.Initial;
|
|
25496
|
+
return true;
|
|
25491
25497
|
};
|
|
25492
25498
|
const generateAnnotations = (options, state) => {
|
|
25493
25499
|
const { annotationsData } = (options == null ? void 0 : options.annotations) || {};
|
|
@@ -25506,22 +25512,22 @@ const generateAnnotations = (options, state) => {
|
|
|
25506
25512
|
const label = type === "line" ? {
|
|
25507
25513
|
backgroundColor: color2,
|
|
25508
25514
|
content: curr == null ? void 0 : curr.label,
|
|
25509
|
-
|
|
25515
|
+
display: false,
|
|
25510
25516
|
position: Position.Top
|
|
25511
25517
|
} : {
|
|
25512
25518
|
content: curr == null ? void 0 : curr.label,
|
|
25513
|
-
|
|
25519
|
+
display: true,
|
|
25514
25520
|
font: { weight: "normal" }
|
|
25515
25521
|
};
|
|
25516
|
-
const enter = (
|
|
25522
|
+
const enter = ({ element }, { chart: chart2 }) => {
|
|
25517
25523
|
if (type !== "line")
|
|
25518
25524
|
return;
|
|
25519
|
-
annotationEnter(
|
|
25525
|
+
annotationEnter(element, chart2);
|
|
25520
25526
|
};
|
|
25521
|
-
const leave = (
|
|
25527
|
+
const leave = ({ element }, { chart: chart2 }) => {
|
|
25522
25528
|
if (type !== "line")
|
|
25523
25529
|
return;
|
|
25524
|
-
annotationLeave(
|
|
25530
|
+
annotationLeave(element, chart2);
|
|
25525
25531
|
};
|
|
25526
25532
|
const annotation2 = {
|
|
25527
25533
|
...curr,
|
|
@@ -25653,7 +25659,6 @@ const useChartOptions = ({
|
|
|
25653
25659
|
dispatch,
|
|
25654
25660
|
generatedDatasets
|
|
25655
25661
|
}) => {
|
|
25656
|
-
var _a2, _b2;
|
|
25657
25662
|
const {
|
|
25658
25663
|
interactions: { onAnimationComplete },
|
|
25659
25664
|
annotations: {
|
|
@@ -25675,29 +25680,28 @@ const useChartOptions = ({
|
|
|
25675
25680
|
zoomEnabled,
|
|
25676
25681
|
panEnabled,
|
|
25677
25682
|
lineEnabled,
|
|
25678
|
-
showAnnotationLineIndex
|
|
25679
|
-
legendEnabled
|
|
25683
|
+
showAnnotationLineIndex
|
|
25680
25684
|
} = state;
|
|
25681
25685
|
const [hoveredPoint, setHoveredPoint] = useState(null);
|
|
25682
|
-
const {
|
|
25683
|
-
|
|
25684
|
-
|
|
25685
|
-
|
|
25686
|
-
|
|
25687
|
-
|
|
25688
|
-
|
|
25689
|
-
|
|
25690
|
-
|
|
25686
|
+
const { updateAxesRangesFromChart, onHover } = useChartFunctions({
|
|
25687
|
+
chartRef,
|
|
25688
|
+
state,
|
|
25689
|
+
options,
|
|
25690
|
+
dispatch,
|
|
25691
|
+
generatedDatasets
|
|
25692
|
+
});
|
|
25693
|
+
const { legendClick, legend: legend2, customLegendPlugin } = useLegendState({
|
|
25694
|
+
chartRef,
|
|
25695
|
+
options,
|
|
25696
|
+
state,
|
|
25697
|
+
dispatch
|
|
25698
|
+
});
|
|
25691
25699
|
const datalabels = getLineChartDataLabels(options);
|
|
25692
25700
|
const tooltip = getLineChartToolTips(options);
|
|
25693
25701
|
const annotation2 = useMemo(
|
|
25694
25702
|
() => getAnnotation(options, state),
|
|
25695
25703
|
[showAnnotationLineIndex, legendClick]
|
|
25696
25704
|
);
|
|
25697
|
-
const legend2 = useMemo(
|
|
25698
|
-
() => getLegend(options, legendClick),
|
|
25699
|
-
[legendEnabled]
|
|
25700
|
-
);
|
|
25701
25705
|
const scales = useMemo(
|
|
25702
25706
|
() => autoScale(options, state, generatedDatasets, chartRef),
|
|
25703
25707
|
[options, state, generatedDatasets, chartRef]
|
|
@@ -25739,9 +25743,7 @@ const useChartOptions = ({
|
|
|
25739
25743
|
tooltip,
|
|
25740
25744
|
legend: { ...legend2, display: false },
|
|
25741
25745
|
// hide default legend for line chart only
|
|
25742
|
-
|
|
25743
|
-
containerID: (_b2 = options.legend.customLegend) == null ? void 0 : _b2.customLegendContainerID
|
|
25744
|
-
},
|
|
25746
|
+
customLegendPlugin,
|
|
25745
25747
|
chartAreaBorder: {
|
|
25746
25748
|
borderColor: BORDER_COLOR
|
|
25747
25749
|
},
|
|
@@ -25796,7 +25798,7 @@ const useChartPlugins = ({ options, resetZoom: resetZoom2 }) => {
|
|
|
25796
25798
|
[resetZoom2]
|
|
25797
25799
|
);
|
|
25798
25800
|
const handleDoubleClick = useCallback(
|
|
25799
|
-
(
|
|
25801
|
+
(_2, args) => {
|
|
25800
25802
|
const { event } = args;
|
|
25801
25803
|
if (event.type === DOUBLE_CLICK) {
|
|
25802
25804
|
debouncedResetZoom();
|
|
@@ -25828,6 +25830,23 @@ const getAxesRangesFromChart = (chartRef, axes) => {
|
|
|
25828
25830
|
};
|
|
25829
25831
|
});
|
|
25830
25832
|
};
|
|
25833
|
+
const getAxisRangeByType = (chartRef, axesType, annotationsData) => {
|
|
25834
|
+
if (!chartRef || !chartRef.current)
|
|
25835
|
+
return null;
|
|
25836
|
+
const metasets = chartRef.current.getSortedVisibleDatasetMetas();
|
|
25837
|
+
const annotDataByType = getAnnotationsData(annotationsData)[axesType] ?? [];
|
|
25838
|
+
let allData = [];
|
|
25839
|
+
metasets.forEach((metaset) => {
|
|
25840
|
+
const data = metaset._parsed.map((parsedData) => parsedData[axesType]).filter((value) => value != null && !isNaN(value));
|
|
25841
|
+
allData = allData.concat(data);
|
|
25842
|
+
});
|
|
25843
|
+
allData = allData.concat(annotDataByType);
|
|
25844
|
+
if (allData.length === 0)
|
|
25845
|
+
return null;
|
|
25846
|
+
const min = Math.min(...allData);
|
|
25847
|
+
const max = Math.max(...allData);
|
|
25848
|
+
return { min, max };
|
|
25849
|
+
};
|
|
25831
25850
|
const useToggleCustomLegendVisibility = (memoState, memoOptions) => {
|
|
25832
25851
|
var _a2, _b2;
|
|
25833
25852
|
useEffect(() => {
|
|
@@ -25858,18 +25877,23 @@ const useStoreChartStateInStorage = (memoState, persistenceId) => {
|
|
|
25858
25877
|
]);
|
|
25859
25878
|
};
|
|
25860
25879
|
const useUpdateAxesRanges = ({
|
|
25880
|
+
chartRef,
|
|
25861
25881
|
range,
|
|
25862
25882
|
state,
|
|
25863
|
-
dispatch
|
|
25883
|
+
dispatch,
|
|
25884
|
+
annotationsData
|
|
25864
25885
|
}) => {
|
|
25865
25886
|
const prevAxes = useRef(state.axes);
|
|
25866
25887
|
useEffect(() => {
|
|
25867
25888
|
if (range && isRangeValid(range)) {
|
|
25868
|
-
const newAxes = Object.entries(range).map(([key, { min, max }]) =>
|
|
25869
|
-
|
|
25870
|
-
|
|
25871
|
-
|
|
25872
|
-
|
|
25889
|
+
const newAxes = Object.entries(range).map(([key, { min, max }]) => {
|
|
25890
|
+
const { min: minFromData = 0, max: maxFromData = 0 } = getAxisRangeByType(chartRef, key, annotationsData) ?? {};
|
|
25891
|
+
return {
|
|
25892
|
+
id: key,
|
|
25893
|
+
min: min ?? minFromData,
|
|
25894
|
+
max: max ?? maxFromData
|
|
25895
|
+
};
|
|
25896
|
+
});
|
|
25873
25897
|
const mergedAxes = [...prevAxes.current ?? []].map((axis) => {
|
|
25874
25898
|
const newAxis = newAxes.find((a2) => a2.id === axis.id);
|
|
25875
25899
|
return newAxis ? { ...axis, ...newAxis } : axis;
|
|
@@ -25884,27 +25908,21 @@ const useUpdateAxesRanges = ({
|
|
|
25884
25908
|
}
|
|
25885
25909
|
}, [range]);
|
|
25886
25910
|
};
|
|
25887
|
-
const useSaveInitialAxesRanges = (chartRef, axes,
|
|
25888
|
-
|
|
25889
|
-
|
|
25890
|
-
if (chartRef && !isEqual(generatedDatasets, prevGeneratedDatasets.current)) {
|
|
25911
|
+
const useSaveInitialAxesRanges = (chartRef, axes, dispatch) => {
|
|
25912
|
+
useEffect(() => {
|
|
25913
|
+
if (chartRef.current) {
|
|
25891
25914
|
const initialAxesRanges = getAxesRangesFromChart(chartRef, axes);
|
|
25892
25915
|
dispatch({
|
|
25893
25916
|
type: SAVE_INITIAL_AXES_RANGES,
|
|
25894
25917
|
payload: { initialAxesRanges }
|
|
25895
25918
|
});
|
|
25896
|
-
prevGeneratedDatasets.current = generatedDatasets;
|
|
25897
25919
|
}
|
|
25898
|
-
}, [
|
|
25899
|
-
useEffect(() => {
|
|
25900
|
-
saveInitialAxesRanges();
|
|
25901
|
-
}, [saveInitialAxesRanges, generatedDatasets]);
|
|
25920
|
+
}, []);
|
|
25902
25921
|
};
|
|
25903
25922
|
const useChartState = ({
|
|
25904
25923
|
chartRef,
|
|
25905
25924
|
options,
|
|
25906
25925
|
state,
|
|
25907
|
-
generatedDatasets,
|
|
25908
25926
|
dispatch,
|
|
25909
25927
|
persistenceId
|
|
25910
25928
|
}) => {
|
|
@@ -25912,12 +25930,19 @@ const useChartState = ({
|
|
|
25912
25930
|
const memoOptions = useMemo(() => options, [options]);
|
|
25913
25931
|
const {
|
|
25914
25932
|
additionalAxesOptions: { range = void 0 },
|
|
25933
|
+
annotations: { annotationsData = [] } = {},
|
|
25915
25934
|
axes
|
|
25916
25935
|
} = memoOptions;
|
|
25917
25936
|
useStoreChartStateInStorage(memoState, persistenceId);
|
|
25918
25937
|
useToggleCustomLegendVisibility(memoState, memoOptions);
|
|
25919
|
-
useUpdateAxesRanges({
|
|
25920
|
-
|
|
25938
|
+
useUpdateAxesRanges({
|
|
25939
|
+
range,
|
|
25940
|
+
state: memoState,
|
|
25941
|
+
dispatch,
|
|
25942
|
+
chartRef,
|
|
25943
|
+
annotationsData
|
|
25944
|
+
});
|
|
25945
|
+
useSaveInitialAxesRanges(chartRef, axes, dispatch);
|
|
25921
25946
|
};
|
|
25922
25947
|
const WORD_SEPARATOR = " ";
|
|
25923
25948
|
const SEMI_TRANSPARENT = "rgba(0, 0, 0, 0.5)";
|
|
@@ -26123,6 +26148,7 @@ Chart$2.register(
|
|
|
26123
26148
|
chartAreaTextPlugin
|
|
26124
26149
|
);
|
|
26125
26150
|
const LineChart = (props) => {
|
|
26151
|
+
var _a2, _b2;
|
|
26126
26152
|
setDefaultTheme();
|
|
26127
26153
|
const chartRef = useRef(null);
|
|
26128
26154
|
const { table: table2 } = props;
|
|
@@ -26136,7 +26162,7 @@ const LineChart = (props) => {
|
|
|
26136
26162
|
controlsPortalId
|
|
26137
26163
|
} = chart2;
|
|
26138
26164
|
const { annotations, axes, chartStyling, graph } = options;
|
|
26139
|
-
const showCustomLegend = !options.legend.customLegend.customLegendContainerID;
|
|
26165
|
+
const showCustomLegend = !((_b2 = (_a2 = options == null ? void 0 : options.legend) == null ? void 0 : _a2.customLegend) == null ? void 0 : _b2.customLegendContainerID);
|
|
26140
26166
|
const [state, dispatch] = useReducer(
|
|
26141
26167
|
reducer$1,
|
|
26142
26168
|
{
|
|
@@ -26152,7 +26178,6 @@ const LineChart = (props) => {
|
|
|
26152
26178
|
chartRef,
|
|
26153
26179
|
options,
|
|
26154
26180
|
state,
|
|
26155
|
-
generatedDatasets,
|
|
26156
26181
|
dispatch,
|
|
26157
26182
|
persistenceId
|
|
26158
26183
|
});
|
|
@@ -39049,7 +39074,7 @@ const defaultInteractions = (interactions) => ({
|
|
|
39049
39074
|
onUnhover: interactions == null ? void 0 : interactions.onUnhover
|
|
39050
39075
|
});
|
|
39051
39076
|
const defaultDragData = (dragData) => ({
|
|
39052
|
-
enableDragData: (dragData == null ? void 0 : dragData.enableDragData)
|
|
39077
|
+
enableDragData: (dragData == null ? void 0 : dragData.enableDragData) ?? false,
|
|
39053
39078
|
showTooltip: (dragData == null ? void 0 : dragData.showTooltip) ?? true,
|
|
39054
39079
|
roundPoints: (dragData == null ? void 0 : dragData.roundPoints) ?? true,
|
|
39055
39080
|
dragX: (dragData == null ? void 0 : dragData.dragX) ?? true,
|
|
@@ -39115,14 +39140,16 @@ const getBarChartAxis = ({
|
|
|
39115
39140
|
} : {};
|
|
39116
39141
|
const ticks = {
|
|
39117
39142
|
...stepSize,
|
|
39118
|
-
callback: ticksFormattingCallback,
|
|
39119
39143
|
includeBounds: false,
|
|
39120
39144
|
//OW-10088 disable irregular axis ticks
|
|
39121
39145
|
...ticksConfigFromProps,
|
|
39122
39146
|
font: {
|
|
39123
|
-
size:
|
|
39147
|
+
size: 14
|
|
39124
39148
|
}
|
|
39125
39149
|
};
|
|
39150
|
+
if ((additionalAxesOptions == null ? void 0 : additionalAxesOptions.chartScaleType) === ScaleType.Logarithmic) {
|
|
39151
|
+
ticks.callback = ticksFormattingCallback;
|
|
39152
|
+
}
|
|
39126
39153
|
return ticks;
|
|
39127
39154
|
};
|
|
39128
39155
|
return {
|
|
@@ -39311,7 +39338,7 @@ const BarChart = (props) => {
|
|
|
39311
39338
|
const [pointHover, setPointHover] = useState(false);
|
|
39312
39339
|
const chart2 = getDefaultProps(props);
|
|
39313
39340
|
const { options, testId } = chart2;
|
|
39314
|
-
const { annotations, chartStyling, interactions, graph } = chart2.options;
|
|
39341
|
+
const { annotations, chartStyling, interactions, graph, dragData } = chart2.options;
|
|
39315
39342
|
const [visibleAnnotationsIndices, setVisibleAnnotationsIndices] = useState(
|
|
39316
39343
|
setAnnotations(annotations.annotationsData)
|
|
39317
39344
|
);
|
|
@@ -39436,9 +39463,6 @@ const BarChart = (props) => {
|
|
|
39436
39463
|
mode: ChartHoverMode.Nearest,
|
|
39437
39464
|
intersect: true
|
|
39438
39465
|
},
|
|
39439
|
-
// elements: {
|
|
39440
|
-
// bar: { pointStyle: PointStyle.Circle },
|
|
39441
|
-
// },
|
|
39442
39466
|
scales: getBarChartScales(chart2),
|
|
39443
39467
|
plugins: {
|
|
39444
39468
|
title: getTitle(options),
|
|
@@ -39454,7 +39478,7 @@ const BarChart = (props) => {
|
|
|
39454
39478
|
chartAreaBorder: {
|
|
39455
39479
|
borderColor: BORDER_COLOR
|
|
39456
39480
|
},
|
|
39457
|
-
dragData: getDraggableData(options)
|
|
39481
|
+
dragData: (dragData == null ? void 0 : dragData.enableDragData) && getDraggableData(options)
|
|
39458
39482
|
}
|
|
39459
39483
|
},
|
|
39460
39484
|
plugins: getPlugins(graph, options.legend)
|
|
@@ -39467,7 +39491,6 @@ export {
|
|
|
39467
39491
|
BarChart,
|
|
39468
39492
|
LineChart,
|
|
39469
39493
|
PieChart,
|
|
39470
|
-
ScatterChart,
|
|
39471
39494
|
initializeLineChart
|
|
39472
39495
|
};
|
|
39473
39496
|
//# sourceMappingURL=index.js.map
|
|
@@ -39476,7 +39499,7 @@ export {
|
|
|
39476
39499
|
try {
|
|
39477
39500
|
if (typeof document != "undefined") {
|
|
39478
39501
|
var elementStyle = document.createElement("style");
|
|
39479
|
-
elementStyle.appendChild(document.createTextNode("html[data-theme='dark'] .
|
|
39502
|
+
elementStyle.appendChild(document.createTextNode("html[data-theme='dark'] ._chart_e3qdd_1 canvas {\n filter: invert(1) hue-rotate(180deg);\n}\n._chart_e3qdd_1 {\n border: 1px solid rgba(255, 255, 255, 0);\n position: relative;\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n._chart_e3qdd_1 ._canvas_e3qdd_11 {\n flex-grow: 1;\n min-height: 0;\n position: relative;\n}\n._chart_e3qdd_1 ._canvas_e3qdd_11 canvas {\n width: 100% !important;\n height: 100% !important;\n}\n._chart_e3qdd_1._fixedHeight_e3qdd_20 {\n display: flex;\n align-items: flex-start;\n justify-content: flex-start;\n height: auto;\n}\n._chart_e3qdd_1._stretchHeight_e3qdd_26 {\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n height: 100%;\n}\n._chart_e3qdd_1._squareAspectRatio_e3qdd_32 {\n aspect-ratio: 1;\n min-height: 0;\n min-width: 0;\n}\n._chart_e3qdd_1:focus {\n outline: none;\n}\n._chart_e3qdd_1::-moz-focus-inner {\n border: 0;\n}\n._zoomForm_e3qdd_43 {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n top: 0;\n right: 0;\n}\n._zoomForm_e3qdd_43 ._zoomReset_e3qdd_51 {\n margin-left: 10px;\n}\n._zoomForm_e3qdd_43 ._help_e3qdd_54 {\n margin-left: 5px;\n line-height: 0;\n}\n._autoWeight_e3qdd_58 {\n width: auto;\n height: auto;\n}\n._table_e3qdd_62 {\n overflow: auto;\n}\n._controls_fa3yo_1 {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 8px;\n}\n._buttons_fa3yo_7 {\n display: flex;\n margin-left: auto;\n gap: 4px;\n}\n._legend_wpro0_1 {\n position: absolute;\n opacity: 0.9;\n display: flex;\n flex-direction: column;\n z-index: 1;\n}\n._legend_wpro0_1._isDragging_wpro0_8 {\n opacity: 0;\n}\n._legendItems_wpro0_11 {\n background-color: var(--color-background-raised);\n border: 1px solid var(--color-border);\n padding: 4px 8px;\n border-radius: 2px;\n overflow-y: auto;\n max-height: 100%;\n overflow: overlay;\n --scrollbar-color: #00000040;\n}\n._legendItems_wpro0_11::-webkit-scrollbar {\n display: block;\n width: 16px;\n z-index: 2;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-button {\n display: none;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-track {\n background-color: #00000000;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-track-piece {\n background-color: #00000000;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-thumb {\n background-color: #00000000;\n border: 5px solid transparent;\n border-radius: 24px;\n box-shadow: 4px 0px 0px 4px var(--scrollbar-color) inset;\n}\n._legendItems_wpro0_11::-webkit-scrollbar-corner {\n background: rgba(0, 0, 0, 0);\n}\n._legend_wpro0_1._isDragging_wpro0_8 ._legendItems_wpro0_11._legendItems_wpro0_11 {\n pointer-events: none;\n}\n._legend_wpro0_1._isHidden_wpro0_47 ._legendItems_wpro0_11._legendItems_wpro0_11 {\n display: none;\n}\n._legendToggle_wpro0_50 {\n position: absolute;\n top: 0;\n right: 0;\n transform: translate(50%, -50%);\n display: none;\n}\n._legend_wpro0_1._isHidden_wpro0_47 ._legendToggle_wpro0_50._legendToggle_wpro0_50,\n._legend_wpro0_1:hover ._legendToggle_wpro0_50._legendToggle_wpro0_50 {\n display: block;\n}\n._legend_wpro0_1:active ._legendToggle_wpro0_50._legendToggle_wpro0_50:not(:hover) {\n display: none;\n}\n._legend_wpro0_1._isHidden_wpro0_47 ._legendToggle_wpro0_50._legendToggle_wpro0_50 {\n position: static;\n transform: none;\n}\n._legend_wpro0_1._isDragging_wpro0_8 ._legendToggle_wpro0_50._legendToggle_wpro0_50 {\n display: none;\n}\n._legendItem_wpro0_11 {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n user-select: none;\n cursor: pointer;\n font-size: 12px;\n line-height: 16px;\n}\n._legendItemSymbol_wpro0_80 {\n display: flex;\n align-items: center;\n height: 16px;\n position: relative;\n flex-shrink: 0;\n}\nhtml[data-theme='dark'] ._legendItemSymbol_wpro0_80._legendItemSymbol_wpro0_80 {\n filter: invert(1) hue-rotate(180deg);\n}\n._legendItemBox_wpro0_90 {\n width: 100%;\n height: 12px;\n display: block;\n}\n._legendItemLine_wpro0_95 {\n position: absolute;\n display: flex;\n top: 50%;\n left: 0;\n width: 100%;\n transform: translateY(-50%);\n}\n._legendItemPoint_wpro0_103 {\n position: absolute;\n display: flex;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n}\n._isHidden_wpro0_47 ._legendItemText_wpro0_110._legendItemText_wpro0_110 {\n text-decoration: line-through;\n}\n._scrollbars_wpro0_113 {\n overflow: overlay;\n --scrollbar-color: #00000040;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar {\n display: block;\n width: 16px;\n z-index: 2;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-button {\n display: none;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-track {\n background-color: #00000000;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-track-piece {\n background-color: #00000000;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-thumb {\n background-color: #00000000;\n border: 5px solid transparent;\n border-radius: 24px;\n box-shadow: 4px 0px 0px 4px var(--scrollbar-color) inset;\n}\n._scrollbars_wpro0_113::-webkit-scrollbar-corner {\n background: rgba(0, 0, 0, 0);\n}\n._dropzoneContainer_wpro0_140 {\n position: absolute;\n}\n._dropzone_wpro0_140 {\n position: absolute;\n width: 50%;\n height: 50%;\n display: flex;\n}\n._dropzone_wpro0_140._left_wpro0_149 {\n left: 0;\n justify-content: flex-start;\n}\n._dropzone_wpro0_140._right_wpro0_153 {\n right: 0;\n justify-content: flex-end;\n}\n._dropzone_wpro0_140._top_wpro0_157 {\n top: 0;\n align-items: flex-start;\n}\n._dropzone_wpro0_140._bottom_wpro0_161 {\n bottom: 0;\n align-items: flex-end;\n}\n._dropzonePlaceholder_wpro0_165 {\n position: absolute;\n background-color: rgba(0, 0, 0, 0.05);\n display: none;\n}\n[data-theme='dark'] ._dropzonePlaceholder_wpro0_165 {\n background-color: rgba(255, 255, 255, 0.05);\n}\n._isActive_wpro0_173 ._dropzonePlaceholder_wpro0_165._dropzonePlaceholder_wpro0_165 {\n display: block;\n}\n._resizeContainer_wpro0_176 {\n position: absolute;\n inset: 0;\n z-index: -1;\n}\nhtml[data-theme='dark'] ._chart_1jdnu_1 canvas {\n filter: invert(1) hue-rotate(180deg);\n}\n._chart_1jdnu_1 {\n border: 1px solid rgba(255, 255, 255, 0);\n padding-top: 10px;\n position: relative;\n}\n._chart_1jdnu_1 canvas {\n width: 100% !important;\n height: 100% !important;\n}\n._chart_1jdnu_1._fixedHeight_1jdnu_13 {\n display: flex;\n align-items: flex-start;\n justify-content: flex-start;\n height: auto;\n}\n._chart_1jdnu_1._stretchHeight_1jdnu_19 {\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n height: 100%;\n}\n._chart_1jdnu_1:focus {\n border: 1px solid #85b7d9;\n outline: none;\n}\n._chart_1jdnu_1::-moz-focus-inner {\n border: 0;\n}\n._zoomForm_1jdnu_32 {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n top: 0;\n right: 0;\n}\n._zoomForm_1jdnu_32 ._zoomReset_1jdnu_40 {\n margin-left: 10px;\n}\n._zoomForm_1jdnu_32 ._help_1jdnu_43 {\n margin-left: 5px;\n line-height: 0;\n}\n._autoWeight_1jdnu_47 {\n width: 'auto';\n height: 'auto';\n}\nhtml[data-theme='dark'] ._chart_1t41j_1 canvas {\n filter: invert(1) hue-rotate(180deg);\n}\n._chart_1t41j_1 {\n border: 1px solid rgba(255, 255, 255, 0);\n padding-top: 10px;\n position: relative;\n}\n._chart_1t41j_1 canvas {\n width: 100% !important;\n height: 100% !important;\n}\n._chart_1t41j_1._fixedHeight_1t41j_13 {\n display: flex;\n align-items: flex-start;\n justify-content: flex-start;\n height: auto;\n}\n._chart_1t41j_1._stretchHeight_1t41j_19 {\n display: flex;\n align-items: stretch;\n justify-content: stretch;\n height: 100%;\n}\n._chart_1t41j_1:focus {\n border: 1px solid #85b7d9;\n outline: none;\n}\n._chart_1t41j_1::-moz-focus-inner {\n border: 0;\n}\n._zoomForm_1t41j_32 {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n top: 0;\n right: 0;\n}\n._zoomForm_1t41j_32 ._zoomReset_1t41j_40 {\n margin-left: 10px;\n}\n._zoomForm_1t41j_32 ._help_1t41j_43 {\n margin-left: 5px;\n line-height: 0;\n}\n._autoWeight_1t41j_47 {\n width: auto;\n height: auto;\n}"));
|
|
39480
39503
|
document.head.appendChild(elementStyle);
|
|
39481
39504
|
}
|
|
39482
39505
|
} catch (e) {
|