@oliasoft-open-source/charts-library 4.3.0-beta-4 → 4.3.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.js CHANGED
@@ -26242,7 +26242,7 @@ const annotationDraggerPlugin = {
26242
26242
  };
26243
26243
  const typedScales = { x: scales.x, y: scales.y };
26244
26244
  let annotations = ((_d2 = (_c2 = chart2.options.plugins) == null ? void 0 : _c2.annotation) == null ? void 0 : _d2.annotations) ?? {};
26245
- if (!annotations)
26245
+ if (!chart2 && !annotations)
26246
26246
  return;
26247
26247
  let isDragging2 = false;
26248
26248
  let dragStartX, dragStartY;
@@ -26257,11 +26257,12 @@ const annotationDraggerPlugin = {
26257
26257
  };
26258
26258
  if (!canvas2.dataset.annotationDraggerInitialized && pluginOptions.enabled && hoveredAnnotationId) {
26259
26259
  canvas2.addEventListener(MouseEvents.MOUSEDOWN, (event) => {
26260
+ var _a3, _b3, _c3;
26260
26261
  handleAnnotationMouseDown(
26261
26262
  event,
26262
26263
  canvas2,
26263
26264
  typedScales,
26264
- annotations,
26265
+ (_c3 = (_b3 = (_a3 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a3.plugins) == null ? void 0 : _b3.annotation) == null ? void 0 : _c3.annotations,
26265
26266
  setDraggingState,
26266
26267
  chart2.hoveredAnnotationId
26267
26268
  );
@@ -39679,32 +39680,41 @@ const useBarChartConfig = (chartRef, chart2) => {
39679
39680
  [chartRef, chart2]
39680
39681
  );
39681
39682
  };
39683
+ const getStackedOptions = (axisType, { stacked, stackedX, stackedY }) => {
39684
+ if (axisType === AxisType.X) {
39685
+ return stackedX ?? stacked;
39686
+ } else if (axisType === AxisType.Y) {
39687
+ return stackedY ?? stacked;
39688
+ }
39689
+ return stacked;
39690
+ };
39682
39691
  const getBarChartAxis = ({
39683
39692
  chart: chart2,
39684
39693
  axisType = AxisType.X,
39685
39694
  currentScale,
39686
39695
  i: i2
39687
39696
  }) => {
39688
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2;
39689
- const isDirectionVertical = isVertical(chart2.options.direction);
39690
- const axisData = currentScale || ((_c2 = (_b2 = (_a2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a2.axes) == null ? void 0 : _b2[axisType]) == null ? void 0 : _c2[0]);
39697
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2;
39698
+ const { data, options } = chart2 ?? {};
39699
+ const isDirectionVertical = isVertical(options.direction);
39700
+ const axisData = currentScale || ((_b2 = (_a2 = options == null ? void 0 : options.axes) == null ? void 0 : _a2[axisType]) == null ? void 0 : _b2[0]);
39691
39701
  const isDirectionCompatibleWithAxisType = isDirectionVertical && axisType === AxisType.Y || !isDirectionVertical && axisType === AxisType.X;
39692
39702
  const grid = (axisData == null ? void 0 : axisData.gridLines) || {};
39693
39703
  const getScaleType = () => {
39694
- var _a3, _b3;
39695
- const scaleType = chart2.data.labels ? ScaleType.Category : ScaleType.Linear;
39704
+ var _a3;
39705
+ const scaleType = data.labels ? ScaleType.Category : ScaleType.Linear;
39696
39706
  const axisWithScale = isDirectionVertical ? AxisType.X : AxisType.Y;
39697
- return axisType === axisWithScale ? scaleType : (_b3 = (_a3 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a3.additionalAxesOptions) == null ? void 0 : _b3.chartScaleType;
39707
+ return axisType === axisWithScale ? scaleType : (_a3 = options == null ? void 0 : options.additionalAxesOptions) == null ? void 0 : _a3.chartScaleType;
39698
39708
  };
39699
39709
  const getReverse = () => {
39700
- var _a3, _b3;
39710
+ var _a3;
39701
39711
  const axisWithReverse = isDirectionVertical ? AxisType.Y : AxisType.X;
39702
- return axisType === axisWithReverse ? (_b3 = (_a3 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a3.additionalAxesOptions) == null ? void 0 : _b3.reverse : false;
39712
+ return axisType === axisWithReverse ? (_a3 = options == null ? void 0 : options.additionalAxesOptions) == null ? void 0 : _a3.reverse : false;
39703
39713
  };
39704
39714
  const getTicks = () => {
39705
- var _a3, _b3, _c3, _d3;
39706
- const additionalAxesOptions = (_a3 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _a3.additionalAxesOptions;
39707
- const ticksConfigFromProps = (_d3 = (_c3 = (_b3 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _b3.scales) == null ? void 0 : _c3[`${i2 === 0 ? axisType : axisType + i2}`]) == null ? void 0 : _d3.ticks;
39715
+ var _a3, _b3;
39716
+ const additionalAxesOptions = options == null ? void 0 : options.additionalAxesOptions;
39717
+ const ticksConfigFromProps = (_b3 = (_a3 = options == null ? void 0 : options.scales) == null ? void 0 : _a3[`${i2 === 0 ? axisType : axisType + i2}`]) == null ? void 0 : _b3.ticks;
39708
39718
  const isLogarithmic = isDirectionCompatibleWithAxisType && (additionalAxesOptions == null ? void 0 : additionalAxesOptions.chartScaleType) === ScaleType.Logarithmic;
39709
39719
  const ticksFormattingCallback = (tick, _2, ticks2) => {
39710
39720
  return isLogarithmic ? LOGARITHMIC_STEPS.includes(Number(tick)) ? formatAxisLabelNumbers(tick, ticks2) : "" : formatAxisLabelNumbers(tick, ticks2);
@@ -39729,14 +39739,14 @@ const getBarChartAxis = ({
39729
39739
  return {
39730
39740
  type: getScaleType(),
39731
39741
  position: axisData == null ? void 0 : axisData.position,
39732
- beginAtZero: (_e2 = (_d2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _d2.additionalAxesOptions) == null ? void 0 : _e2.beginAtZero,
39742
+ beginAtZero: (_c2 = options == null ? void 0 : options.additionalAxesOptions) == null ? void 0 : _c2.beginAtZero,
39733
39743
  reverse: getReverse(),
39734
- suggestedMax: (_g2 = (_f2 = chart2.options) == null ? void 0 : _f2.additionalAxesOptions) == null ? void 0 : _g2.suggestedMax,
39735
- suggestedMin: (_i2 = (_h2 = chart2.options) == null ? void 0 : _h2.additionalAxesOptions) == null ? void 0 : _i2.suggestedMin,
39736
- min: isDirectionCompatibleWithAxisType ? (_k2 = (_j2 = chart2.options) == null ? void 0 : _j2.additionalAxesOptions) == null ? void 0 : _k2.min : void 0,
39737
- max: isDirectionCompatibleWithAxisType ? (_m2 = (_l2 = chart2.options) == null ? void 0 : _l2.additionalAxesOptions) == null ? void 0 : _m2.max : void 0,
39744
+ suggestedMax: (_d2 = options == null ? void 0 : options.additionalAxesOptions) == null ? void 0 : _d2.suggestedMax,
39745
+ suggestedMin: (_e2 = options == null ? void 0 : options.additionalAxesOptions) == null ? void 0 : _e2.suggestedMin,
39746
+ min: isDirectionCompatibleWithAxisType ? (_f2 = options == null ? void 0 : options.additionalAxesOptions) == null ? void 0 : _f2.min : void 0,
39747
+ max: isDirectionCompatibleWithAxisType ? (_g2 = options == null ? void 0 : options.additionalAxesOptions) == null ? void 0 : _g2.max : void 0,
39738
39748
  title: {
39739
- display: ((_n2 = axisData == null ? void 0 : axisData.label) == null ? void 0 : _n2.length) || ((_o2 = axisData == null ? void 0 : axisData.unit) == null ? void 0 : _o2.length),
39749
+ display: ((_h2 = axisData == null ? void 0 : axisData.label) == null ? void 0 : _h2.length) || ((_i2 = axisData == null ? void 0 : axisData.unit) == null ? void 0 : _i2.length),
39740
39750
  text: (axisData == null ? void 0 : axisData.label) || (axisData == null ? void 0 : axisData.unit),
39741
39751
  padding: 0
39742
39752
  },
@@ -39744,7 +39754,7 @@ const getBarChartAxis = ({
39744
39754
  grid: {
39745
39755
  ...grid
39746
39756
  },
39747
- stacked: (_q2 = (_p2 = chart2 == null ? void 0 : chart2.options) == null ? void 0 : _p2.additionalAxesOptions) == null ? void 0 : _q2.stacked
39757
+ stacked: getStackedOptions(axisType, options == null ? void 0 : options.additionalAxesOptions)
39748
39758
  };
39749
39759
  };
39750
39760
  const getBarChartAxes = (chart2, axisType) => {
@@ -39964,7 +39974,9 @@ const defaultAdditionalAxesOptions$1 = (options) => ({
39964
39974
  suggestedMin: options == null ? void 0 : options.suggestedMin,
39965
39975
  suggestedMax: options == null ? void 0 : options.suggestedMax,
39966
39976
  min: options == null ? void 0 : options.min,
39967
- max: options == null ? void 0 : options.max
39977
+ max: options == null ? void 0 : options.max,
39978
+ stackedX: options == null ? void 0 : options.stackedX,
39979
+ stackedY: options == null ? void 0 : options.stackedY
39968
39980
  });
39969
39981
  const defaultChartStyling$1 = (styling) => ({
39970
39982
  width: styling == null ? void 0 : styling.width,
@@ -40043,6 +40055,8 @@ const getDefaultProps$1 = (props) => {
40043
40055
  };
40044
40056
  Chart$2.register(
40045
40057
  LinearScale$1,
40058
+ PointElement$1,
40059
+ LineElement$1,
40046
40060
  CategoryScale$1,
40047
40061
  LogarithmicScale$1,
40048
40062
  BarElement$1,