@oliasoft-open-source/charts-library 3.5.4-beta-2 → 3.5.4-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 CHANGED
@@ -22275,12 +22275,9 @@ const initialState = ({ options, persistenceId }) => {
22275
22275
  } = options;
22276
22276
  const getStateAxesByType = (axisType, customAxesRange2) => {
22277
22277
  var _a2, _b2, _c2, _d2, _e2;
22278
- console.log("axisType", axisType);
22279
- console.log("axes", axes);
22280
22278
  if (!axes[axisType]) {
22281
22279
  return [];
22282
22280
  }
22283
- console.log("getStateAxesByType");
22284
22281
  if (((_a2 = axes[axisType]) == null ? void 0 : _a2.length) > 1) {
22285
22282
  return axes[axisType].map(
22286
22283
  (axisObj, index2) => {
@@ -22303,7 +22300,6 @@ const initialState = ({ options, persistenceId }) => {
22303
22300
  const customMin = (_b2 = customAxesRange2 == null ? void 0 : customAxesRange2[id]) == null ? void 0 : _b2.min;
22304
22301
  const customMax = (_c2 = customAxesRange2 == null ? void 0 : customAxesRange2[id]) == null ? void 0 : _c2.max;
22305
22302
  const unit = (_e2 = (_d2 = axes == null ? void 0 : axes[id]) == null ? void 0 : _d2[0]) == null ? void 0 : _e2.unit;
22306
- console.log("id", id);
22307
22303
  return [
22308
22304
  {
22309
22305
  id,
@@ -22318,7 +22314,6 @@ const initialState = ({ options, persistenceId }) => {
22318
22314
  const xStateAxes = getStateAxesByType(AxisType.X, customAxesRange);
22319
22315
  const yStateAxes = getStateAxesByType(AxisType.Y, customAxesRange);
22320
22316
  const stateAxes = [...xStateAxes, ...yStateAxes];
22321
- console.log("stateAxes", stateAxes);
22322
22317
  const {
22323
22318
  zoomEnabled,
22324
22319
  panEnabled,
@@ -23744,7 +23739,12 @@ const initializeFormState = ({
23744
23739
  axes = []
23745
23740
  }) => {
23746
23741
  return (initialAxesRanges == null ? void 0 : initialAxesRanges.map((initialAxisRange) => {
23742
+ console.log("initializeFormState");
23743
+ console.log("-------------------");
23747
23744
  const currentAxisRange = axes.find((a2) => a2.id === initialAxisRange.id);
23745
+ console.log("currentAxisRange", currentAxisRange);
23746
+ console.log("id: initialAxisRange.id,", initialAxisRange.id);
23747
+ console.log("-------------------");
23748
23748
  return {
23749
23749
  id: initialAxisRange.id,
23750
23750
  min: (currentAxisRange == null ? void 0 : currentAxisRange.min) ?? (initialAxisRange == null ? void 0 : initialAxisRange.min),
@@ -23794,7 +23794,13 @@ const reducer = (state, action) => {
23794
23794
  return produce(state, (draft) => {
23795
23795
  const { name: name2, value, id } = action.payload;
23796
23796
  const axis = draft.find((a2) => a2.id === id);
23797
- if (axis) {
23797
+ console.log("actionTypes.ValueUpdated:");
23798
+ console.log("1-----------------------");
23799
+ console.log("axis", axis);
23800
+ console.log("name", name2);
23801
+ console.log("value", value);
23802
+ if (axis && value) {
23803
+ console.log("2------------------------");
23798
23804
  axis[name2] = value;
23799
23805
  }
23800
23806
  });
@@ -24544,116 +24550,122 @@ const TextLabelPosition = {
24544
24550
  BOTTOM_CENTER: "bottom-center",
24545
24551
  BOTTOM_RIGHT: "bottom-right"
24546
24552
  };
24553
+ const defaultAxes$1 = (axes) => ({
24554
+ x: (axes == null ? void 0 : axes.x) || [{}],
24555
+ y: (axes == null ? void 0 : axes.y) || [{}]
24556
+ });
24557
+ const defaultAdditionalAxesOptions$1 = (options) => ({
24558
+ chartScaleType: (options == null ? void 0 : options.chartScaleType) || "linear",
24559
+ reverse: (options == null ? void 0 : options.reverse) || false,
24560
+ beginAtZero: (options == null ? void 0 : options.beginAtZero) ?? false,
24561
+ stepSize: options == null ? void 0 : options.stepSize,
24562
+ suggestedMin: options == null ? void 0 : options.suggestedMin,
24563
+ suggestedMax: options == null ? void 0 : options.suggestedMax,
24564
+ range: options == null ? void 0 : options.range,
24565
+ autoAxisPadding: (options == null ? void 0 : options.autoAxisPadding) ?? false
24566
+ });
24567
+ const defaultChartStyling$2 = (options) => ({
24568
+ width: options == null ? void 0 : options.width,
24569
+ height: options == null ? void 0 : options.height,
24570
+ maintainAspectRatio: (options == null ? void 0 : options.maintainAspectRatio) ?? false,
24571
+ staticChartHeight: (options == null ? void 0 : options.staticChartHeight) ?? false,
24572
+ performanceMode: (options == null ? void 0 : options.performanceMode) ?? true,
24573
+ squareAspectRatio: options == null ? void 0 : options.squareAspectRatio,
24574
+ layoutPadding: (options == null ? void 0 : options.layoutPadding) || {
24575
+ top: 0,
24576
+ bottom: 20,
24577
+ left: 0,
24578
+ right: 0
24579
+ }
24580
+ });
24581
+ const defaultTooltip$2 = (tooltip) => ({
24582
+ tooltips: (tooltip == null ? void 0 : tooltip.tooltips) ?? true,
24583
+ showLabelsInTooltips: (tooltip == null ? void 0 : tooltip.showLabelsInTooltips) ?? false,
24584
+ hideSimulationName: (tooltip == null ? void 0 : tooltip.hideSimulationName) ?? false
24585
+ });
24586
+ const defaultGraph$2 = (graph) => ({
24587
+ lineTension: (graph == null ? void 0 : graph.lineTension) ?? 0.01,
24588
+ spanGaps: (graph == null ? void 0 : graph.spanGaps) ?? false,
24589
+ showDataLabels: (graph == null ? void 0 : graph.showDataLabels) ?? false,
24590
+ showMinorGridlines: (graph == null ? void 0 : graph.showMinorGridlines) ?? false
24591
+ });
24592
+ const defaultAnnotations$1 = (annotations) => {
24593
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2;
24594
+ return {
24595
+ labelAnnotation: {
24596
+ showLabel: ((_a2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _a2.showLabel) ?? false,
24597
+ text: ((_b2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _b2.text) ?? "",
24598
+ position: ((_c2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _c2.position) ?? TextLabelPosition.BOTTOM_RIGHT,
24599
+ fontSize: ((_d2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _d2.fontSize) ?? 12,
24600
+ xOffset: ((_e2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _e2.xOffset) ?? 5,
24601
+ yOffset: ((_f2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _f2.yOffset) ?? 5,
24602
+ maxWidth: ((_g2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _g2.maxWidth) ?? 300,
24603
+ lineHeight: ((_h2 = annotations == null ? void 0 : annotations.labelAnnotation) == null ? void 0 : _h2.lineHeight) ?? 12
24604
+ },
24605
+ showAnnotations: (annotations == null ? void 0 : annotations.showAnnotations) ?? false,
24606
+ controlAnnotation: (annotations == null ? void 0 : annotations.controlAnnotation) ?? false,
24607
+ annotationsData: (annotations == null ? void 0 : annotations.annotationsData) ?? []
24608
+ };
24609
+ };
24610
+ const defaultLegend$2 = (legend2) => ({
24611
+ display: (legend2 == null ? void 0 : legend2.display) ?? true,
24612
+ position: (legend2 == null ? void 0 : legend2.position) ?? Position.BottomLeft,
24613
+ align: (legend2 == null ? void 0 : legend2.align) ?? AlignOptions.Center,
24614
+ customLegend: (legend2 == null ? void 0 : legend2.customLegend) ?? {
24615
+ customLegendPlugin: null,
24616
+ customLegendContainerID: ""
24617
+ },
24618
+ usePointStyle: (legend2 == null ? void 0 : legend2.usePointStyle) ?? true
24619
+ });
24620
+ const defaultChartOptions$2 = (options) => ({
24621
+ showPoints: (options == null ? void 0 : options.showPoints) ?? true,
24622
+ enableZoom: (options == null ? void 0 : options.enableZoom) ?? true,
24623
+ enablePan: (options == null ? void 0 : options.enablePan) ?? false,
24624
+ showLine: (options == null ? void 0 : options.showLine) ?? true,
24625
+ closeOnOutsideClick: (options == null ? void 0 : options.closeOnOutsideClick) ?? false
24626
+ });
24627
+ const defaultInteractions$2 = (interactions) => ({
24628
+ onLegendClick: interactions == null ? void 0 : interactions.onLegendClick,
24629
+ onHover: interactions == null ? void 0 : interactions.onHover,
24630
+ onUnhover: interactions == null ? void 0 : interactions.onUnhover,
24631
+ onAnimationComplete: interactions == null ? void 0 : interactions.onAnimationComplete
24632
+ });
24633
+ const defaultDragData$1 = (dragData) => ({
24634
+ enableDragData: (dragData == null ? void 0 : dragData.enableDragData) ?? false,
24635
+ showTooltip: (dragData == null ? void 0 : dragData.showTooltip) ?? true,
24636
+ roundPoints: (dragData == null ? void 0 : dragData.roundPoints) ?? true,
24637
+ dragX: (dragData == null ? void 0 : dragData.dragX) ?? true,
24638
+ dragY: (dragData == null ? void 0 : dragData.dragY) ?? true,
24639
+ onDragStart: dragData == null ? void 0 : dragData.onDragStart,
24640
+ onDrag: dragData == null ? void 0 : dragData.onDrag,
24641
+ onDragEnd: dragData == null ? void 0 : dragData.onDragEnd
24642
+ });
24547
24643
  const getDefaultProps$2 = (props) => {
24548
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2;
24549
- props.chart.options = props.chart.options || {};
24550
- props.chart.options.axes = props.chart.options.axes || {};
24551
- props.chart.options.additionalAxesOptions = props.chart.options.additionalAxesOptions || {};
24552
- props.chart.options.chartStyling = props.chart.options.chartStyling || {};
24553
- props.chart.options.tooltip = props.chart.options.tooltip || {};
24554
- props.chart.options.graph = props.chart.options.graph || {};
24555
- props.chart.options.annotations = props.chart.options.annotations || {};
24556
- props.chart.options.legend = props.chart.options.legend || {};
24557
- props.chart.options.legend.customLegend = props.chart.options.legend.customLegend || { customLegendPlugin: null, customLegendContainerID: "" };
24558
- props.chart.options.chartOptions = props.chart.options.chartOptions || {};
24559
- props.chart.options.interactions = props.chart.options.interactions || {};
24560
- props.chart.options.dragData = props.chart.options.dragData || {};
24561
- const chart2 = {
24562
- persistenceId: props.chart.persistenceId ?? "",
24563
- controlsPortalId: props.chart.controlsPortalId ?? null,
24564
- testId: props.chart.testId ?? null,
24565
- data: props.chart.data,
24644
+ const chart2 = (props == null ? void 0 : props.chart) || {};
24645
+ const options = (chart2 == null ? void 0 : chart2.options) || {};
24646
+ return {
24647
+ persistenceId: (chart2 == null ? void 0 : chart2.persistenceId) ?? "",
24648
+ controlsPortalId: (chart2 == null ? void 0 : chart2.controlsPortalId) ?? "",
24649
+ testId: (chart2 == null ? void 0 : chart2.testId) ?? null,
24650
+ data: chart2 == null ? void 0 : chart2.data,
24566
24651
  options: {
24567
- title: props.chart.options.title || "",
24568
- scales: props.chart.options.scales || {},
24569
- axes: {
24570
- x: props.chart.options.axes.x || [{}],
24571
- y: props.chart.options.axes.y || [{}]
24572
- },
24573
- additionalAxesOptions: {
24574
- chartScaleType: props.chart.options.additionalAxesOptions.chartScaleType || "linear",
24575
- reverse: props.chart.options.additionalAxesOptions.reverse || false,
24576
- beginAtZero: props.chart.options.additionalAxesOptions.beginAtZero || false,
24577
- stepSize: props.chart.options.additionalAxesOptions.stepSize,
24578
- suggestedMin: props.chart.options.additionalAxesOptions.suggestedMin,
24579
- suggestedMax: props.chart.options.additionalAxesOptions.suggestedMax,
24580
- range: props.chart.options.additionalAxesOptions.range,
24581
- autoAxisPadding: props.chart.options.additionalAxesOptions.autoAxisPadding ?? false
24582
- },
24583
- chartStyling: {
24584
- width: props.chart.options.chartStyling.width,
24585
- height: props.chart.options.chartStyling.height,
24586
- maintainAspectRatio: props.chart.options.chartStyling.maintainAspectRatio || false,
24587
- staticChartHeight: props.chart.options.chartStyling.staticChartHeight || false,
24588
- performanceMode: props.chart.options.chartStyling.performanceMode ?? true,
24589
- squareAspectRatio: props.chart.options.chartStyling.squareAspectRatio || false,
24590
- layoutPadding: props.chart.options.chartStyling.layoutPadding || {
24591
- top: 0,
24592
- bottom: 20,
24593
- left: 0,
24594
- right: 0
24595
- }
24596
- },
24597
- tooltip: {
24598
- tooltips: props.chart.options.tooltip.tooltips ?? true,
24599
- showLabelsInTooltips: props.chart.options.tooltip.showLabelsInTooltips || false,
24600
- hideSimulationName: props.chart.options.tooltip.hideSimulationName || false
24601
- },
24602
- graph: {
24603
- lineTension: props.chart.options.graph.lineTension || 0.01,
24604
- spanGaps: props.chart.options.graph.spanGaps || false,
24605
- showDataLabels: props.chart.options.graph.showDataLabels || false,
24606
- showMinorGridlines: props.chart.options.graph.showMinorGridlines || false
24607
- },
24608
- annotations: {
24609
- labelAnnotation: {
24610
- showLabel: ((_a2 = props.chart.options.annotations.labelAnnotation) == null ? void 0 : _a2.showLabel) ?? false,
24611
- text: ((_b2 = props.chart.options.annotations.labelAnnotation) == null ? void 0 : _b2.text) ?? "",
24612
- position: ((_c2 = props.chart.options.annotations.labelAnnotation) == null ? void 0 : _c2.position) ?? TextLabelPosition.BOTTOM_RIGHT,
24613
- fontSize: ((_d2 = props.chart.options.annotations.labelAnnotation) == null ? void 0 : _d2.fontSize) ?? 12,
24614
- xOffset: ((_e2 = props.chart.options.annotations.labelAnnotation) == null ? void 0 : _e2.xOffset) ?? 5,
24615
- yOffset: ((_f2 = props.chart.options.annotations.labelAnnotation) == null ? void 0 : _f2.yOffset) ?? 5,
24616
- maxWidth: ((_g2 = props.chart.options.annotations.labelAnnotation) == null ? void 0 : _g2.maxWidth) ?? 300,
24617
- lineHeight: ((_h2 = props.chart.options.annotations.labelAnnotation) == null ? void 0 : _h2.lineHeight) ?? 12
24618
- },
24619
- showAnnotations: props.chart.options.annotations.showAnnotations ?? false,
24620
- controlAnnotation: props.chart.options.annotations.controlAnnotation || false,
24621
- annotationsData: props.chart.options.annotations.annotationsData || []
24622
- },
24623
- legend: {
24624
- display: props.chart.options.legend.display ?? true,
24625
- position: props.chart.options.legend.position || "bottom-left",
24626
- align: props.chart.options.legend.align || "center",
24627
- customLegend: props.chart.options.legend.customLegend,
24628
- usePointStyle: props.chart.options.legend.usePointStyle ?? true
24629
- },
24630
- chartOptions: {
24631
- showPoints: props.chart.options.chartOptions.showPoints ?? true,
24632
- enableZoom: props.chart.options.chartOptions.enableZoom || true,
24633
- enablePan: props.chart.options.chartOptions.enablePan || false,
24634
- showLine: props.chart.options.chartOptions.showLine ?? true,
24635
- closeOnOutsideClick: props.chart.options.chartOptions.closeOnOutsideClick || false
24636
- },
24637
- interactions: {
24638
- onLegendClick: props.chart.options.interactions.onLegendClick,
24639
- onPointHover: (_i2 = props.chart.options.interactions) == null ? void 0 : _i2.onPointHover,
24640
- onPointUnhover: (_j2 = props.chart.options.interactions) == null ? void 0 : _j2.onPointUnhover,
24641
- onAnimationComplete: props.chart.options.interactions.onAnimationComplete
24642
- },
24643
- depthType: props.chart.options.depthType,
24644
- dragData: {
24645
- enableDragData: props.chart.options.dragData.enableDragData ?? false,
24646
- showTooltip: props.chart.options.dragData.showTooltip ?? true,
24647
- roundPoints: props.chart.options.dragData.roundPoints ?? true,
24648
- dragX: props.chart.options.dragData.dragX ?? true,
24649
- dragY: props.chart.options.dragData.dragY ?? true,
24650
- onDragStart: props.chart.options.dragData.onDragStart,
24651
- onDrag: props.chart.options.dragData.onDrag,
24652
- onDragEnd: props.chart.options.dragData.onDragEnd
24653
- }
24652
+ title: (options == null ? void 0 : options.title) ?? "",
24653
+ scales: (options == null ? void 0 : options.scales) ?? {},
24654
+ axes: defaultAxes$1(options == null ? void 0 : options.axes),
24655
+ additionalAxesOptions: defaultAdditionalAxesOptions$1(
24656
+ options == null ? void 0 : options.additionalAxesOptions
24657
+ ),
24658
+ chartStyling: defaultChartStyling$2(options == null ? void 0 : options.chartStyling),
24659
+ tooltip: defaultTooltip$2(options == null ? void 0 : options.tooltip),
24660
+ graph: defaultGraph$2(options == null ? void 0 : options.graph),
24661
+ annotations: defaultAnnotations$1(options == null ? void 0 : options.annotations),
24662
+ legend: defaultLegend$2(options == null ? void 0 : options.legend),
24663
+ chartOptions: defaultChartOptions$2(options == null ? void 0 : options.chartOptions),
24664
+ interactions: defaultInteractions$2(options == null ? void 0 : options.interactions),
24665
+ dragData: defaultDragData$1(options == null ? void 0 : options.dragData),
24666
+ depthType: (options == null ? void 0 : options.depthType) ?? {}
24654
24667
  }
24655
24668
  };
24656
- return chart2;
24657
24669
  };
24658
24670
  const DEFAULT_POINT_RADIUS = 2;
24659
24671
  const DEFAULT_HOVER_RADIUS = 5;
@@ -25425,6 +25437,7 @@ const useUpdateAxesRanges = (range, dispatch) => {
25425
25437
  const prevRange = useRef();
25426
25438
  const updateAxesRanges = useCallback(() => {
25427
25439
  if (range && isRangeValid(range) && !isEqual(range, prevRange.current)) {
25440
+ console.log("WRONG", range);
25428
25441
  const axes = Object.entries(range).map(([key, { min, max }]) => ({
25429
25442
  id: key,
25430
25443
  min: min ?? 0,
@@ -25446,7 +25459,6 @@ const useSaveInitialAxesRanges = (chartRef, axes, generatedDatasets, dispatch) =
25446
25459
  const saveInitialAxesRanges = useCallback(() => {
25447
25460
  if (chartRef && !isEqual(generatedDatasets, prevGeneratedDatasets.current)) {
25448
25461
  const initialAxesRanges = getAxesRangesFromChart(chartRef, axes);
25449
- console.log("initialAxesRanges", initialAxesRanges);
25450
25462
  dispatch({
25451
25463
  type: SAVE_INITIAL_AXES_RANGES,
25452
25464
  payload: { initialAxesRanges }