@oliasoft-open-source/charts-library 3.7.4 → 3.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -22743,8 +22743,7 @@ const LineOptions = ({
|
|
|
22743
22743
|
onToggleLine,
|
|
22744
22744
|
onTogglePoints,
|
|
22745
22745
|
pointsEnabled,
|
|
22746
|
-
translations
|
|
22747
|
-
hasCustomOpt
|
|
22746
|
+
translations
|
|
22748
22747
|
}) => {
|
|
22749
22748
|
const options = [
|
|
22750
22749
|
{
|
|
@@ -22774,26 +22773,17 @@ const LineOptions = ({
|
|
|
22774
22773
|
}
|
|
22775
22774
|
];
|
|
22776
22775
|
const selectedOption = options.find((option) => option.selected);
|
|
22777
|
-
return /* @__PURE__ */ jsx(
|
|
22778
|
-
|
|
22776
|
+
return /* @__PURE__ */ jsx(Tooltip$2, { text: selectedOption == null ? void 0 : selectedOption.label, placement: "bottom", children: /* @__PURE__ */ jsx(
|
|
22777
|
+
Button,
|
|
22779
22778
|
{
|
|
22780
|
-
|
|
22781
|
-
|
|
22782
|
-
|
|
22783
|
-
|
|
22784
|
-
|
|
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
|
-
)
|
|
22779
|
+
small: true,
|
|
22780
|
+
basic: true,
|
|
22781
|
+
colored: "muted",
|
|
22782
|
+
round: true,
|
|
22783
|
+
icon: selectedOption == null ? void 0 : selectedOption.icon,
|
|
22784
|
+
onClick: selectedOption == null ? void 0 : selectedOption.onClick
|
|
22795
22785
|
}
|
|
22796
|
-
);
|
|
22786
|
+
) });
|
|
22797
22787
|
};
|
|
22798
22788
|
function TbHandStop(props) {
|
|
22799
22789
|
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);
|
|
@@ -24311,27 +24301,6 @@ const ControlsPortal = ({
|
|
|
24311
24301
|
}
|
|
24312
24302
|
return children;
|
|
24313
24303
|
};
|
|
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
|
-
};
|
|
24335
24304
|
const Controls = ({
|
|
24336
24305
|
headerComponent,
|
|
24337
24306
|
subheaderComponent,
|
|
@@ -24370,7 +24339,6 @@ const Controls = ({
|
|
|
24370
24339
|
dispatch,
|
|
24371
24340
|
generatedDatasets
|
|
24372
24341
|
});
|
|
24373
|
-
const hasCustomOpt = checkCustomOption(generatedDatasets, "hasCustomOpt");
|
|
24374
24342
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
24375
24343
|
/* @__PURE__ */ jsxs("div", { className: styles$3.controls, children: [
|
|
24376
24344
|
!!options.title && /* @__PURE__ */ jsx(Text, { bold: true, children: options.title }),
|
|
@@ -24396,8 +24364,7 @@ const Controls = ({
|
|
|
24396
24364
|
pointsEnabled,
|
|
24397
24365
|
onToggleLine,
|
|
24398
24366
|
onTogglePoints,
|
|
24399
|
-
translations
|
|
24400
|
-
hasCustomOpt
|
|
24367
|
+
translations
|
|
24401
24368
|
}
|
|
24402
24369
|
),
|
|
24403
24370
|
/* @__PURE__ */ jsx(
|
|
@@ -25098,6 +25065,27 @@ const INIT_KEYS = {
|
|
|
25098
25065
|
};
|
|
25099
25066
|
const LOWER_BOUND = 1e-4;
|
|
25100
25067
|
const UPPER_BOUND = 1e7;
|
|
25068
|
+
const checkCustomOption = (data, customOptions) => {
|
|
25069
|
+
if (isEmpty(data) || isEmpty(customOptions))
|
|
25070
|
+
return false;
|
|
25071
|
+
const checkOption = (dataset) => {
|
|
25072
|
+
if (typeof customOptions === "string") {
|
|
25073
|
+
return has(dataset, customOptions);
|
|
25074
|
+
} else if (isArray$2(customOptions)) {
|
|
25075
|
+
return some(customOptions, (option) => has(dataset, option));
|
|
25076
|
+
} else {
|
|
25077
|
+
return some(
|
|
25078
|
+
Object.values(customOptions),
|
|
25079
|
+
(option) => has(dataset, option)
|
|
25080
|
+
);
|
|
25081
|
+
}
|
|
25082
|
+
};
|
|
25083
|
+
if (isArray$2(data)) {
|
|
25084
|
+
return some(data, (dataset) => checkOption(dataset));
|
|
25085
|
+
} else {
|
|
25086
|
+
return checkOption(data);
|
|
25087
|
+
}
|
|
25088
|
+
};
|
|
25101
25089
|
var CUSTOM_OPTION = /* @__PURE__ */ ((CUSTOM_OPTION2) => {
|
|
25102
25090
|
CUSTOM_OPTION2["showLine"] = "showLine";
|
|
25103
25091
|
CUSTOM_OPTION2["showPoints"] = "showPoints";
|
|
@@ -25145,8 +25133,8 @@ const generateLineChartDatasets = (datasets, state, options, { label }) => {
|
|
|
25145
25133
|
backgroundColor,
|
|
25146
25134
|
pointBackgroundColor,
|
|
25147
25135
|
borderDash,
|
|
25148
|
-
showPoints
|
|
25149
|
-
showLine
|
|
25136
|
+
showPoints: customShowPoints,
|
|
25137
|
+
showLine: customShowLine
|
|
25150
25138
|
} = line ?? {};
|
|
25151
25139
|
const { lineEnabled, pointsEnabled, axes = [] } = state ?? {};
|
|
25152
25140
|
const { lineTension, spanGaps } = graph ?? {};
|
|
@@ -25161,18 +25149,25 @@ const generateLineChartDatasets = (datasets, state, options, { label }) => {
|
|
|
25161
25149
|
data[2].x = Math.min(axesMax, endPoint.x);
|
|
25162
25150
|
}
|
|
25163
25151
|
}
|
|
25152
|
+
const hasCustomOpt = checkCustomOption(line, CUSTOM_OPTION);
|
|
25164
25153
|
const filteredData = data.filter(Boolean) || [];
|
|
25165
25154
|
const isSinglePoint = (filteredData == null ? void 0 : filteredData.length) === 1;
|
|
25155
|
+
let pointState, lineState;
|
|
25156
|
+
if (hasCustomOpt) {
|
|
25157
|
+
pointState = customShowPoints !== void 0 ? customShowPoints : !customShowLine;
|
|
25158
|
+
lineState = customShowLine !== void 0 ? customShowLine : !customShowPoints;
|
|
25159
|
+
} else {
|
|
25160
|
+
pointState = pointsEnabled || isSinglePoint;
|
|
25161
|
+
lineState = lineEnabled;
|
|
25162
|
+
}
|
|
25166
25163
|
const linePointRadius = parseFloat(pointRadiusProp) || DEFAULT_POINT_RADIUS;
|
|
25167
|
-
const pointRadius = (pointsEnabled || isSinglePoint) && showPoints ? linePointRadius : 0;
|
|
25168
25164
|
const hoverRadius = parseFloat(pointHoverRadius) || DEFAULT_HOVER_RADIUS;
|
|
25169
25165
|
const indexedColor = COLORS[i2];
|
|
25170
|
-
const hasCustomOpt = checkCustomOption(line, CUSTOM_OPTION);
|
|
25171
25166
|
return {
|
|
25172
25167
|
...line,
|
|
25173
25168
|
label: line.label || `${label} ${i2 + 1}`,
|
|
25174
25169
|
data: filteredData,
|
|
25175
|
-
showLine:
|
|
25170
|
+
showLine: lineState,
|
|
25176
25171
|
lineTension,
|
|
25177
25172
|
spanGaps,
|
|
25178
25173
|
borderWidth: parseFloat(borderWidth) || DEFAULT_BORDER_WIDTH,
|
|
@@ -25181,7 +25176,7 @@ const generateLineChartDatasets = (datasets, state, options, { label }) => {
|
|
|
25181
25176
|
borderColor: borderColor ?? indexedColor ?? generateRandomColor(COLORS),
|
|
25182
25177
|
backgroundColor: backgroundColor ?? DEFAULT_BACKGROUND_COLOR,
|
|
25183
25178
|
pointBackgroundColor: pointBackgroundColor ?? indexedColor ?? generateRandomColor(COLORS),
|
|
25184
|
-
pointRadius,
|
|
25179
|
+
pointRadius: pointState ? linePointRadius : 0,
|
|
25185
25180
|
pointHoverRadius: hoverRadius,
|
|
25186
25181
|
pointHitRadius: line.pointHitRadius ?? hoverRadius,
|
|
25187
25182
|
...hasCustomOpt ? { hasCustomOpt } : {}
|