@oliasoft-open-source/charts-library 4.7.6 → 4.7.7-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
@@ -26526,7 +26526,9 @@ const handleAnnotationMouseDown = (event, canvas2, scales, annotations, setDragg
26526
26526
  );
26527
26527
  const metrics = calculateAnnotationMetricsInValues(annotation2);
26528
26528
  if (annotation2 && annotation2.enableDrag && !isNil(metrics.centerY) && !isNil(metrics.centerX)) {
26529
- canvas2.style.cursor = CursorStyle.Move;
26529
+ if (!isNil(canvas2) && !isNil(canvas2.style)) {
26530
+ canvas2.style.cursor = CursorStyle.Move;
26531
+ }
26530
26532
  const dragStartX = x2 - metrics.centerX;
26531
26533
  const dragStartY = y2 - metrics.centerY;
26532
26534
  setDraggingState(true, annotation2, dragStartX, dragStartY);
@@ -26537,7 +26539,9 @@ const handleAnnotationMouseDown = (event, canvas2, scales, annotations, setDragg
26537
26539
  };
26538
26540
  const handleAnnotationMouseMove = (event, canvas2, scales, isDragging2, activeAnnotation, dragStartX, dragStartY, chart2) => {
26539
26541
  if (isDragging2 && activeAnnotation) {
26540
- canvas2.style.cursor = CursorStyle.Move;
26542
+ if (!isNil(canvas2) && !isNil(canvas2.style)) {
26543
+ canvas2.style.cursor = CursorStyle.Move;
26544
+ }
26541
26545
  const annotationId = activeAnnotation == null ? void 0 : activeAnnotation.id;
26542
26546
  setAnnotationBorderWidth(chart2, annotationId, BORDER_WIDTH.HOVERED);
26543
26547
  const dragAxis = (activeAnnotation == null ? void 0 : activeAnnotation.dragAxis) ?? DragAxis.Both;
@@ -26623,7 +26627,9 @@ const handleAnnotationMouseUp = (isDragging2, activeAnnotation, chart2, setDragg
26623
26627
  activeAnnotation
26624
26628
  );
26625
26629
  }
26626
- chart2.canvas.style.cursor = CursorStyle.Pointer;
26630
+ if (!isNil(chart2) && !isNil(chart2 == null ? void 0 : chart2.canvas) && !isNil(chart2 == null ? void 0 : chart2.canvas.style)) {
26631
+ chart2.canvas.style.cursor = CursorStyle.Pointer;
26632
+ }
26627
26633
  setDraggingState(false, null);
26628
26634
  }
26629
26635
  chart2.update();
@@ -26634,10 +26640,16 @@ const annotationLabel = (ctx, annotations, scales) => {
26634
26640
  var _a2;
26635
26641
  if (annotation2.type === AnnotationType.POINT && !isNil(annotation2 == null ? void 0 : annotation2.label) && ((_a2 = annotation2 == null ? void 0 : annotation2.label) == null ? void 0 : _a2.display)) {
26636
26642
  const { content, font, color: color2, position, padding } = (annotation2 == null ? void 0 : annotation2.label) ?? {};
26643
+ const { xScaleID = "x", yScaleID = "y" } = annotation2;
26637
26644
  ctx.save();
26638
26645
  ctx.font = font;
26639
26646
  ctx.fillStyle = color2;
26640
- const { centerX = -1, centerY = -1 } = calculateAnnotationMetricsInValuesInPixels(annotation2, scales);
26647
+ const { centerX = -1, centerY = -1 } = calculateAnnotationMetricsInValuesInPixels(
26648
+ annotation2,
26649
+ scales,
26650
+ xScaleID,
26651
+ yScaleID
26652
+ );
26641
26653
  const textWidth = ctx.measureText(content).width;
26642
26654
  let textX = centerX - textWidth / 2;
26643
26655
  let textY = centerY + 20;