@oliasoft-open-source/charts-library 5.11.0 → 5.12.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.d.ts +1 -0
- package/dist/index.js +39 -8
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -958,6 +958,7 @@ export declare interface IScatterOptions extends ICommonOptions {
|
|
|
958
958
|
graph?: IScatterGraph;
|
|
959
959
|
legend?: IScatterLegend;
|
|
960
960
|
axes?: IScatterAxes;
|
|
961
|
+
scales?: ICommonScales;
|
|
961
962
|
additionalAxesOptions?: ICommonAdditionalAxesOptions;
|
|
962
963
|
direction?: ChartDirection;
|
|
963
964
|
}
|
package/dist/index.js
CHANGED
|
@@ -20429,7 +20429,9 @@ var formatAxisLabelNumbers = (tickValue, ticks) => {
|
|
|
20429
20429
|
var getLineChartAxis = (options, axisType, state, currentScales, i = 0) => {
|
|
20430
20430
|
const axisData = currentScales || options.axes[axisType][0] || {};
|
|
20431
20431
|
const stateAxis = state?.axes.filter((axis) => axis?.id?.startsWith(axisType))[i];
|
|
20432
|
-
const
|
|
20432
|
+
const axisKey = `${i === 0 ? axisType : axisType + i}`;
|
|
20433
|
+
const ticksConfigFromProps = options?.scales?.[axisKey]?.ticks;
|
|
20434
|
+
const titleConfigFromProps = options?.scales?.[axisKey]?.title;
|
|
20433
20435
|
const { additionalAxesOptions } = options;
|
|
20434
20436
|
const getTicks = () => {
|
|
20435
20437
|
const isLogarithmic = additionalAxesOptions?.chartScaleType === ScaleType.Logarithmic;
|
|
@@ -20441,7 +20443,10 @@ var getLineChartAxis = (options, axisType, state, currentScales, i = 0) => {
|
|
|
20441
20443
|
callback: ticksFormattingCallback,
|
|
20442
20444
|
includeBounds: false,
|
|
20443
20445
|
...ticksConfigFromProps,
|
|
20444
|
-
font: {
|
|
20446
|
+
font: {
|
|
20447
|
+
size: 12,
|
|
20448
|
+
...ticksConfigFromProps?.font
|
|
20449
|
+
}
|
|
20445
20450
|
};
|
|
20446
20451
|
};
|
|
20447
20452
|
return {
|
|
@@ -20457,7 +20462,12 @@ var getLineChartAxis = (options, axisType, state, currentScales, i = 0) => {
|
|
|
20457
20462
|
title: {
|
|
20458
20463
|
display: axisData.label?.length,
|
|
20459
20464
|
text: axisData.label,
|
|
20460
|
-
padding: 0
|
|
20465
|
+
padding: 0,
|
|
20466
|
+
...titleConfigFromProps,
|
|
20467
|
+
font: {
|
|
20468
|
+
size: 12,
|
|
20469
|
+
...titleConfigFromProps?.font
|
|
20470
|
+
}
|
|
20461
20471
|
},
|
|
20462
20472
|
ticks: getTicks(),
|
|
20463
20473
|
grid: { ...axisData.gridLines }
|
|
@@ -38434,9 +38444,11 @@ var getBarChartAxis = ({ chart, axisType = AxisType.X, currentScale, i }) => {
|
|
|
38434
38444
|
const getReverse = () => {
|
|
38435
38445
|
return axisType === (isDirectionVertical ? AxisType.Y : AxisType.X) ? options?.additionalAxesOptions?.reverse : false;
|
|
38436
38446
|
};
|
|
38447
|
+
const axisKey = `${i === 0 ? axisType : axisType + i}`;
|
|
38448
|
+
const titleConfigFromProps = options?.scales?.[axisKey]?.title;
|
|
38437
38449
|
const getTicks = () => {
|
|
38438
38450
|
const additionalAxesOptions = options?.additionalAxesOptions;
|
|
38439
|
-
const ticksConfigFromProps = options?.scales?.[
|
|
38451
|
+
const ticksConfigFromProps = options?.scales?.[axisKey]?.ticks;
|
|
38440
38452
|
const isLogarithmic = isDirectionCompatibleWithAxisType && additionalAxesOptions?.chartScaleType === ScaleType.Logarithmic;
|
|
38441
38453
|
const ticksFormattingCallback = (tick, _, ticks) => {
|
|
38442
38454
|
return isLogarithmic ? LOGARITHMIC_STEPS.includes(Number(tick)) ? formatAxisLabelNumbers(tick, ticks) : "" : formatAxisLabelNumbers(tick, ticks);
|
|
@@ -38445,7 +38457,10 @@ var getBarChartAxis = ({ chart, axisType = AxisType.X, currentScale, i }) => {
|
|
|
38445
38457
|
...!isLogarithmic ? { stepSize: axisData.stepSize ?? (axisType === AxisType.Y ? additionalAxesOptions?.stepSize : null) } : {},
|
|
38446
38458
|
includeBounds: false,
|
|
38447
38459
|
...ticksConfigFromProps,
|
|
38448
|
-
font: {
|
|
38460
|
+
font: {
|
|
38461
|
+
size: 12,
|
|
38462
|
+
...ticksConfigFromProps?.font
|
|
38463
|
+
}
|
|
38449
38464
|
};
|
|
38450
38465
|
if (additionalAxesOptions?.chartScaleType === ScaleType.Logarithmic) ticks.callback = ticksFormattingCallback;
|
|
38451
38466
|
return ticks;
|
|
@@ -38462,7 +38477,12 @@ var getBarChartAxis = ({ chart, axisType = AxisType.X, currentScale, i }) => {
|
|
|
38462
38477
|
title: {
|
|
38463
38478
|
display: axisData?.label?.length || axisData?.unit?.length,
|
|
38464
38479
|
text: axisData?.label || axisData?.unit,
|
|
38465
|
-
padding: 0
|
|
38480
|
+
padding: 0,
|
|
38481
|
+
...titleConfigFromProps,
|
|
38482
|
+
font: {
|
|
38483
|
+
size: 12,
|
|
38484
|
+
...titleConfigFromProps?.font
|
|
38485
|
+
}
|
|
38466
38486
|
},
|
|
38467
38487
|
ticks: getTicks(),
|
|
38468
38488
|
grid: { ...grid },
|
|
@@ -38884,6 +38904,8 @@ var getScatterChartAxis = ({ options, axisType = AxisType.X, currentScale }) =>
|
|
|
38884
38904
|
const axisData = currentScale || options?.axes?.[axisType]?.[0];
|
|
38885
38905
|
const isDirectionCompatibleWithAxisType = isDirectionVertical && axisType === AxisType.Y || !isDirectionVertical && axisType === AxisType.X;
|
|
38886
38906
|
const grid = axisData?.gridLines || {};
|
|
38907
|
+
const ticksConfigFromProps = options?.scales?.[axisType]?.ticks;
|
|
38908
|
+
const titleConfigFromProps = options?.scales?.[axisType]?.title;
|
|
38887
38909
|
const getReverse = () => {
|
|
38888
38910
|
return axisType === (isDirectionVertical ? AxisType.Y : AxisType.X) ? options?.additionalAxesOptions?.reverse : false;
|
|
38889
38911
|
};
|
|
@@ -38892,7 +38914,11 @@ var getScatterChartAxis = ({ options, axisType = AxisType.X, currentScale }) =>
|
|
|
38892
38914
|
return {
|
|
38893
38915
|
stepSize: axisData?.stepSize ?? (axisType === AxisType.Y ? additionalAxesOptions?.stepSize : void 0),
|
|
38894
38916
|
includeBounds: false,
|
|
38895
|
-
|
|
38917
|
+
...ticksConfigFromProps,
|
|
38918
|
+
font: {
|
|
38919
|
+
size: 12,
|
|
38920
|
+
...ticksConfigFromProps?.font
|
|
38921
|
+
}
|
|
38896
38922
|
};
|
|
38897
38923
|
};
|
|
38898
38924
|
return {
|
|
@@ -38907,7 +38933,12 @@ var getScatterChartAxis = ({ options, axisType = AxisType.X, currentScale }) =>
|
|
|
38907
38933
|
title: {
|
|
38908
38934
|
display: !!axisData?.label?.length || !!axisData?.unit?.length,
|
|
38909
38935
|
text: axisData?.label || axisData?.unit,
|
|
38910
|
-
padding: 0
|
|
38936
|
+
padding: 0,
|
|
38937
|
+
...titleConfigFromProps,
|
|
38938
|
+
font: {
|
|
38939
|
+
size: 12,
|
|
38940
|
+
...titleConfigFromProps?.font
|
|
38941
|
+
}
|
|
38911
38942
|
},
|
|
38912
38943
|
ticks: getTicks(),
|
|
38913
38944
|
grid: { ...grid }
|
package/package.json
CHANGED