Search code examples
jsondrawingseriesrendereranychart

Anychart Series Custom Drawing with Json


We build our chart using a Json config and load it using anychart.fromJson(). This works quite well so far, but is it also possible to use it for Custom Drawing? For Custom Drawing I have to pass a drawer function to series.rendering() like so:

series.rendering().point(drawer).updatePoint(drawer);

Example: https://playground.anychart.com/docs/v8/samples/BCT_Custom_Drawing_03

I'm looking for a way to do this within the Json config. Is this even possible?

Or do I have to get the series object from the chart after I created the chart with anychart.fromJson()? Or is there perhaps a completely different way?


Solution

  • It's not possible via JSON because JSON format doesn't support functions. But you can apply the custom drawing function using JS API after parsing JSON. For details, check the sample.