Pre loader

Updating Text Annotation with JavaScript.

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 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.

Version
2.2.2417
  • You must to post comments
0
0

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

  • You must to post comments
Showing 1 result
Your Answer

Please first to submit.

Try SciChart Today

Start a trial and discover why we are the choice
of demanding developers worldwide

Start TrialCase Studies