@oliasoft-open-source/charts-library 5.11.1-beta-1 → 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 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
- lineMarkersPlugin?: {
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
- annotationDraggerPlugin?: AnnotationDraggerPluginOptions;
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
- calloutConnectorPlugin?: {
1213
- enableCalloutAnnotation?: boolean;
1214
- };
1213
+ lineMarkersPlugin?: {
1214
+ enabled?: boolean;
1215
+ } | TLineMarkersOptions;
1215
1216
  }
1216
1217
  }
package/dist/index.js CHANGED
@@ -19480,14 +19480,11 @@ var downloadPgn = (chartRef) => {
19480
19480
  ctx.fillRect(0, 0, chart.width, chart.height);
19481
19481
  ctx.restore();
19482
19482
  const fileName = getChartFileName(getAxesLabelsFromChart(chart));
19483
- const toPngOptions = { skipFonts: navigator.userAgent.includes("Firefox") };
19484
- setTimeout(() => {
19485
- toPng(canvasElement, toPngOptions).then((dataUrl) => {
19486
- triggerBase64Download(dataUrl, fileName);
19487
- }).catch((e) => {
19488
- console.error("Could not parse the html: ", e);
19489
- });
19490
- }, 0);
19483
+ toPng(canvasElement, { skipFonts: navigator.userAgent.includes("Firefox") }).then((dataUrl) => {
19484
+ triggerBase64Download(dataUrl, fileName);
19485
+ }).catch((e) => {
19486
+ console.error("Could not parse the html: ", e);
19487
+ });
19491
19488
  };
19492
19489
  //#endregion
19493
19490
  //#region src/components/line-chart/utils/line-chart-utils.ts
