How can we change the color(Red) of custom box annotation when it is clicked .
thanks
- apoorv sharma asked 2 years ago
- You must login to post comments
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
- Andrew Burnett-Thompson answered 2 years ago
- You must login to post comments
Please login first to submit.