1

Annotations drawn by a user can be serialized to json in Anychart like below.

const data = chart.plot().annotations().toJson(true)

But is it possible to set an anchor on the x axis when serializing annotations drawn by a user so that it can be deserialized exactly where annotations were drawn in terms of x axis?

For instance, if the date range of the x axis changes the candlestick chart in the attached example will change, but annotations will be rendered in the same position, which becomes irrelevant. So it would be good if annotations could be moved (translated) along with the x axis.

example

brian goo
  • 13
  • 4
  • Not sure I understood you correctly. The serialized annotation are anchored to the x- and y-scale position as it was placed at the moment of serialization. How exactly you want to change this behavior? – AnyChart Support Sep 15 '21 at 06:14
  • I want it to be anchored at a specific date on the x axis, e.g. "2021-09-15", at the moment of serialization if possible, so that annotations can be placed where a user wanted it to be even though dates on the x axis change. – brian goo Sep 15 '21 at 09:21
  • You need to place the annotation to that date before serialization or you can simply change the value in the output json. – AnyChart Support Sep 16 '21 at 04:54
  • Well, I'm talking about annotations drawn by a user. Does that mean if I add annotation programmatically anchored at a specific date to the annotations drawn by a user, the whole annotations will be anchored at that date? – brian goo Sep 16 '21 at 06:51
  • The annotation applied by the user is serialized exactly as the user placed the annotation. If you need to modify that, you can modify the output JSON directly. – AnyChart Support Sep 16 '21 at 08:29
  • I am sorry, but how can I "modify" the output JSON if, for instance, I want to move a group of annotations including rectangles, markers, etc. to the left by 10 px? – brian goo Sep 16 '21 at 13:13
  • I'm afraid we need more details about your use case. Please, contact support@anychart.com The resulting solution we will post here later. – AnyChart Support Sep 17 '21 at 04:37

0 Answers0