@@ -20432,7 +20429,9 @@ var formatAxisLabelNumbers = (tickValue, ticks) => {
20432
20429
  var getLineChartAxis = (options, axisType, state, currentScales, i = 0) => {
20433
20430
  const axisData = currentScales || options.axes[axisType][0] || {};
20434
20431
  const stateAxis = state?.axes.filter((axis) => axis?.id?.startsWith(axisType))[i];
20435
- const ticksConfigFromProps = options?.scales?.[`${i === 0 ? axisType : axisType + i}`]?.ticks;
20432
+ const axisKey = `${i === 0 ? axisType : axisType + i}`;
20433
+ const ticksConfigFromProps = options?.scales?.[axisKey]?.ticks;
20434
+ const titleConfigFromProps = options?.scales?.[axisKey]?.title;
20436
20435
  const { additionalAxesOptions } = options;
20437
20436
  const getTicks = () => {
20438
20437
  const isLogarithmic = additionalAxesOptions?.chartScaleType === ScaleType.Logarithmic;
@@ -20444,7 +20443,10 @@ var getLineChartAxis = (options, axisType, state, currentScales, i = 0) => {
20444
20443
  callback: ticksFormattingCallback,
20445
20444
  includeBounds: false,
20446
20445
  ...ticksConfigFromProps,
20447
- font: { size: 12 }
20446
+ font: {
20447
+ size: 12,
20448
+ ...ticksConfigFromProps?.font
20449
+ }
20448
20450
  };
20449
20451
  };
20450
20452
  return {
@@ -20460,7 +20462,12 @@ var getLineChartAxis = (options, axisType, state, currentScales, i = 0) => {
20460
20462
  title: {
20461
20463
  display: axisData.label?.length,
20462
20464
  text: axisData.label,
20463
- padding: 0
20465
+ padding: 0,
20466
+ ...titleConfigFromProps,
20467
+ font: {
20468
+ size: 12,
20469
+ ...titleConfigFromProps?.font
20470
+ }
20464
20471
  },
20465
20472
  ticks: getTicks(),
20466
20473
  grid: { ...axisData.gridLines }
@@ -38437,9 +38444,11 @@ var getBarChartAxis = ({ chart, axisType = AxisType.X, currentScale, i }) => {
38437
38444
  const getReverse = () => {
38438
38445
  return axisType === (isDirectionVertical ? AxisType.Y : AxisType.X) ? options?.additionalAxesOptions?.reverse : false;
38439
38446
  };
38447
+ const axisKey = `${i === 0 ? axisType : axisType + i}`;
38448
+ const titleConfigFromProps = options?.scales?.[axisKey]?.title;
38440
38449
  const getTicks = () => {
38441
38450
  const additionalAxesOptions = options?.additionalAxesOptions;
38442
- const ticksConfigFromProps = options?.scales?.[`${i === 0 ? axisType : axisType + i}`]?.ticks;
38451
+ const ticksConfigFromProps = options?.scales?.[axisKey]?.ticks;
38443
38452
  const isLogarithmic = isDirectionCompatibleWithAxisType && additionalAxesOptions?.chartScaleType === ScaleType.Logarithmic;
38444
38453
  const ticksFormattingCallback = (tick, _, ticks) => {
38445
38454
  return isLogarithmic ? LOGARITHMIC_STEPS.includes(Number(tick)) ? formatAxisLabelNumbers(tick, ticks) : "" : formatAxisLabelNumbers(tick, ticks);
@@ -38448,7 +38457,10 @@ var getBarChartAxis = ({ chart, axisType = AxisType.X, currentScale, i }) => {
38448
38457
  ...!isLogarithmic ? { stepSize: axisData.stepSize ?? (axisType === AxisType.Y ? additionalAxesOptions?.stepSize : null) } : {},
38449
38458
  includeBounds: false,
38450
38459
  ...ticksConfigFromProps,
38451
- font: { size: 12 }
38460
+ font: {
38461
+ size: 12,
38462
+ ...ticksConfigFromProps?.font
38463
+ }
38452
38464
  };
38453
38465
  if (additionalAxesOptions?.chartScaleType === ScaleType.Logarithmic) ticks.callback = ticksFormattingCallback;
38454
38466
  return ticks;
@@ -38465,7 +38477,12 @@ var getBarChartAxis = ({ chart, axisType = AxisType.X, currentScale, i }) => {
38465
38477
  title: {
38466
38478
  display: axisData?.label?.length || axisData?.unit?.length,
38467
38479
  text: axisData?.label || axisData?.unit,
38468
- padding: 0
38480
+ padding: 0,
38481
+ ...titleConfigFromProps,
38482
+ font: {
38483
+ size: 12,
38484
+ ...titleConfigFromProps?.font
38485
+ }
38469
38486
  },
38470
38487
  ticks: getTicks(),
38471
38488
  grid: { ...grid },
@@ -38887,6 +38904,8 @@ var getScatterChartAxis = ({ options, axisType = AxisType.X, currentScale }) =>
38887
38904
  const axisData = currentScale || options?.axes?.[axisType]?.[0];
38888
38905
  const isDirectionCompatibleWithAxisType = isDirectionVertical && axisType === AxisType.Y || !isDirectionVertical && axisType === AxisType.X;
38889
38906
  const grid = axisData?.gridLines || {};
38907
+ const ticksConfigFromProps = options?.scales?.[axisType]?.ticks;
38908
+ const titleConfigFromProps = options?.scales?.[axisType]?.title;
38890
38909
  const getReverse = () => {
38891
38910
  return axisType === (isDirectionVertical ? AxisType.Y : AxisType.X) ? options?.additionalAxesOptions?.reverse : false;
38892
38911
  };
@@ -38895,7 +38914,11 @@ var getScatterChartAxis = ({ options, axisType = AxisType.X, currentScale }) =>
38895
38914
  return {
38896
38915
  stepSize: axisData?.stepSize ?? (axisType === AxisType.Y ? additionalAxesOptions?.stepSize : void 0),
38897
38916
  includeBounds: false,
38898
- font: { size: 12 }
38917
+ ...ticksConfigFromProps,
38918
+ font: {
38919
+ size: 12,
38920
+ ...ticksConfigFromProps?.font
38921
+ }
38899
38922
  };
38900
38923
  };
38901
38924
  return {
@@ -38910,7 +38933,12 @@ var getScatterChartAxis = ({ options, axisType = AxisType.X, currentScale }) =>
38910
38933
  title: {
38911
38934
  display: !!axisData?.label?.length || !!axisData?.unit?.length,
38912
38935
  text: axisData?.label || axisData?.unit,
38913
- padding: 0
38936
+ padding: 0,
38937
+ ...titleConfigFromProps,
38938
+ font: {
38939
+ size: 12,
38940
+ ...titleConfigFromProps?.font
38941
+ }
38914
38942
  },
38915
38943
  ticks: getTicks(),
38916
38944
  grid: { ...grid }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/charts-library",
3
- "version": "5.11.1-beta-1",
3
+ "version": "5.12.0",
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": {