@oliasoft-open-source/charts-library 9.1.0-beta-1 → 9.1.0-beta-3
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 +90 -20
- package/dist/src/components/line-chart/constants/default-translations.d.ts +1 -0
- package/dist/src/components/line-chart/controls/axes-options/axes-options-interfaces.d.ts +1 -0
- package/dist/src/components/line-chart/controls/controls-interfaces.d.ts +1 -0
- package/dist/src/components/line-chart/controls/controls.d.ts +1 -1
- package/dist/src/components/line-chart/hooks/use-chart-plugins.d.ts +3 -1
- package/dist/src/components/line-chart/plugins/equal-scale-plugin.d.ts +1 -1
- package/dist/src/components/line-chart/plugins/line-chart.minor-gridlines-plugin.d.ts +4 -5
- package/dist/src/components/line-chart/state/helpers.d.ts +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -33200,7 +33200,17 @@ var getMinorTickPositions = (majorTickPositions, scale) => {
|
|
|
33200
33200
|
return parseFloat(minorTickPosition?.toFixed(1));
|
|
33201
33201
|
})?.filter((position) => isValidPosition(position, sortedMajorTickPositions, scale));
|
|
33202
33202
|
};
|
|
33203
|
-
var
|
|
33203
|
+
var getEqualScaleMinorTicks = (scale, majorPositions, step) => {
|
|
33204
|
+
const positions = [];
|
|
33205
|
+
const first = Math.ceil(scale.min / step);
|
|
33206
|
+
const last = Math.floor(scale.max / step);
|
|
33207
|
+
for (let index = first; index <= last; index++) {
|
|
33208
|
+
const position = scale.getPixelForValue(index * step);
|
|
33209
|
+
if (isValidPosition(position, majorPositions, scale) && !majorPositions.some((major) => Math.abs(major - position) < .1)) positions.push(position);
|
|
33210
|
+
}
|
|
33211
|
+
return positions;
|
|
33212
|
+
};
|
|
33213
|
+
var drawMinorTicksForScale = (scale, sharedStep) => {
|
|
33204
33214
|
const { chart, ctx } = scale ?? {};
|
|
33205
33215
|
if (!ctx || ctx?.canvas === null) return;
|
|
33206
33216
|
const config = chart?.config;
|
|
@@ -33208,7 +33218,7 @@ var drawMinorTicksForScale = (scale) => {
|
|
|
33208
33218
|
if (config?.options?.indexAxis === scale?.axis) return;
|
|
33209
33219
|
const isHorizontal = scale?.axis === AxisType.X;
|
|
33210
33220
|
const majorTickPositions = scale?.ticks?.map((_, index) => scale?.getPixelForTick(index))?.sort((a, b) => a - b);
|
|
33211
|
-
const minorTickPositions = getMinorTickPositions(majorTickPositions, scale);
|
|
33221
|
+
const minorTickPositions = sharedStep ? getEqualScaleMinorTicks(scale, majorTickPositions, sharedStep) : getMinorTickPositions(majorTickPositions, scale);
|
|
33212
33222
|
ctx?.save?.();
|
|
33213
33223
|
ctx.strokeStyle = config?._config?.options?.scales?.[scale.id]?.grid?.color || "rgba(0,0,0,0.06)";
|
|
33214
33224
|
ctx.lineWidth = .5;
|
|
@@ -33229,9 +33239,16 @@ var drawMinorTicksForScale = (scale) => {
|
|
|
33229
33239
|
};
|
|
33230
33240
|
var chartMinorGridlinesPlugin = {
|
|
33231
33241
|
id: "minorGridlines",
|
|
33232
|
-
beforeDatasetsDraw: (chart) => {
|
|
33233
|
-
const { scales } = chart
|
|
33234
|
-
|
|
33242
|
+
beforeDatasetsDraw: (chart, _args, { equalScale }) => {
|
|
33243
|
+
const { scales } = chart;
|
|
33244
|
+
const { x, y } = scales;
|
|
33245
|
+
let sharedStep;
|
|
33246
|
+
if (equalScale && Object.keys(scales).length === 2 && x?.type === "linear" && y?.type === "linear") {
|
|
33247
|
+
const majorSteps = [x, y].map((scale) => getLargestMajorTickWidth(scale.ticks.map(({ value }) => value)));
|
|
33248
|
+
const step = Math.min(...majorSteps) / MINOR_TICKS_PER_MAJOR;
|
|
33249
|
+
if (Number.isFinite(step) && step > 0) sharedStep = step;
|
|
33250
|
+
}
|
|
33251
|
+
Object.values(scales).forEach((scale) => drawMinorTicksForScale(scale, sharedStep));
|
|
33235
33252
|
}
|
|
33236
33253
|
};
|
|
33237
33254
|
// src/components/common/helpers/chart-consts.ts
|
|
@@ -34108,10 +34125,10 @@ var validateAxes = (axes) => {
|
|
|
34108
34125
|
};
|
|
34109
34126
|
// src/components/line-chart/state/helpers.ts
|
|
34110
34127
|
var RANGE_GAP = 1;
|
|
34111
|
-
var getInitAxes = ({ chartRef, state }) => {
|
|
34128
|
+
var getInitAxes = ({ chartRef, state, useCurrentBounds = false }) => {
|
|
34112
34129
|
const chart = chartRef.current;
|
|
34113
34130
|
if (!chart) return [];
|
|
34114
|
-
const initScales = chart
|
|
34131
|
+
const initScales = useCurrentBounds ? chart.scales : chart.getInitialScaleBounds() ?? {};
|
|
34115
34132
|
return Object.entries(initScales).map(([id, { min = "", max = "" }]) => {
|
|
34116
34133
|
let adjustedMin = Number(min);
|
|
34117
34134
|
let adjustedMax = Number(max);
|
|
@@ -34129,7 +34146,9 @@ var getInitAxes = ({ chartRef, state }) => {
|
|
|
34129
34146
|
};
|
|
34130
34147
|
// src/components/line-chart/controls/axes-options/axes-options.tsx
|
|
34131
34148
|
var AxesOptionsPopover = (optionsPopover) => {
|
|
34132
|
-
const { state, controlsAxesLabels, onUpdateAxes, onResetAxes, onUpdateEdited, depthType, translations, close, chartRef, onToggleEqualScale } = optionsPopover ?? {};
|
|
34149
|
+
const { state, controlsAxesLabels, onUpdateAxes, onResetAxes, onUpdateEdited, depthType, translations, close, chartRef, onToggleEqualScale, onAxesUpdate } = optionsPopover ?? {};
|
|
34150
|
+
const canToggleEqualScale = !!onToggleEqualScale;
|
|
34151
|
+
const equalScaleEnabled = canToggleEqualScale && !!state.equalScaleEnabled;
|
|
34133
34152
|
const [formState, setFormState] = useState({
|
|
34134
34153
|
localAxes: getInitAxes({
|
|
34135
34154
|
chartRef,
|
|
@@ -34138,6 +34157,29 @@ var AxesOptionsPopover = (optionsPopover) => {
|
|
|
34138
34157
|
depthType: depthType?.selectedDepthType,
|
|
34139
34158
|
edited: state.edited
|
|
34140
34159
|
});
|
|
34160
|
+
useEffect(() => {
|
|
34161
|
+
if (!canToggleEqualScale) return;
|
|
34162
|
+
const updateBounds = () => {
|
|
34163
|
+
setFormState((previous) => ({
|
|
34164
|
+
...previous,
|
|
34165
|
+
localAxes: getInitAxes({
|
|
34166
|
+
chartRef,
|
|
34167
|
+
state,
|
|
34168
|
+
useCurrentBounds: true
|
|
34169
|
+
})
|
|
34170
|
+
}));
|
|
34171
|
+
};
|
|
34172
|
+
onAxesUpdate.current = updateBounds;
|
|
34173
|
+
updateBounds();
|
|
34174
|
+
return () => {
|
|
34175
|
+
onAxesUpdate.current = null;
|
|
34176
|
+
};
|
|
34177
|
+
}, [
|
|
34178
|
+
canToggleEqualScale,
|
|
34179
|
+
chartRef,
|
|
34180
|
+
state,
|
|
34181
|
+
onAxesUpdate
|
|
34182
|
+
]);
|
|
34141
34183
|
const { errors, valid } = validateAxes(formState.localAxes);
|
|
34142
34184
|
const onEditValue = ({ name, value, id }) => {
|
|
34143
34185
|
setFormState((prevState) => ({
|
|
@@ -34164,6 +34206,10 @@ var AxesOptionsPopover = (optionsPopover) => {
|
|
|
34164
34206
|
};
|
|
34165
34207
|
const onDone = (e) => {
|
|
34166
34208
|
e.preventDefault();
|
|
34209
|
+
if (equalScaleEnabled) {
|
|
34210
|
+
close?.();
|
|
34211
|
+
return;
|
|
34212
|
+
}
|
|
34167
34213
|
if (valid) {
|
|
34168
34214
|
onUpdateAxes({ axes: formState.localAxes });
|
|
34169
34215
|
close?.();
|
|
@@ -34197,6 +34243,11 @@ var AxesOptionsPopover = (optionsPopover) => {
|
|
|
34197
34243
|
onChange: onToggleEqualScale
|
|
34198
34244
|
})
|
|
34199
34245
|
}),
|
|
34246
|
+
equalScaleEnabled && /* @__PURE__ */ jsx(Text, {
|
|
34247
|
+
small: true,
|
|
34248
|
+
muted: true,
|
|
34249
|
+
children: translations.equalAxisScaleReadOnly
|
|
34250
|
+
}),
|
|
34200
34251
|
formState.localAxes.map((axis) => {
|
|
34201
34252
|
const axisLabel = controlsAxesLabels.find((el) => el.id === axis.id)?.label || startCase(axis.id);
|
|
34202
34253
|
const axisErrors = errors.find((err) => err.id === axis.id);
|
|
@@ -34209,6 +34260,7 @@ var AxesOptionsPopover = (optionsPopover) => {
|
|
|
34209
34260
|
/* @__PURE__ */ jsx(NumberInput, {
|
|
34210
34261
|
name: "min",
|
|
34211
34262
|
value: axis.min,
|
|
34263
|
+
disabled: equalScaleEnabled,
|
|
34212
34264
|
error: axisErrors?.min?.[0] ? translations[axisErrors.min[0]] : null,
|
|
34213
34265
|
width: "100%",
|
|
34214
34266
|
onChange: (evt) => onEditValue({
|
|
@@ -34222,6 +34274,7 @@ var AxesOptionsPopover = (optionsPopover) => {
|
|
|
34222
34274
|
/* @__PURE__ */ jsx(NumberInput, {
|
|
34223
34275
|
name: "max",
|
|
34224
34276
|
value: axis.max,
|
|
34277
|
+
disabled: equalScaleEnabled,
|
|
34225
34278
|
error: axisErrors?.max?.[0] ? translations[axisErrors.max[0]] : null,
|
|
34226
34279
|
width: "100%",
|
|
34227
34280
|
onChange: (evt) => onEditValue({
|
|
@@ -34233,6 +34286,7 @@ var AxesOptionsPopover = (optionsPopover) => {
|
|
|
34233
34286
|
}),
|
|
34234
34287
|
axis.unit ? /* @__PURE__ */ jsx(Select, {
|
|
34235
34288
|
name: "selectedUnit",
|
|
34289
|
+
disabled: equalScaleEnabled,
|
|
34236
34290
|
options: typeof axis.unit !== "string" ? axis.unit.options : [],
|
|
34237
34291
|
value: typeof axis.unit !== "string" ? axis.unit.selectedUnit : void 0,
|
|
34238
34292
|
onChange: (e) => onEditUnit({
|
|
@@ -34271,7 +34325,7 @@ var AxesOptionsPopover = (optionsPopover) => {
|
|
|
34271
34325
|
small: true,
|
|
34272
34326
|
colored: true,
|
|
34273
34327
|
label: translations.done,
|
|
34274
|
-
disabled: !valid || !formState.edited
|
|
34328
|
+
disabled: !equalScaleEnabled && (!valid || !formState.edited)
|
|
34275
34329
|
}),
|
|
34276
34330
|
/* @__PURE__ */ jsx(Button, {
|
|
34277
34331
|
small: true,
|
|
@@ -34314,9 +34368,9 @@ var AxesOptions = (optionsPopover) => {
|
|
|
34314
34368
|
});
|
|
34315
34369
|
};
|
|
34316
34370
|
// src/components/line-chart/controls/controls.tsx
|
|
34317
|
-
var Controls = ({ table, headerComponent, subheaderComponent, chartRef, state, options, dispatch, translations, controlsPortalId }) => {
|
|
34371
|
+
var Controls = ({ table, headerComponent, subheaderComponent, chartRef, onAxesUpdate, state, options, dispatch, translations, controlsPortalId }) => {
|
|
34318
34372
|
const { enableDragPoints, lineEnabled, panEnabled, pointsEnabled, showTable, zoomEnabled, enableDragAnnotation } = state;
|
|
34319
|
-
const { dragData, depthType, annotations } = options;
|
|
34373
|
+
const { dragData, depthType, annotations, additionalAxesOptions, axes, scales } = options;
|
|
34320
34374
|
const { onToggleLine, onTogglePan, onTogglePoints, onToggleTable, onToggleZoom, onToggleDragPoints, onToggleDragAnnotation, onDisableDragOptions } = useToggleHandlers(dispatch);
|
|
34321
34375
|
const { handleDownload, controlsAxesLabels, onResetAxes, onUpdateAxes, onUpdateEdited } = useChartFunctions({
|
|
34322
34376
|
chartRef,
|
|
@@ -34366,6 +34420,10 @@ var Controls = ({ table, headerComponent, subheaderComponent, chartRef, state, o
|
|
|
34366
34420
|
translations,
|
|
34367
34421
|
zoomEnabled
|
|
34368
34422
|
]);
|
|
34423
|
+
const canToggleEqualScale = additionalAxesOptions.allowEqualScale && axes.x.length === 1 && axes.y.length === 1 && (scales?.x?.type ?? additionalAxesOptions.chartScaleType) === "linear" && (scales?.y?.type ?? additionalAxesOptions.chartScaleType) === "linear";
|
|
34424
|
+
const handleToggleEqualScale = () => {
|
|
34425
|
+
dispatch({ type: TOGGLE_EQUAL_SCALE });
|
|
34426
|
+
};
|
|
34369
34427
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
34370
34428
|
className: controls_module_default.controls,
|
|
34371
34429
|
children: [
|
|
@@ -34381,6 +34439,7 @@ var Controls = ({ table, headerComponent, subheaderComponent, chartRef, state, o
|
|
|
34381
34439
|
ref: measureRef,
|
|
34382
34440
|
children: [!showTable && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(AxesOptions, {
|
|
34383
34441
|
chartRef,
|
|
34442
|
+
onAxesUpdate,
|
|
34384
34443
|
state,
|
|
34385
34444
|
controlsAxesLabels,
|
|
34386
34445
|
onUpdateAxes,
|
|
@@ -34388,9 +34447,7 @@ var Controls = ({ table, headerComponent, subheaderComponent, chartRef, state, o
|
|
|
34388
34447
|
onUpdateEdited,
|
|
34389
34448
|
depthType,
|
|
34390
34449
|
translations,
|
|
34391
|
-
onToggleEqualScale:
|
|
34392
|
-
dispatch({ type: "TOGGLE_EQUAL_SCALE" });
|
|
34393
|
-
} : void 0
|
|
34450
|
+
onToggleEqualScale: canToggleEqualScale ? handleToggleEqualScale : void 0
|
|
34394
34451
|
}), isNarrow ? /* @__PURE__ */ jsx(Menu, { menu: {
|
|
34395
34452
|
placement: "bottom-end",
|
|
34396
34453
|
sections: [
|
|
@@ -36504,6 +36561,7 @@ var useChartOptions = ({ chartRef, state, options, dispatch, generatedDatasets,
|
|
|
36504
36561
|
const lineMarkersAnnotation = options?.annotations?.lineMarkersAnnotation ?? {};
|
|
36505
36562
|
const lineMarkersPluginEnabled = Boolean(options?.plugins?.lineMarkersPlugin?.enabled ?? lineMarkersAnnotation?.enabled);
|
|
36506
36563
|
const plugins = useMemo(() => ({
|
|
36564
|
+
minorGridlines: { equalScale: !!options.additionalAxesOptions.allowEqualScale && !!state.equalScaleEnabled },
|
|
36507
36565
|
equalAxisScale: { enabled: !!options.additionalAxesOptions.allowEqualScale && !!state.equalScaleEnabled },
|
|
36508
36566
|
datalabels,
|
|
36509
36567
|
annotationDraggerPlugin: { enabled: state?.enableDragAnnotation },
|
|
@@ -36629,13 +36687,17 @@ var getEqualScaleRanges = (x, y, width, height) => {
|
|
|
36629
36687
|
* Fits the requested viewport after layout, when the actual plot dimensions are available.
|
|
36630
36688
|
* Temporary bounds are restored so resizing and toggling do not accumulate extra padding.
|
|
36631
36689
|
*/
|
|
36632
|
-
var createEqualScalePlugin = () => {
|
|
36690
|
+
var createEqualScalePlugin = (onAxesUpdate) => {
|
|
36633
36691
|
let fitting = false;
|
|
36634
36692
|
return {
|
|
36635
36693
|
id: "equalAxisScale",
|
|
36636
36694
|
afterUpdate(chart, _args, { enabled }) {
|
|
36695
|
+
if (fitting) return;
|
|
36637
36696
|
const { x, y } = chart.scales;
|
|
36638
|
-
if (!enabled ||
|
|
36697
|
+
if (!enabled || Object.keys(chart.scales).length !== 2 || x?.type !== "linear" || y?.type !== "linear") {
|
|
36698
|
+
onAxesUpdate();
|
|
36699
|
+
return;
|
|
36700
|
+
}
|
|
36639
36701
|
const baseX = {
|
|
36640
36702
|
min: x.min,
|
|
36641
36703
|
max: x.max
|
|
@@ -36676,11 +36738,12 @@ var createEqualScalePlugin = () => {
|
|
|
36676
36738
|
Object.assign(chart.scales.y.options, originalY);
|
|
36677
36739
|
fitting = false;
|
|
36678
36740
|
}
|
|
36741
|
+
onAxesUpdate();
|
|
36679
36742
|
}
|
|
36680
36743
|
};
|
|
36681
36744
|
};
|
|
36682
36745
|
// src/components/line-chart/hooks/use-chart-plugins.ts
|
|
36683
|
-
var useChartPlugins = ({ options, resetZoom }) => {
|
|
36746
|
+
var useChartPlugins = ({ options, resetZoom, onAxesUpdate }) => {
|
|
36684
36747
|
const { graph, legend } = options;
|
|
36685
36748
|
const handleDoubleClick = useCallback((_, args) => {
|
|
36686
36749
|
const { event } = args;
|
|
@@ -36693,7 +36756,9 @@ var useChartPlugins = ({ options, resetZoom }) => {
|
|
|
36693
36756
|
return useMemo(() => {
|
|
36694
36757
|
return [
|
|
36695
36758
|
...getPlugins(graph, legend),
|
|
36696
|
-
createEqualScalePlugin()
|
|
36759
|
+
createEqualScalePlugin(() => {
|
|
36760
|
+
onAxesUpdate.current?.();
|
|
36761
|
+
}),
|
|
36697
36762
|
{
|
|
36698
36763
|
id: "customEventCatcher",
|
|
36699
36764
|
beforeEvent: handleDoubleClick
|
|
@@ -36702,7 +36767,8 @@ var useChartPlugins = ({ options, resetZoom }) => {
|
|
|
36702
36767
|
}, [
|
|
36703
36768
|
graph,
|
|
36704
36769
|
handleDoubleClick,
|
|
36705
|
-
legend
|
|
36770
|
+
legend,
|
|
36771
|
+
onAxesUpdate
|
|
36706
36772
|
]);
|
|
36707
36773
|
};
|
|
36708
36774
|
// src/components/line-chart/hooks/use-chart-state.ts
|
|
@@ -38198,6 +38264,7 @@ var defaultTranslations = /* @__PURE__ */ function(defaultTranslations) {
|
|
|
38198
38264
|
defaultTranslations["axesOptions"] = "Axes options";
|
|
38199
38265
|
defaultTranslations["resetAxes"] = "Reset Axes";
|
|
38200
38266
|
defaultTranslations["equalAxisScale"] = "Equal X/Y scale (1:1)";
|
|
38267
|
+
defaultTranslations["equalAxisScaleReadOnly"] = "Turn off equal scaling to edit axis limits.";
|
|
38201
38268
|
defaultTranslations["done"] = "Done";
|
|
38202
38269
|
defaultTranslations["downloadAsPNG"] = "Download as PNG";
|
|
38203
38270
|
defaultTranslations["showChart"] = "Show chart";
|
|
@@ -38690,6 +38757,7 @@ var Legend = ({ chartRef, legendConfig, persistenceId }) => {
|
|
|
38690
38757
|
Chart$1.register(LinearScale, PointElement, LineElement, CategoryScale, LogarithmicScale, TimeScale, TimeSeriesScale, plugin_legend, plugin_tooltip, plugin_title, index, plugin$1, import_chartjs_plugin_dragdata_min.default, plugin, annotation, chartAreaTextPlugin, annotationDraggerPlugin, ellipsisAnnotationPlugin, calloutConnectorPlugin, lineMarkersPlugin);
|
|
38691
38758
|
var LineChart = (props) => {
|
|
38692
38759
|
setDefaultTheme();
|
|
38760
|
+
const onAxesUpdate = useRef(null);
|
|
38693
38761
|
const chartRef = useRef(null);
|
|
38694
38762
|
const setChartRef = useCallback((chartInstance) => {
|
|
38695
38763
|
chartRef.current = chartInstance ?? null;
|
|
@@ -38732,7 +38800,8 @@ var LineChart = (props) => {
|
|
|
38732
38800
|
});
|
|
38733
38801
|
const usePlugins = useChartPlugins({
|
|
38734
38802
|
options,
|
|
38735
|
-
resetZoom
|
|
38803
|
+
resetZoom,
|
|
38804
|
+
onAxesUpdate
|
|
38736
38805
|
});
|
|
38737
38806
|
return /* @__PURE__ */ jsxs("div", {
|
|
38738
38807
|
className: getClassName(chartStyling, line_chart_module_default),
|
|
@@ -38749,6 +38818,7 @@ var LineChart = (props) => {
|
|
|
38749
38818
|
headerComponent,
|
|
38750
38819
|
subheaderComponent,
|
|
38751
38820
|
chartRef,
|
|
38821
|
+
onAxesUpdate,
|
|
38752
38822
|
state,
|
|
38753
38823
|
options,
|
|
38754
38824
|
dispatch,
|
|
@@ -6,6 +6,7 @@ export declare enum defaultTranslations {
|
|
|
6
6
|
axesOptions = "Axes options",
|
|
7
7
|
resetAxes = "Reset Axes",
|
|
8
8
|
equalAxisScale = "Equal X/Y scale (1:1)",
|
|
9
|
+
equalAxisScaleReadOnly = "Turn off equal scaling to edit axis limits.",
|
|
9
10
|
done = "Done",
|
|
10
11
|
downloadAsPNG = "Download as PNG",
|
|
11
12
|
showChart = "Show chart",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IControls } from './controls-interfaces';
|
|
3
|
-
declare const Controls: ({ table, headerComponent, subheaderComponent, chartRef, state, options, dispatch, translations, controlsPortalId, }: IControls) => React.JSX.Element;
|
|
3
|
+
declare const Controls: ({ table, headerComponent, subheaderComponent, chartRef, onAxesUpdate, state, options, dispatch, translations, controlsPortalId, }: IControls) => React.JSX.Element;
|
|
4
4
|
export default Controls;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
1
2
|
import { ILineChartOptions } from '../line-chart.interface';
|
|
2
3
|
interface IUseChartPlugins {
|
|
3
4
|
options: ILineChartOptions;
|
|
4
5
|
resetZoom: () => void;
|
|
6
|
+
onAxesUpdate: RefObject<(() => void) | null>;
|
|
5
7
|
}
|
|
6
|
-
export declare const useChartPlugins: ({ options, resetZoom }: IUseChartPlugins) => any[];
|
|
8
|
+
export declare const useChartPlugins: ({ options, resetZoom, onAxesUpdate }: IUseChartPlugins) => any[];
|
|
7
9
|
export {};
|
|
@@ -3,6 +3,6 @@ import type { Plugin } from 'chart.js';
|
|
|
3
3
|
* Fits the requested viewport after layout, when the actual plot dimensions are available.
|
|
4
4
|
* Temporary bounds are restored so resizing and toggling do not accumulate extra padding.
|
|
5
5
|
*/
|
|
6
|
-
export declare const createEqualScalePlugin: () => Plugin<'line', {
|
|
6
|
+
export declare const createEqualScalePlugin: (onAxesUpdate: () => void) => Plugin<'line', {
|
|
7
7
|
enabled: boolean;
|
|
8
8
|
}>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Scale, Plugin, ChartType } from 'chart.js';
|
|
2
2
|
export declare const getLargestMajorTickWidth: (majorTickPositions: number[]) => number;
|
|
3
3
|
export declare const isValidPosition: (minorTickPosition: number, majorTickPositions: number[], scale: Scale) => boolean;
|
|
4
4
|
export declare const getMinorTickPositions: (majorTickPositions: number[], scale: Scale) => number[];
|
|
5
|
-
export declare const chartMinorGridlinesPlugin: {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
5
|
+
export declare const chartMinorGridlinesPlugin: Plugin<ChartType, {
|
|
6
|
+
equalScale?: boolean;
|
|
7
|
+
}>;
|
|
@@ -4,8 +4,9 @@ import { TChart } from '../../common/common.interface.js';
|
|
|
4
4
|
export interface IGetInitAxes {
|
|
5
5
|
chartRef: RefObject<TChart | null>;
|
|
6
6
|
state: IState;
|
|
7
|
+
useCurrentBounds?: boolean;
|
|
7
8
|
}
|
|
8
|
-
export declare const getInitAxes: ({ chartRef, state }: IGetInitAxes) => {
|
|
9
|
+
export declare const getInitAxes: ({ chartRef, state, useCurrentBounds }: IGetInitAxes) => {
|
|
9
10
|
id: string;
|
|
10
11
|
min: number;
|
|
11
12
|
max: number;
|
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
|
+
"version": "9.1.0-beta-3",
|
|
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": {
|