@oliasoft-open-source/charts-library 5.11.1-beta-2 → 5.12.1-beta-1
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 +8 -7
- 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
|
}
|
|
@@ -1193,24 +1194,24 @@ export { }
|
|
|
1193
1194
|
|
|
1194
1195
|
declare module 'chart.js' {
|
|
1195
1196
|
interface PluginOptionsByType<TType extends ChartType> {
|
|
1196
|
-
|
|
1197
|
-
enabled?: boolean;
|
|
1198
|
-
} | TLineMarkersOptions;
|
|
1197
|
+
annotationDraggerPlugin?: AnnotationDraggerPluginOptions;
|
|
1199
1198
|
}
|
|
1200
1199
|
}
|
|
1201
1200
|
|
|
1202
1201
|
|
|
1203
1202
|
declare module 'chart.js' {
|
|
1204
1203
|
interface PluginOptionsByType<TType extends ChartType> {
|
|
1205
|
-
|
|
1204
|
+
calloutConnectorPlugin?: {
|
|
1205
|
+
enableCalloutAnnotation?: boolean;
|
|
1206
|
+
};
|
|
1206
1207
|
}
|
|
1207
1208
|
}
|
|
1208
1209
|
|
|
1209
1210
|
|
|
1210
1211
|
declare module 'chart.js' {
|
|
1211
1212
|
interface PluginOptionsByType<TType extends ChartType> {
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
};
|
|
1213
|
+
lineMarkersPlugin?: {
|
|
1214
|
+
enabled?: boolean;
|
|
1215
|
+
} | TLineMarkersOptions;
|
|
1215
1216
|
}
|
|
1216
1217
|
}
|
package/dist/index.js
CHANGED
|
@@ -20432,7 +20432,9 @@ var formatAxisLabelNumbers = (tickValue, ticks) => {
|
|
|
20432
20432
|
var getLineChartAxis = (options, axisType, state, currentScales, i = 0) => {
|
|
20433
20433
|
const axisData = currentScales || options.axes[axisType][0] || {};
|
|
20434
20434
|
const stateAxis = state?.axes.filter((axis) => axis?.id?.startsWith(axisType))[i];
|
|
20435
|
-
const
|
|
20435
|
+
const axisKey = `${i === 0 ? axisType : axisType + i}`;
|
|
20436
|
+
const ticksConfigFromProps = options?.scales?.[axisKey]?.ticks;
|
|
20437
|
+
const titleConfigFromProps = options?.scales?.[axisKey]?.title;
|
|
20436
20438
|
const { additionalAxesOptions } = options;
|
|
20437
20439
|
const getTicks = () => {
|
|
20438
20440
|
const isLogarithmic = additionalAxesOptions?.chartScaleType === ScaleType.Logarithmic;
|
|
@@ -20444,7 +20446,10 @@ var getLineChartAxis = (options, axisType, state, currentScales, i = 0) => {
|
|
|
20444
20446
|
callback: ticksFormattingCallback,
|
|
20445
20447
|
includeBounds: false,
|
|
20446
20448
|
...ticksConfigFromProps,
|
|
20447
|
-
font: {
|
|
20449
|
+
font: {
|
|
20450
|
+
size: 12,
|
|
20451
|
+
...ticksConfigFromProps?.font
|
|
20452
|
+
}
|
|
20448
20453
|
};
|
|
20449
20454
|
};
|
|
20450
20455
|
return {
|
|
@@ -20460,7 +20465,12 @@ var getLineChartAxis = (options, axisType, state, currentScales, i = 0) => {
|
|
|
20460
20465
|
title: {
|
|
20461
20466
|
display: axisData.label?.length,
|
|
20462
20467
|
text: axisData.label,
|
|
20463
|
-
padding: 0
|
|
20468
|
+
padding: 0,
|
|
20469
|
+
...titleConfigFromProps,
|
|
20470
|
+
font: {
|
|
20471
|
+
size: 12,
|
|
20472
|
+
...titleConfigFromProps?.font
|
|
20473
|
+
}
|
|
20464
20474
|
},
|
|
20465
20475
|
ticks: getTicks(),
|
|
20466
20476
|
grid: { ...axisData.gridLines }
|
|
@@ -38437,9 +38447,11 @@ var getBarChartAxis = ({ chart, axisType = AxisType.X, currentScale, i }) => {
|
|
|
38437
38447
|
const getReverse = () => {
|
|
38438
38448
|
return axisType === (isDirectionVertical ? AxisType.Y : AxisType.X) ? options?.additionalAxesOptions?.reverse : false;
|
|
38439
38449
|
};
|
|
38450
|
+
const axisKey = `${i === 0 ? axisType : axisType + i}`;
|
|
38451
|
+
const titleConfigFromProps = options?.scales?.[axisKey]?.title;
|
|
38440
38452
|
const getTicks = () => {
|
|
38441
38453
|
const additionalAxesOptions = options?.additionalAxesOptions;
|
|
38442
|
-
const ticksConfigFromProps = options?.scales?.[
|
|
38454
|
+
const ticksConfigFromProps = options?.scales?.[axisKey]?.ticks;
|
|
38443
38455
|
const isLogarithmic = isDirectionCompatibleWithAxisType && additionalAxesOptions?.chartScaleType === ScaleType.Logarithmic;
|
|
38444
38456
|
const ticksFormattingCallback = (tick, _, ticks) => {
|
|
38445
38457
|
return isLogarithmic ? LOGARITHMIC_STEPS.includes(Number(tick)) ? formatAxisLabelNumbers(tick, ticks) : "" : formatAxisLabelNumbers(tick, ticks);
|
|
@@ -38448,7 +38460,10 @@ var getBarChartAxis = ({ chart, axisType = AxisType.X, currentScale, i }) => {
|
|
|
38448
38460
|
...!isLogarithmic ? { stepSize: axisData.stepSize ?? (axisType === AxisType.Y ? additionalAxesOptions?.stepSize : null) } : {},
|
|
38449
38461
|
includeBounds: false,
|
|
38450
38462
|
...ticksConfigFromProps,
|
|
38451
|
-
font: {
|
|
38463
|
+
font: {
|
|
38464
|
+
size: 12,
|
|
38465
|
+
...ticksConfigFromProps?.font
|
|
38466
|
+
}
|
|
38452
38467
|
};
|
|
38453
38468
|
if (additionalAxesOptions?.chartScaleType === ScaleType.Logarithmic) ticks.callback = ticksFormattingCallback;
|
|
38454
38469
|
return ticks;
|
|
@@ -38465,7 +38480,12 @@ var getBarChartAxis = ({ chart, axisType = AxisType.X, currentScale, i }) => {
|
|
|
38465
38480
|
title: {
|
|
38466
38481
|
display: axisData?.label?.length || axisData?.unit?.length,
|
|
38467
38482
|
text: axisData?.label || axisData?.unit,
|
|
38468
|
-
padding: 0
|
|
38483
|
+
padding: 0,
|
|
38484
|
+
...titleConfigFromProps,
|
|
38485
|
+
font: {
|
|
38486
|
+
size: 12,
|
|
38487
|
+
...titleConfigFromProps?.font
|
|
38488
|
+
}
|
|
38469
38489
|
},
|
|
38470
38490
|
ticks: getTicks(),
|
|
38471
38491
|
grid: { ...grid },
|
|
@@ -38887,6 +38907,8 @@ var getScatterChartAxis = ({ options, axisType = AxisType.X, currentScale }) =>
|
|
|
38887
38907
|
const axisData = currentScale || options?.axes?.[axisType]?.[0];
|
|
38888
38908
|
const isDirectionCompatibleWithAxisType = isDirectionVertical && axisType === AxisType.Y || !isDirectionVertical && axisType === AxisType.X;
|
|
38889
38909
|
const grid = axisData?.gridLines || {};
|
|
38910
|
+
const ticksConfigFromProps = options?.scales?.[axisType]?.ticks;
|
|
38911
|
+
const titleConfigFromProps = options?.scales?.[axisType]?.title;
|
|
38890
38912
|
const getReverse = () => {
|
|
38891
38913
|
return axisType === (isDirectionVertical ? AxisType.Y : AxisType.X) ? options?.additionalAxesOptions?.reverse : false;
|
|
38892
38914
|
};
|
|
@@ -38895,7 +38917,11 @@ var getScatterChartAxis = ({ options, axisType = AxisType.X, currentScale }) =>
|
|
|
38895
38917
|
return {
|
|
38896
38918
|
stepSize: axisData?.stepSize ?? (axisType === AxisType.Y ? additionalAxesOptions?.stepSize : void 0),
|
|
38897
38919
|
includeBounds: false,
|
|
38898
|
-
|
|
38920
|
+
...ticksConfigFromProps,
|
|
38921
|
+
font: {
|
|
38922
|
+
size: 12,
|
|
38923
|
+
...ticksConfigFromProps?.font
|
|
38924
|
+
}
|
|
38899
38925
|
};
|
|
38900
38926
|
};
|
|
38901
38927
|
return {
|
|
@@ -38910,7 +38936,12 @@ var getScatterChartAxis = ({ options, axisType = AxisType.X, currentScale }) =>
|
|
|
38910
38936
|
title: {
|
|
38911
38937
|
display: !!axisData?.label?.length || !!axisData?.unit?.length,
|
|
38912
38938
|
text: axisData?.label || axisData?.unit,
|
|
38913
|
-
padding: 0
|
|
38939
|
+
padding: 0,
|
|
38940
|
+
...titleConfigFromProps,
|
|
38941
|
+
font: {
|
|
38942
|
+
size: 12,
|
|
38943
|
+
...titleConfigFromProps?.font
|
|
38944
|
+
}
|
|
38914
38945
|
},
|
|
38915
38946
|
ticks: getTicks(),
|
|
38916
38947
|
grid: { ...grid }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oliasoft-open-source/charts-library",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.12.1-beta-1",
|
|
4
4
|
"description": "React Chart Library (based on Chart.js and react-chart-js-2)",
|
|
5
5
|
"homepage": "https://gitlab.com/oliasoft-open-source/charts-library",
|
|
6
6
|
"bugs": {
|