Snippet: Charting framework for Archi

Started by Thomas Rohde, October 30, 2022, 13:04:41 PM

Previous topic - Next topic

Thomas Rohde

This gist snippet is an attempt at creating a charting framework for Archi. Currently, it only supports three simple chart types, but can easily be expanded (to any chart supported by Plotly JS).

Download all files from this gist, and place the chart specific files in __DIR__/lib. The primary charting script uses a lookup mechanism to load the appropriate code. Also, download the Plotly lib and place it in the __DIR__/lib directory (

Start charting by selecting a diagram-model-note in a view, then run the "Insert chart.ajs", which prompts for chart options and inserts a JSON string in a property of the selected diagram-model-note. Before ending, it calls the script "Refresh chart.ajs", which reads the JSON string and inserts the chart image in the note (using the dimensions of the note). When data in the model changes, you can refresh the chart by running "Refresh chart.ajs" again (with the note selected).

I was intending to use a canvas for charts, but I could not figure out how to set the image of a diagram-model-image.

I hope you find it useful, and even post your own chart scripts in the comments!