How to create JSON for AnyChart?

Hi, how can I create a JSON like this a source for the AnyChart? I’m struggeling a little with the arrays and how to count the giraffes and elephants. [ {     "x": ["giraffes", "orangutans", "monkeys"],     "y": [20, 14, 23],     "name": "SF Zoo",     "type": "bar"   },     {     "x": ["giraffes", "orangutans", "monkeys"],     "y": [12, 18, 29],     "name": "LA Zoo",     "type": "bar"   } ]   Thanks in advance!  
2 answers

Hi Tjark,

You need to create a domain model based on the JSON structure.

If you need some reference, what you could do is create the JSON structure in Mendix and create a import mapping using the JSON structure and use map automatically → This will create a structure based on your selected elements. 

However, if you want to build lot of different charts using the same domain model then you will need to some design ahead so that it can be re-used (think of generalizing some stuff) for multiple charts. The easiest would be to pick two charts that you know would be used, and as and when you need to expand just add entities and attributes to it.


EDIT – You then need to create an export mapping and prefill the data in your entities before using that in your microflow. If there is a lot of data you can also look at OQL to speed up the processing. But this will take some time to setup.

Hope this helps!

Good luck.



Take a look at this Youtube explanation. Might be a good start.

(254) Mendix Anychart Crash Course - YouTube