@oliasoft-open-source/charts-library 4.7.6 → 4.7.7-beta-2

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,10 @@ const handleAnnotationMouseUp = (isDragging2, activeAnnotation, chart2, setDragg
26623
26627
  activeAnnotation
26624
26628
  );
26625
26629
  }
26626
- chart2.canvas.style.cursor = CursorStyle.Pointer;
26630
+ console.log("Chart", chart2);
26631
+ if (!isNil(chart2) && !isNil(chart2 == null ? void 0 : chart2.canvas) && !isNil(chart2 == null ? void 0 : chart2.canvas.style)) {
26632
+ chart2.canvas.style.cursor = CursorStyle.Pointer;
26633
+ }
26627
26634
  setDraggingState(false, null);
26628
26635
  }
26629
26636
  chart2.update();
@@ -26634,10 +26641,16 @@ const annotationLabel = (ctx, annotations, scales) => {
26634
26641
  var _a2;
26635
26642
  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
26643
  const { content, font, color: color2, position, padding } = (annotation2 == null ? void 0 : annotation2.label) ?? {};
26644
+ const { xScaleID = "x", yScaleID = "y" } = annotation2;
26637
26645
  ctx.save();
26638
26646
  ctx.font = font;
26639
26647
  ctx.fillStyle = color2;
26640
- const { centerX = -1, centerY = -1 } = calculateAnnotationMetricsInValuesInPixels(annotation2, scales);
26648
+ const { centerX = -1, centerY = -1 } = calculateAnnotationMetricsInValuesInPixels(
26649
+ annotation2,
26650
+ scales,
26651
+ xScaleID,
26652
+ yScaleID
26653
+ );
26641
26654
  const textWidth = ctx.measureText(content).width;
26642
26655
  let textX = centerX - textWidth / 2;
26643
26656
  let textY = centerY + 20;