@oliasoft-open-source/charts-library 4.3.0-beta-4 → 4.3.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
CHANGED
|
@@ -39679,32 +39679,41 @@ const useBarChartConfig = (chartRef, chart2) => {
|
|
|
39679
39679
|
[chartRef, chart2]
|
|
39680
39680
|
);
|
|
39681
39681
|
};
|
|
39682
|
+
const getStackedOptions = (axisType, { stacked, stackedX, stackedY }) => {
|
|
39683
|
+
if (axisType === AxisType.X) {
|
|
39684
|
+
return stackedX ?? stacked;
|
|
39685
|
+
} else if (axisType === AxisType.Y) {
|
|
39686
|
+
return stackedY ?? stacked;
|
|
39687
|
+
}
|
|
39688
|
+
return stacked;
|
|
39689
|
+
};
|
|
39682
39690
|
const getBarChartAxis = ({
|
|
39683
39691
|
chart: chart2,
|
|
39684
39692
|
axisType = AxisType.X,
|
|
39685
39693
|
currentScale,
|
|
39686
39694
|
i: i2
|
|
39687
39695
|
}) => {
|
|
39688
|
-
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2
|
|
39689
|
-
const
|
|
39690
|
-
const
|
|
39696
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
|
|
39697
|
+
const { data, options } = chart2 ?? {};
|
|
39698
|
+
const isDirectionVertical = isVertical(options.direction);
|
|
39699
|
+
const axisData = currentScale || ((_b2 = (_a2 = options == null ? void 0 : options.axes) == null ? void 0 : _a2[axisType]) == null ? void 0 : _b2[0]);
|
|
39691
39700
|
const isDirectionCompatibleWithAxisType = isDirectionVertical && axisType === AxisType.Y || !isDirectionVertical && axisType === AxisType.X;
|
|
39692
39701
|
const grid = (axisData == null ? void 0 : axisData.gridLines) || {};
|
|
39693
39702
|
const getScaleType = () => {
|
|
39694
|
-
var _a3
|
|
39695
|
-
const scaleType =
|
|
39703
|
+
var _a3;
|
|
39704
|
+
const scaleType = data.labels ? ScaleType.Category : ScaleType.Linear;
|
|
39696
39705
|
const axisWithScale = isDirectionVertical ? AxisType.X : AxisType.Y;
|
|
39697
|
-
return axisType === axisWithScale ? scaleType : (
|
|
39706
|
+
return axisType === axisWithScale ? scaleType : (_a3 = options == null ? void 0 : options.additionalAxesOptions) == null ? void 0 : _a3.chartScaleType;
|
|
39698
39707
|
};
|
|
39699
39708
|
const getReverse = () => {
|
|
39700
|
-
var _a3
|
|
39709
|
+
var _a3;
|
|
39701
39710
|
const axisWithReverse = isDirectionVertical ? AxisType.Y : AxisType.X;
|
|
39702
|
-
return axisType === axisWithReverse ? (
|
|
39711
|
+
return axisType === axisWithReverse ? (_a3 = options == null ? void 0 : options.additionalAxesOptions) == null ? void 0 : _a3.reverse : false;
|
|
39703
39712
|
};
|
|
39704
39713
|
const getTicks = () => {
|
|
39705
|
-
var _a3, _b3
|
|
39706
|
-
const additionalAxesOptions =
|
|
39707
|
-
const ticksConfigFromProps = (
|
|
39714
|
+
var _a3, _b3;
|
|
39715
|
+
const additionalAxesOptions = options == null ? void 0 : options.additionalAxesOptions;
|
|
39716
|
+
const ticksConfigFromProps = (_b3 = (_a3 = options == null ? void 0 : options.scales) == null ? void 0 : _a3[`${i2 === 0 ? axisType : axisType + i2}`]) == null ? void 0 : _b3.ticks;
|
|
39708
39717
|
const isLogarithmic = isDirectionCompatibleWithAxisType && (additionalAxesOptions == null ? void 0 : additionalAxesOptions.chartScaleType) === ScaleType.Logarithmic;
|
|
39709
39718
|
const ticksFormattingCallback = (tick, _2, ticks2) => {
|
|
39710
39719
|
return isLogarithmic ? LOGARITHMIC_STEPS.includes(Number(tick)) ? formatAxisLabelNumbers(tick, ticks2) : "" : formatAxisLabelNumbers(tick, ticks2);
|
|
@@ -39729,14 +39738,14 @@ const getBarChartAxis = ({
|
|
|
39729
39738
|
return {
|
|
39730
39739
|
type: getScaleType(),
|
|
39731
39740
|
position: axisData == null ? void 0 : axisData.position,
|
|
39732
|
-
beginAtZero: (
|
|
39741
|
+
beginAtZero: (_c2 = options == null ? void 0 : options.additionalAxesOptions) == null ? void 0 : _c2.beginAtZero,
|
|
39733
39742
|
reverse: getReverse(),
|
|
39734
|
-
suggestedMax: (
|
|
39735
|
-
suggestedMin: (
|
|
39736
|
-
min: isDirectionCompatibleWithAxisType ? (
|
|
39737
|
-
max: isDirectionCompatibleWithAxisType ? (
|
|
39743
|
+
suggestedMax: (_d2 = options == null ? void 0 : options.additionalAxesOptions) == null ? void 0 : _d2.suggestedMax,
|
|
39744
|
+
suggestedMin: (_e2 = options == null ? void 0 : options.additionalAxesOptions) == null ? void 0 : _e2.suggestedMin,
|
|
39745
|
+
min: isDirectionCompatibleWithAxisType ? (_f2 = options == null ? void 0 : options.additionalAxesOptions) == null ? void 0 : _f2.min : void 0,
|
|
39746
|
+
max: isDirectionCompatibleWithAxisType ? (_g2 = options == null ? void 0 : options.additionalAxesOptions) == null ? void 0 : _g2.max : void 0,
|
|
39738
39747
|
title: {
|
|
39739
|
-
display: ((
|
|
39748
|
+
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),
|
|
39740
39749
|
text: (axisData == null ? void 0 : axisData.label) || (axisData == null ? void 0 : axisData.unit),
|
|
39741
39750
|
padding: 0
|
|
39742
39751
|
},
|
|
@@ -39744,7 +39753,7 @@ const getBarChartAxis = ({
|
|
|
39744
39753
|
grid: {
|
|
39745
39754
|
...grid
|
|
39746
39755
|
},
|
|
39747
|
-
stacked: (
|
|
39756
|
+
stacked: getStackedOptions(axisType, options == null ? void 0 : options.additionalAxesOptions)
|
|
39748
39757
|
};
|
|
39749
39758
|
};
|
|
39750
39759
|
const getBarChartAxes = (chart2, axisType) => {
|
|
@@ -39964,7 +39973,9 @@ const defaultAdditionalAxesOptions$1 = (options) => ({
|
|
|
39964
39973
|
suggestedMin: options == null ? void 0 : options.suggestedMin,
|
|
39965
39974
|
suggestedMax: options == null ? void 0 : options.suggestedMax,
|
|
39966
39975
|
min: options == null ? void 0 : options.min,
|
|
39967
|
-
max: options == null ? void 0 : options.max
|
|
39976
|
+
max: options == null ? void 0 : options.max,
|
|
39977
|
+
stackedX: options == null ? void 0 : options.stackedX,
|
|
39978
|
+
stackedY: options == null ? void 0 : options.stackedY
|
|
39968
39979
|
});
|
|
39969
39980
|
const defaultChartStyling$1 = (styling) => ({
|
|
39970
39981
|
width: styling == null ? void 0 : styling.width,
|
|
@@ -40043,6 +40054,8 @@ const getDefaultProps$1 = (props) => {
|
|
|
40043
40054
|
};
|
|
40044
40055
|
Chart$2.register(
|
|
40045
40056
|
LinearScale$1,
|
|
40057
|
+
PointElement$1,
|
|
40058
|
+
LineElement$1,
|
|
40046
40059
|
CategoryScale$1,
|
|
40047
40060
|
LogarithmicScale$1,
|
|
40048
40061
|
BarElement$1,
|