@oliasoft-open-source/charts-library 9.1.0-beta-3 → 9.1.0-beta-4

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
@@ -33650,9 +33650,10 @@ var storeChartStateInStorage = (state, persistenceId) => {
33650
33650
  Initial chart state for the line chart.
33651
33651
  */
33652
33652
  var initialState = ({ options, persistenceId }) => {
33653
- const { chartOptions: { enableZoom, enablePan, showPoints, showLine, enableDragAnnotation }, legend: { display }, dragData } = options;
33653
+ const { chartOptions: { enableZoom, enablePan, showPoints, showLine, enableDragAnnotation }, legend: { display }, dragData, additionalAxesOptions } = options;
33654
33654
  const { zoomEnabled, panEnabled, pointsEnabled, lineEnabled, legendEnabled, enableDragPoints, enableDragAnnotation: enableDragAnnotationStorage } = getChartStateFromStorage(persistenceId) || {};
33655
33655
  return {
33656
+ equalScaleEnabled: !!additionalAxesOptions.allowEqualScale && !!additionalAxesOptions.defaultEqualScaleEnabled,
33656
33657
  zoomEnabled: enableDragAnnotation ?? enableDragAnnotationStorage ? false : zoomEnabled ?? enableZoom,
33657
33658
  panEnabled: panEnabled ?? enablePan,
33658
33659
  pointsEnabled: pointsEnabled ?? showPoints,
@@ -34583,7 +34584,8 @@ var defaultAxes$2 = (axes) => {
34583
34584
  };
34584
34585
  };
34585
34586
  var defaultAdditionalAxesOptions$2 = (options) => ({
34586
- allowEqualScale: options?.allowEqualScale ?? false,
34587
+ allowEqualScale: options?.allowEqualScale ?? true,
34588
+ defaultEqualScaleEnabled: options?.defaultEqualScaleEnabled ?? false,
34587
34589
  chartScaleType: options?.chartScaleType || "linear",
34588
34590
  reverse: options?.reverse || false,
34589
34591
  beginAtZero: options?.beginAtZero ?? false,
@@ -36691,6 +36693,9 @@ var createEqualScalePlugin = (onAxesUpdate) => {
36691
36693
  let fitting = false;
36692
36694
  return {
36693
36695
  id: "equalAxisScale",
36696
+ beforeRender() {
36697
+ if (fitting) return false;
36698
+ },
36694
36699
  afterUpdate(chart, _args, { enabled }) {
36695
36700
  if (fitting) return;
36696
36701
  const { x, y } = chart.scales;
@@ -67,11 +67,13 @@ export interface ILineRange {
67
67
  /** LineChart scale defaults and per-axis range overrides. */
68
68
  export interface ILineChartAdditionalAxesOptions {
69
69
  /**
70
- * Offers a toggle for equal units per pixel on one pair of linear X/Y axes. Defaults to false.
70
+ * Offers a toggle for equal units per pixel on one pair of linear X/Y axes. Defaults to true.
71
71
  * Both axes must use the same physical units; no unit conversion is performed.
72
- * The toggle starts off and expands the requested viewport without changing the canvas shape.
72
+ * Equal scaling expands the requested viewport without changing the canvas shape.
73
73
  */
74
74
  allowEqualScale?: boolean;
75
+ /** Initial toggle value when allowEqualScale is true. Defaults to false; later changes do not reset user choice. */
76
+ defaultEqualScaleEnabled?: boolean;
75
77
  /** Scale family used when constructing axes. */
76
78
  chartScaleType?: 'linear' | 'logarithmic' | 'time' | 'timeseries';
77
79
  /** Reverses the Y scale direction. Does not change tooltip axis selection. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oliasoft-open-source/charts-library",
3
- "version": "9.1.0-beta-3",
3
+ "version": "9.1.0-beta-4",
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": {