How to update the text Annotation in JavaScript. I can add the new Text annotation but I can’t update the old text Annotation. whether we have any option in sci chart for JavaScript.
- manoj prabakar asked 2 weeks ago
- You must login to post comments
Hi Manoj
I can’t comment on v2, but in v3 of SciChart.js this works perfectly fine. Was there something else you needed?
See the Codepen here.
const { SciChartSurface, NumericAxis, TextAnnotation, SciChartJsNavyTheme } = SciChart;
async function initSciChart() {
const { sciChartSurface, wasmContext } = await SciChartSurface.create("scichart-root", { theme: new SciChartJsNavyTheme() });
sciChartSurface.yAxes.add(new NumericAxis(wasmContext));
sciChartSurface.xAxes.add(new NumericAxis(wasmContext));
sciChartSurface.annotations.add(new TextAnnotation({
x1: 2, y1: 7, text: "In 2 seconds I will update", fontSize: 20, textColor: "White"}));
setTimeout(() => {
const annotation = sciChartSurface.annotations.get(0);
annotation.text = "Hello world";
annotation.x1 = 7;
annotation.y1 = 5;
}, 2000);
}
initSciChart();
Best regards,
Andrew
- Andrew Burnett-Thompson answered 2 weeks ago
- You must login to post comments
Please login first to submit.