Pre loader

Custom Box Annotation

Welcome to the SciChart Forums!

  • Please read our Question Asking Guidelines for how to format a good question
  • Some reputation is required to post answers. Get up-voted to avoid the spam filter!
  • We welcome community answers and upvotes. Every Q&A improves SciChart for everyone

WPF Forums | JavaScript Forums | Android Forums | iOS Forums

1
0

How can we change the color(Red) of custom box annotation when it is clicked .
thanks

Version
2.2.2411
Images
  • You must to post comments
0
0

Hi there,

I dont know about SciChart.js v2.2, but I do know that in v3 we have added an onClick callback to annotations. Check this out here:

IAnnotationBaseOptions.onClick

How this could be used:

// Assumes typescript. Remove typings in args and ts-ignore if JS
sciChartSurface.annotations.add(
  new BoxAnnotation({
    x1: 5,
    x2: 10,
    y1: 10,
    y2: 12,
    fill: "#FF333333",
    stroke: "Red",
    onClick: (args: AnnotationClickEventArgs) => {
      //@ts-ignore
      args.sender.fill = "#33FF3333";
      //@ts-ignore
      args.sender.stroke = "Green";
    }
  })
);

Here’s a codesandbox.io sandbox demonstrating it.

Best regards,
Andrew

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.