@oliasoft-open-source/charts-library 4.2.2 → 4.2.3
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
|
@@ -39271,32 +39271,41 @@ const useBarChartConfig = (chartRef, chart2) => {
|
|
|
39271
39271
|
[chartRef, chart2]
|
|
39272
39272
|
);
|
|
39273
39273
|
};
|
|
39274
|
+
const getStackedOptions = (axisType, { stacked, stackedX, stackedY }) => {
|
|
39275
|
+
if (axisType === AxisType.X) {
|
|
39276
|
+
return stackedX ?? stacked;
|
|
39277
|
+
} else if (axisType === AxisType.Y) {
|
|
39278
|
+
return stackedY ?? stacked;
|
|
39279
|
+
}
|
|
39280
|
+
return stacked;
|
|
39281
|
+
};
|
|
39274
39282
|
const getBarChartAxis = ({
|
|
39275
39283
|
chart: chart2,
|
|
39276
39284
|
axisType = AxisType.X,
|
|
39277
39285
|
currentScale,
|
|
39278
39286
|
i: i2
|
|
39279
39287
|
}) => {
|
|
39280
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2
|
|
39281
|
-
const
|
|
39282
|
-
const
|
|
39288
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
|
|
39289
|
+
const { data, options } = chart2 ?? {};
|
|
39290
|
+
const isDirectionVertical = isVertical(options.direction);
|
|
39291
|
+
const axisData = currentScale || ((_b2 = (_a2 = options == null ? void 0 : options.axes) == null ? void 0 : _a2[axisType]) == null ? void 0 : _b2[0]);
|
|
39283
39292
|
const isDirectionCompatibleWithAxisType = isDirectionVertical && axisType === AxisType.Y || !isDirectionVertical && axisType === AxisType.X;
|
|
39284
39293
|
const grid = (axisData == null ? void 0 : axisData.gridLines) || {};
|
|
39285
39294
|
const getScaleType = () => {
|
|
39286
|
-
var _a3
|
|
39287
|
-
const scaleType =
|
|
39295
|
+
var _a3;
|
|
39296
|
+
const scaleType = data.labels ? ScaleType.Category : ScaleType.Linear;
|
|
39288
39297
|
const axisWithScale = isDirectionVertical ? AxisType.X : AxisType.Y;
|
|
39289
|
-
return axisType === axisWithScale ? scaleType : (
|
|
39298
|
+
return axisType === axisWithScale ? scaleType : (_a3 = options == null ? void 0 : options.additionalAxesOptions) == null ? void 0 : _a3.chartScaleType;
|
|
39290
39299
|
};
|
|
39291
39300
|
const getReverse = () => {
|
|
39292
|
-
var _a3
|
|
39301
|
+
var _a3;
|
|
39293
39302
|
const axisWithReverse = isDirectionVertical ? AxisType.Y : AxisType.X;
|
|
39294
|
-
return axisType === axisWithReverse ? (
|
|
39303
|
+
return axisType === axisWithReverse ? (_a3 = options == null ? void 0 : options.additionalAxesOptions) == null ? void 0 : _a3.reverse : false;
|
|
39295
39304
|
};
|
|
39296
39305
|
const getTicks = () => {
|
|
39297
|
-
var _a3, _b3
|
|
39298
|
-
const additionalAxesOptions =
|
|
39299
|
-
const ticksConfigFromProps = (
|
|
39306
|
+
var _a3, _b3;
|
|
39307
|
+
const additionalAxesOptions = options == null ? void 0 : options.additionalAxesOptions;
|
|
39308
|
+
const ticksConfigFromProps = (_b3 = (_a3 = options == null ? void 0 : options.scales) == null ? void 0 : _a3[`${i2 === 0 ? axisType : axisType + i2}`]) == null ? void 0 : _b3.ticks;
|
|
39300
39309
|
const isLogarithmic = isDirectionCompatibleWithAxisType && (additionalAxesOptions == null ? void 0 : additionalAxesOptions.chartScaleType) === ScaleType.Logarithmic;
|
|
39301
39310
|
const ticksFormattingCallback = (tick, _2, ticks2) => {
|
|
39302
39311
|
return isLogarithmic ? LOGARITHMIC_STEPS.includes(Number(tick)) ? formatAxisLabelNumbers(tick, ticks2) : "" : formatAxisLabelNumbers(tick, ticks2);
|
|
@@ -39321,14 +39330,14 @@ const getBarChartAxis = ({
|
|
|
39321
39330
|
return {
|
|
39322
39331
|
type: getScaleType(),
|
|
39323
39332
|
position: axisData == null ? void 0 : axisData.position,
|
|
39324
|
-
beginAtZero: (
|
|
39333
|
+
beginAtZero: (_c2 = options == null ? void 0 : options.additionalAxesOptions) == null ? void 0 : _c2.beginAtZero,
|
|
39325
39334
|
reverse: getReverse(),
|
|
39326
|
-
suggestedMax: (
|
|
39327
|
-
suggestedMin: (
|
|
39328
|
-
min: isDirectionCompatibleWithAxisType ? (
|
|
39329
|
-
max: isDirectionCompatibleWithAxisType ? (
|
|
39335
|
+
suggestedMax: (_d2 = options == null ? void 0 : options.additionalAxesOptions) == null ? void 0 : _d2.suggestedMax,
|
|
39336
|
+
suggestedMin: (_e2 = options == null ? void 0 : options.additionalAxesOptions) == null ? void 0 : _e2.suggestedMin,
|
|
39337
|
+
min: isDirectionCompatibleWithAxisType ? (_f2 = options == null ? void 0 : options.additionalAxesOptions) == null ? void 0 : _f2.min : void 0,
|
|
39338
|
+
max: isDirectionCompatibleWithAxisType ? (_g2 = options == null ? void 0 : options.additionalAxesOptions) == null ? void 0 : _g2.max : void 0,
|
|
39330
39339
|
title: {
|
|
39331
|
-
display: ((
|
|
39340
|
+
display: ((_h2 = axisData == null ? void 0 : axisData.label) == null ? void 0 : _h2.length) || ((_i2 = axisData == null ? void 0 : axisData.unit) == null ? void 0 : _i2.length),
|
|
39332
39341
|
text: (axisData == null ? void 0 : axisData.label) || (axisData == null ? void 0 : axisData.unit),
|
|
39333
39342
|
padding: 0
|
|
39334
39343
|
},
|
|
@@ -39336,7 +39345,7 @@ const getBarChartAxis = ({
|
|
|
39336
39345
|
grid: {
|
|
39337
39346
|
...grid
|
|
39338
39347
|
},
|
|
39339
|
-
stacked: (
|
|
39348
|
+
stacked: getStackedOptions(axisType, options == null ? void 0 : options.additionalAxesOptions)
|
|
39340
39349
|
};
|
|
39341
39350
|
};
|
|
39342
39351
|
const getBarChartAxes = (chart2, axisType) => {
|
|
@@ -39556,7 +39565,9 @@ const defaultAdditionalAxesOptions$1 = (options) => ({
|
|
|
39556
39565
|
suggestedMin: options == null ? void 0 : options.suggestedMin,
|
|
39557
39566
|
suggestedMax: options == null ? void 0 : options.suggestedMax,
|
|
39558
39567
|
min: options == null ? void 0 : options.min,
|
|
39559
|
-
max: options == null ? void 0 : options.max
|
|
39568
|
+
max: options == null ? void 0 : options.max,
|
|
39569
|
+
stackedX: options == null ? void 0 : options.stackedX,
|
|
39570
|
+
stackedY: options == null ? void 0 : options.stackedY
|
|
39560
39571
|
});
|
|
39561
39572
|
const defaultChartStyling$1 = (styling) => ({
|
|
39562
39573
|
width: styling == null ? void 0 : styling.width,
|